comparison mm7_1.cpp @ 706:d6236f6a9882

Rough function rearranging to new files
author Gloval
date Tue, 19 Mar 2013 21:53:21 +0400
parents e39702f35283
children 735dab8d3c9a 70c5a87a1307
comparison
equal deleted inserted replaced
705:e39702f35283 706:d6236f6a9882
65 65
66 66
67 67
68 68
69 69
70 void __cdecl FreeSavegameThumbnails()
71 {
72 for (int i = 0; i < 40; ++i)
73 //pAllocator->FreeChunk(pSavegameThumbnails[i].pPixels);
74 pSavegameThumbnails[i].Release();
75 }
76 70
77 71
78 //----- (004196A0) -------------------------------------------------------- 72 //----- (004196A0) --------------------------------------------------------
79 void __cdecl sub_4196A0() 73 void __cdecl sub_4196A0()
80 { 74 {
110 // 506984: using guessed type int dword_506984; 104 // 506984: using guessed type int dword_506984;
111 // 506988: using guessed type int dword_506988; 105 // 506988: using guessed type int dword_506988;
112 // 50698C: using guessed type int dword_50698C; 106 // 50698C: using guessed type int dword_50698C;
113 // 507CC0: using guessed type int dword_507CC0; 107 // 507CC0: using guessed type int dword_507CC0;
114 108
115 //----- (00419719) -------------------------------------------------------- 109
116 char __fastcall CharacterUI_SkillsTab_Draw(unsigned int uPlayerID)
117 {
118 unsigned int v1; // esi@1
119 Player *pPlayer; // ebp@1
120 unsigned int v3; // eax@1
121 signed int v4; // ecx@1
122 int v5; // edi@3
123 GUIWindow *v6; // ecx@3
124 int v7; // eax@4
125 GUIButton *v8; // edx@5
126 int v9; // eax@7
127 unsigned int v10; // ecx@9
128 unsigned __int16 v11; // ax@9
129 int v12; // eax@9
130 unsigned __int8 v13; // cf@12
131 unsigned __int8 v14; // zf@12
132 unsigned int v15; // eax@12
133 char *v16; // ecx@22
134 GUIWindow *v17; // ecx@33
135 int v18; // edx@34
136 GUIButton *v19; // eax@35
137 int v20; // edx@37
138 unsigned __int16 v21; // cx@39
139 unsigned int v22; // eax@39
140 int v23; // edi@39
141 unsigned int v24; // eax@42
142 char v25; // sf@52
143 char *v26; // ecx@52
144 int v27; // edi@63
145 GUIWindow *v28; // ecx@63
146 int v29; // edx@64
147 GUIButton *v30; // eax@65
148 int v31; // edx@67
149 unsigned int v32; // ecx@69
150 int v33; // eax@69
151 unsigned int v34; // eax@72
152 char *v35; // ecx@82
153 GUIWindow *v36; // ecx@93
154 int v37; // edx@94
155 GUIButton *v38; // eax@94
156 int v39; // edx@97
157 unsigned __int16 v40; // cx@99
158 unsigned int v41; // eax@99
159 int v42; // edi@99
160 unsigned int v43; // eax@102
161 char *v44; // ecx@112
162 char *v46; // [sp-Ch] [bp-4Ch]@19
163 char *v47; // [sp-Ch] [bp-4Ch]@49
164 char *v48; // [sp-Ch] [bp-4Ch]@79
165 char *v49; // [sp-Ch] [bp-4Ch]@109
166 unsigned int v50; // [sp-8h] [bp-48h]@19
167 unsigned int v51; // [sp-8h] [bp-48h]@49
168 unsigned int v52; // [sp-8h] [bp-48h]@79
169 unsigned int v53; // [sp-8h] [bp-48h]@109
170 int v54; // [sp-4h] [bp-44h]@19
171 int v55; // [sp-4h] [bp-44h]@49
172 int v56; // [sp-4h] [bp-44h]@79
173 int v57; // [sp-4h] [bp-44h]@109
174 unsigned int v58; // [sp+10h] [bp-30h]@9
175 unsigned int v59; // [sp+10h] [bp-30h]@39
176 unsigned int v60; // [sp+10h] [bp-30h]@69
177 unsigned int v61; // [sp+10h] [bp-30h]@99
178 int v62; // [sp+14h] [bp-2Ch]@4
179 int v63; // [sp+14h] [bp-2Ch]@34
180 int v64; // [sp+14h] [bp-2Ch]@64
181 int v65; // [sp+14h] [bp-2Ch]@94
182 signed int i; // [sp+18h] [bp-28h]@4
183 signed int v67; // [sp+18h] [bp-28h]@34
184 signed int v68; // [sp+18h] [bp-28h]@64
185 signed int v69; // [sp+18h] [bp-28h]@94
186 int v70; // [sp+1Ch] [bp-24h]@3
187 int v71; // [sp+1Ch] [bp-24h]@33
188 int v72; // [sp+1Ch] [bp-24h]@63
189 int v73; // [sp+1Ch] [bp-24h]@93
190 int uY; // [sp+20h] [bp-20h]@9
191 int uYa; // [sp+20h] [bp-20h]@33
192 int uYb; // [sp+20h] [bp-20h]@69
193 int uYc; // [sp+20h] [bp-20h]@93
194 unsigned int a5; // [sp+24h] [bp-1Ch]@1
195 unsigned int v79; // [sp+28h] [bp-18h]@1
196 int *v80; // [sp+2Ch] [bp-14h]@3
197 int *v81; // [sp+2Ch] [bp-14h]@33
198 int *v82; // [sp+2Ch] [bp-14h]@63
199 int *v83; // [sp+2Ch] [bp-14h]@93
200 unsigned int v84; // [sp+30h] [bp-10h]@1
201 int v85; // [sp+34h] [bp-Ch]@1
202 unsigned int v86; // [sp+38h] [bp-8h]@1
203 unsigned __int16 v87; // [sp+3Ch] [bp-4h]@9
204 char *v88; // [sp+3Ch] [bp-4h]@24
205 char *v89; // [sp+3Ch] [bp-4h]@54
206 unsigned __int16 v90; // [sp+3Ch] [bp-4h]@69
207 char *v91; // [sp+3Ch] [bp-4h]@84
208 char *v92; // [sp+3Ch] [bp-4h]@114
209
210 v1 = uPlayerID;
211 a5 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
212 v84 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xAFu, 0xFFu);
213 v85 = pGUIWindow_CurrentMenu->pCurrentPosActiveItem;
214 v86 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0, 0);
215 v79 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0);
216 pPlayer = &pParty->pPlayers[v1-1];
217 v3 = pIcons_LOD->LoadTexture("fr_skill", TEXTURE_16BIT_PALETTE);
218 pRenderer->DrawTextureIndexed(8u, 8u, (Texture *)(v3 != -1 ? (int)&pIcons_LOD->pTextures[v3] : 0));
219 v4 = v79;
220 if ( !pPlayer->uSkillPoints )
221 v4 = 65535;
222 sprintf(
223 pTmpBuf,
224 "%s \f%05d%s\f00000\r177%s: \f%05d%d\f00000",
225 pGlobalTXT_LocalizationStrings[206], // Skills for
226 a5,
227 pPlayer->pName,
228 pGlobalTXT_LocalizationStrings[207], // Skill Points
229 v4,
230 pPlayer->uSkillPoints);
231 pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, 18, 0, pTmpBuf, 0, 0, 0);
232 v5 = 2 * LOBYTE(pFontLucida->uFontHeight) + 13;// Weapons, Level
233 sprintf(pTmpBuf, "%s\r400%s", pGlobalTXT_LocalizationStrings[242], pGlobalTXT_LocalizationStrings[131]);
234 pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, v5, a5, pTmpBuf, 0, 0, 0);
235 v6 = pGUIWindow_CurrentMenu;
236 v70 = 0;
237 v80 = pWeaponSkills;
238 do
239 {
240 v62 = *v80;
241 v7 = 0;
242 for ( i = 0; i < (signed int)v6->uNumControls; v7 = i++ + 1 )
243 {
244 v8 = v6->pControlsHead;
245 if ( v7 > 0 )
246 {
247 do
248 {
249 v8 = v8->pNext;
250 --v7;
251 }
252 while ( v7 );
253 }
254 v9 = v8->field_1C;
255 if ( SBYTE1(v9) >= 0 )
256 continue;
257 BYTE1(v9) &= 0x7Fu;
258 if ( v9 != v62 )
259 continue;
260 v5 = v8->uY;
261 v10 = pPlayer->uSkillPoints;
262 ++v70;
263 v11 = pPlayer->pActiveSkills[v62];
264 v87 = pPlayer->pActiveSkills[v62];
265 v12 = v11 & 0x3F;
266 v58 = 0;
267 uY = v12;
268 if ( v10 >= v12 + 1 )
269 v58 = v84;
270 if ( v85 == i )
271 {
272 v13 = v10 < v12;
273 v14 = v10 == v12;
274 v15 = v86;
275 if ( !(v13 | v14) )
276 v15 = v79;
277 v58 = v15;
278 }
279 else
280 {
281 v15 = v58;
282 }
283 if ( HIBYTE(v87) & 1 )
284 {
285 if ( !v15 )
286 v15 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
287 v54 = uY;
288 v50 = v58;
289 v46 = pGlobalTXT_LocalizationStrings[96];
290 }
291 else
292 {
293 if ( !(v87 & 0xC0) )
294 {
295 sprintf(pTmpBuf, "%s\r400%2d", pSkillNames[v62], uY);
296 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 24, v5, v58, pTmpBuf, 0, 0, 0);
297 v6 = pGUIWindow_CurrentMenu;
298 continue;
299 }
300 v16 = pGlobalTXT_LocalizationStrings[432];
301 if ( (v87 & 0x80u) == 0 )
302 v16 = pGlobalTXT_LocalizationStrings[433];
303 v88 = v16;
304 if ( !v15 )
305 v15 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
306 v54 = uY;
307 v50 = v58;
308 v46 = v88;
309 }
310 sprintf(pTmpBuf, "%s ", pSkillNames[v62], v15, v46, v50, v54);
311 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 24, v5, v58, pTmpBuf, 0, 0, 0);
312 v6 = pGUIWindow_CurrentMenu;
313 }
314 ++v80;
315 }
316 while ( v80 <= &pWeaponSkills[8]);
317 if ( !v70 )
318 {
319 v5 = v5 + LOBYTE(pFontLucida->uFontHeight) - 3;
320 v6->DrawText(pFontLucida, 24, v5, 0, pGlobalTXT_LocalizationStrings[153], 0, 0, 0);
321 }
322 uYa = v5 + 2 * LOBYTE(pFontLucida->uFontHeight) - 10;
323 sprintf(pTmpBuf, "%s\r400%s", pGlobalTXT_LocalizationStrings[138], pGlobalTXT_LocalizationStrings[131]);
324 pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, uYa, a5, pTmpBuf, 0, 0, 0);
325 v17 = pGUIWindow_CurrentMenu;
326 v71 = 0;
327 v81 = pMagicSkills;
328 do
329 {
330 v18 = 0;
331 v67 = 0;
332 v63 = *v81;
333 while ( v67 < (signed int)v17->uNumControls )
334 {
335 v19 = v17->pControlsHead;
336 if ( v18 > 0 )
337 {
338 do
339 {
340 v19 = v19->pNext;
341 --v18;
342 }
343 while ( v18 );
344 }
345 v20 = v19->field_1C;
346 if ( SBYTE1(v20) >= 0 || (BYTE1(v20) &= 0x7Fu, v20 != v63) )
347 {
348 v18 = v67++ + 1;
349 continue;
350 }
351 ++v71;
352 uYa = v19->uY;
353 v21 = pPlayer->pActiveSkills[v63];
354 v22 = pPlayer->uSkillPoints;
355 v23 = pPlayer->pActiveSkills[v63] & 0x3F;
356 v59 = 0;
357 if ( v22 >= v23 + 1 )
358 v59 = v84;
359 if ( v85 == v67 )
360 {
361 v13 = v22 < v23;
362 v14 = v22 == v23;
363 v24 = v86;
364 if ( !(v13 | v14) )
365 v24 = v79;
366 v59 = v24;
367 }
368 else
369 {
370 v24 = v59;
371 }
372 if ( HIBYTE(v21) & 1 )
373 {
374 if ( !v24 )
375 v24 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
376 v55 = v23;
377 v51 = v59;
378 v47 = pGlobalTXT_LocalizationStrings[96];
379 }
380 else
381 {
382 if ( !(v21 & 0xC0) )
383 {
384 sprintf(pTmpBuf, "%s\r400%2d", pSkillNames[v63], v23);
385 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 24, uYa, v59, pTmpBuf, 0, 0, 0);
386 v17 = pGUIWindow_CurrentMenu;
387 v18 = v67++ + 1;
388 continue;
389 }
390 v25 = (v21 & 0x80u) != 0;
391 v26 = pGlobalTXT_LocalizationStrings[432];
392 if ( !v25 )
393 v26 = pGlobalTXT_LocalizationStrings[433];
394 v89 = v26;
395 if ( !v24 )
396 v24 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
397 v55 = v23;
398 v51 = v59;
399 v47 = v89;
400 }
401 sprintf(pTmpBuf, "%s ", pSkillNames[v63], v24, v47, v51, v55);
402 //LABEL_58:
403 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 24, uYa, v59, pTmpBuf, 0, 0, 0);
404 v17 = pGUIWindow_CurrentMenu;
405 //LABEL_59:
406 v18 = v67++ + 1;
407 }
408 ++v81;
409 }
410 while ( v81 <= &pMagicSkills[8]);
411 if ( !v71 )
412 v17->DrawText(
413 pFontLucida,
414 24,
415 LOBYTE(pFontLucida->uFontHeight) + uYa - 3,
416 0,
417 pGlobalTXT_LocalizationStrings[153],
418 0,
419 0,
420 0);
421 v27 = 2 * LOBYTE(pFontLucida->uFontHeight) + 13;
422 sprintf(pTmpBuf, "%s\r177%s", pGlobalTXT_LocalizationStrings[11], pGlobalTXT_LocalizationStrings[131]);
423 pGUIWindow_CurrentMenu->DrawText(pFontArrus, 248, v27, a5, pTmpBuf, 0, 0, 0);
424 v28 = pGUIWindow_CurrentMenu;
425 v72 = 0;
426 v82 = pArmorSkills;
427 do
428 {
429 v29 = 0;
430 v68 = 0;
431 v64 = *v82;
432 while ( v68 < (signed int)v28->uNumControls )
433 {
434 v30 = v28->pControlsHead;
435 if ( v29 > 0 )
436 {
437 do
438 {
439 v30 = v30->pNext;
440 --v29;
441 }
442 while ( v29 );
443 }
444 v31 = v30->field_1C;
445 if ( SBYTE1(v31) >= 0 || (BYTE1(v31) &= 0x7Fu, v31 != v64) )
446 {
447 v29 = v68++ + 1;
448 continue;
449 }
450 v27 = v30->uY;
451 ++v72;
452 v60 = 0;
453 v90 = pPlayer->pActiveSkills[v64];
454 v32 = pPlayer->uSkillPoints;
455 v33 = pPlayer->pActiveSkills[v64] & 0x3F;
456 uYb = v33;
457 if ( v32 >= v33 + 1 )
458 v60 = v84;
459 if ( v85 == v68 )
460 {
461 v13 = v32 < v33;
462 v14 = v32 == v33;
463 v34 = v86;
464 if ( !(v13 | v14) )
465 v34 = v79;
466 v60 = v34;
467 }
468 else
469 {
470 v34 = v60;
471 }
472 if ( (pPlayer->pActiveSkills[v64] >> 8) & 1 )
473 {
474 if ( !v34 )
475 v34 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
476 v56 = uYb;
477 v52 = v60;
478 v48 = pGlobalTXT_LocalizationStrings[96];
479 }
480 else
481 {
482 if ( !(v90 & 0xC0) )
483 {
484 sprintf(pTmpBuf, "%s\r177%2d", pSkillNames[v64], uYb);
485 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 248, v27, v60, pTmpBuf, 0, 0, 0);
486 v28 = pGUIWindow_CurrentMenu;
487 v29 = v68++ + 1;
488 continue;
489 }
490 v35 = pGlobalTXT_LocalizationStrings[432];
491 if ( (v90 & 0x80u) == 0 )
492 v35 = pGlobalTXT_LocalizationStrings[433];
493 v91 = v35;
494 if ( !v34 )
495 v34 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
496 v56 = uYb;
497 v52 = v60;
498 v48 = v91;
499 }
500 sprintf(pTmpBuf, "%s ", pSkillNames[v64], v34, v48, v52, v56);
501 //LABEL_88:
502 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 248, v27, v60, pTmpBuf, 0, 0, 0);
503 v28 = pGUIWindow_CurrentMenu;
504 //LABEL_89:
505 v29 = v68++ + 1;
506 }
507 ++v82;
508 }
509 while ( v82 <= &pArmorSkills[4]);
510 if ( !v72 )
511 {
512 v27 = v27 + LOBYTE(pFontLucida->uFontHeight) - 3;
513 v28->DrawText(pFontLucida, 248, v27, 0, pGlobalTXT_LocalizationStrings[153], 0, 0, 0);
514 }
515 uYc = v27 + 2 * LOBYTE(pFontLucida->uFontHeight) - 10;
516 sprintf(pTmpBuf, "%s\r177%s", pGlobalTXT_LocalizationStrings[143], pGlobalTXT_LocalizationStrings[131]);
517 pGUIWindow_CurrentMenu->DrawText(pFontArrus, 248, uYc, a5, pTmpBuf, 0, 0, 0);
518 v36 = pGUIWindow_CurrentMenu;
519 v73 = 0;
520 v83 = pMiscSkills;
521 do
522 {
523 v37 = 0;
524 v69 = 0;
525 v38 = (GUIButton *)*v83;
526 v65 = *v83;
527 while ( v69 < (signed int)v36->uNumControls )
528 {
529 v38 = v36->pControlsHead;
530 if ( v37 > 0 )
531 {
532 do
533 {
534 v38 = v38->pNext;
535 --v37;
536 }
537 while ( v37 );
538 }
539 v39 = v38->field_1C;
540 if ( SBYTE1(v39) >= 0 || (BYTE1(v39) &= 0x7Fu, v39 != v65) )
541 {
542 //goto LABEL_119;
543 v37 = v69++ + 1;
544 continue;
545 }
546 ++v73;
547 uYc = v38->uY;
548 v40 = pPlayer->pActiveSkills[v65];
549 v41 = pPlayer->uSkillPoints;
550 v42 = pPlayer->pActiveSkills[v65] & 0x3F;
551 v61 = 0;
552 if ( v41 >= v42 + 1 )
553 v61 = v84;
554 if ( v85 == v69 )
555 {
556 v13 = v41 < v42;
557 v14 = v41 == v42;
558 v43 = v86;
559 if ( !(v13 | v14) )
560 v43 = v79;
561 v61 = v43;
562 }
563 else
564 {
565 v43 = v61;
566 }
567 if ( HIBYTE(v40) & 1 )
568 {
569 if ( !v43 )
570 v43 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
571 v57 = v42;
572 v53 = v61;
573 v49 = pGlobalTXT_LocalizationStrings[96];
574 }
575 else
576 {
577 if ( !(v40 & 0xC0) )
578 {
579 sprintf(pTmpBuf, "%s\r177%2d", pSkillNames[v65], v42);
580 LOBYTE(v38) = pGUIWindow_CurrentMenu->DrawText(pFontLucida, 248, uYc, v61, pTmpBuf, 0, 0, 0);
581 v36 = pGUIWindow_CurrentMenu;
582 v37 = v69++ + 1;
583 continue;
584 }
585 v25 = (v40 & 0x80u) != 0;
586 v44 = pGlobalTXT_LocalizationStrings[432];
587 if ( !v25 )
588 v44 = pGlobalTXT_LocalizationStrings[433];
589 v92 = v44;
590 if ( !v43 )
591 v43 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
592 v57 = v42;
593 v53 = v61;
594 v49 = v92;
595 }
596 sprintf(pTmpBuf, "%s ", pSkillNames[v65], v43, v49, v53, v57);
597 LOBYTE(v38) = pGUIWindow_CurrentMenu->DrawText(pFontLucida, 248, uYc, v61, pTmpBuf, 0, 0, 0);
598 v36 = pGUIWindow_CurrentMenu;
599 v37 = v69++ + 1;
600 }
601 ++v83;
602 }
603 while ( v83 <= &pMiscSkills[11]);
604 if ( !v73 )
605 LOBYTE(v38) = v36->DrawText(
606 pFontLucida,
607 248,
608 LOBYTE(pFontLucida->uFontHeight) + uYc - 3,
609 0,
610 pGlobalTXT_LocalizationStrings[153],
611 0,
612 0,
613 0);
614 return (char)v38;
615 }
616
617 //----- (0041A000) --------------------------------------------------------
618 void CharacterUI_AwardsTab_Draw( unsigned int uPlayerID )
619 {
620 //unsigned int v1; // esi@1
621 unsigned int v2; // ebx@1
622 unsigned int award_texture_id; // eax@1
623 unsigned int result; // eax@1
624 int v5; // eax@15
625 char *v6; // ebx@15
626 int v7; // eax@23
627 int v8; // eax@24
628 int v9; // eax@25
629 int v10; // eax@27
630 int v11; // eax@32
631 int v12; // eax@33
632 int v13; // eax@34
633 signed int v14; // eax@43
634 unsigned int v15; // eax@43
635 int v16; // eax@43
636 int v17; // [sp-4h] [bp-D4h]@16
637 char Source[100]; // [sp+Ch] [bp-C4h]@1
638 GUIWindow a1; // [sp+70h] [bp-60h]@1
639 unsigned int v20; // [sp+C4h] [bp-Ch]@15
640 int v21; // [sp+C8h] [bp-8h]@14
641 int v22; // [sp+CCh] [bp-4h]@40
642
643 auto player = &pParty->pPlayers[uPlayerID - 1];
644 //v1 = uPlayerID;
645 v2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
646 award_texture_id = pIcons_LOD->LoadTexture("fr_award", TEXTURE_16BIT_PALETTE);
647 pRenderer->DrawTextureIndexed(8u, 8u, (Texture *)(award_texture_id != -1 ? &pIcons_LOD->pTextures[award_texture_id] : 0));
648 sprintfex(pTmpBuf, "%s \f%05d", pGlobalTXT_LocalizationStrings[LOCSTR_AVARDS_FOR], v2);
649 sprintfex(Source, pGlobalTXT_LocalizationStrings[LOCSTR_S_THE_S], player->pName, pClassNames[player->classType]);
650 strcat(pTmpBuf, Source);
651 strcat(pTmpBuf, "\f00000");
652 pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, 18, 0, pTmpBuf, 0, 0, 0);
653 result = dword_506528;
654 a1.uFrameX = 12;
655 a1.uFrameY = 48;
656 a1.uFrameWidth = 424;
657 a1.uFrameHeight = 290;
658 a1.uFrameZ = 435;
659 a1.uFrameW = 337;
660 if ( dword_506544 && awards_count + dword_506528 < awards_count2 )
661 result = dword_506528++ + 1;
662 if ( dword_506548 && result )
663 {
664 --result;
665 dword_506528 = result;
666 }
667 if ( dword_50651C < 0 )
668 {
669 result += awards_count;
670 dword_506528 = result;
671 if ( (signed int)(awards_count + result) > awards_count2 )
672 {
673 result = awards_count2 - awards_count;
674 dword_506528 = result;
675 }
676 }
677 else if ( dword_50651C > 0 )
678 {
679 result -= awards_count;
680 dword_506528 = result;
681 if ( (result & 0x80000000u) != 0 )
682 {
683 result = 0;
684 dword_506528 = result;
685 }
686 }
687 //LABEL_14:
688 dword_506544 = 0;
689 dword_506548 = 0;
690 awards_count = 0;
691 dword_50651C = 0;
692 v21 = result;
693 if ( (signed int)result < awards_count2 )
694 {
695 while ( 1 )
696 {
697 v5 = achievedAwardsIndex[v21];
698 v20 = achievedAwardsIndex[v21];
699 v6 = (char *)pAwards[v20].pText;//(char *)dword_723E80_award_related[v20 / 4];
700 if ( v5 != 1 )
701 {
702 if (!( (v5 < 85 || v5 > 91) && (v5 < 103 || v5 > 104) ))
703 {
704 if ( v5 > 89 )
705 {
706 if ( v5 == 90 )
707 {
708 v10 = (unsigned __int8)pParty->uNumArenaKnightWins;
709 v22 = v10;
710 }
711 else if ( v5 == 91 )
712 {
713 v10 = (unsigned __int8)pParty->uNumArenaLordWins;
714 v22 = v10;
715 }
716 else if ( v5 == 103 )
717 {
718 v10 = pParty->field_874;
719 v22 = v10;
720 }
721 else if ( v5 == 104 )
722 {
723 v10 = pParty->field_878;
724 v22 = v10;
725 }
726 }
727 else
728 {
729 if ( v5 == 89 )
730 {
731 v10 = (unsigned __int8)pParty->uNumArenaSquireWins;
732 v22 = v10;
733 }
734 else if ( v5 == 85 )
735 {
736 v10 = pParty->uNumDeaths;
737 v22 = v10;
738 }
739 else if ( v5 == 86 )
740 {
741 v10 = pParty->uNumBountiesCollected;
742 v22 = v10;
743 }
744 else if ( v5 == 87 )
745 {
746 v10 = pParty->uNumPrisonTerms;
747 v22 = v10;
748 }
749 else if ( v5 == 88)
750 {
751 v10 = (unsigned __int8)pParty->uNumArenaPageWins;
752 v22 = v10;
753 }
754 }
755 v17 = v22;
756 sprintf(pTmpBuf, v6, v17);
757 v6 = pTmpBuf;
758 }
759 }
760 else
761 {
762 v17 = pParty->uFine;
763 sprintf(pTmpBuf, v6, v17);
764 v6 = pTmpBuf;
765 }
766 v14 = pAwards[v20].uSort;//dword_723E84[v20 / 4];
767 ++awards_count;
768 v15 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(
769 pAwardsTextColors[3 * v14 % 6],
770 pAwardsTextColors[3 * v14 % 6 + 1],
771 pAwardsTextColors[3 * v14 % 6 + 2]);
772 a1.DrawText(pFontArrus, 0, 0, v15, v6, 0, 0, 0);
773 v16 = pFontArrus->CalcTextHeight(v6, &a1, 0, 0);
774 result = v16 + a1.uFrameY + 4;
775 if ( (signed int)result <= (signed int)a1.uFrameHeight )
776 {
777 ++v21;
778 a1.uFrameY = result;
779 result = v21;
780 if ( v21 < awards_count2 )
781 continue;
782 }
783 return;
784 }
785
786 }
787 return;
788 }
789 // 50651C: using guessed type int dword_50651C; 110 // 50651C: using guessed type int dword_50651C;
790 // 506520: using guessed type int dword_506520; 111 // 506520: using guessed type int dword_506520;
791 // 506524: using guessed type int dword_506524; 112 // 506524: using guessed type int dword_506524;
792 // 506528: using guessed type int dword_506528; 113 // 506528: using guessed type int dword_506528;
793 // 506544: using guessed type int dword_506544; 114 // 506544: using guessed type int dword_506544;
794 // 506548: using guessed type int dword_506548; 115 // 506548: using guessed type int dword_506548;
795 // 723E80: using guessed type int dword_723E80_award_related[]; 116 // 723E80: using guessed type int dword_723E80_award_related[];
796 // 723E84: using guessed type int dword_723E84[]; 117 // 723E84: using guessed type int dword_723E84[];
797 118
798 //----- (0041A2C1) -------------------------------------------------------- 119
799 unsigned int __fastcall GetSizeInInventorySlots(unsigned int uNumPixels) 120
800 {
801 if ( (signed int)uNumPixels < 14 )
802 uNumPixels = 14;
803 return ((signed int)(uNumPixels - 14) >> 5) + 1;
804 }
805
806 //----- (0041A2D1) --------------------------------------------------------
807 void __fastcall CharacterUI_InventoryTab_Draw(unsigned int uPlayerID, char a2)
808 {
809 Player *pPlayer; // esi@1
810 char v3; // bl@1
811 unsigned int v4; // eax@2
812 ItemGen *pItem; // ebx@5
813 unsigned int v6; // eax@6
814 Texture *v7; // esi@6
815 __int16 v8; // ax@6
816 signed int v9; // edi@6
817 signed int v10; // ecx@6
818 signed int v11; // edx@6
819 signed int v12; // eax@11
820 int v13; // eax@13
821 signed int v14; // edx@13
822 int v15; // eax@13
823 unsigned int v16; // ebx@15
824 unsigned int v17; // edi@15
825 Texture *pTexture; // ebx@24
826 double v19; // st7@26
827 const char *v20; // [sp-8h] [bp-40h]@20
828 Player *pPlayer2; // [sp+14h] [bp-24h]@1
829 int uTextureId; // [sp+18h] [bp-20h]@6
830 int *v23; // [sp+1Ch] [bp-1Ch]@1
831 int v24; // [sp+20h] [bp-18h]@5
832 ItemGen *pItem2; // [sp+24h] [bp-14h]@5
833 int v26; // [sp+28h] [bp-10h]@3
834 unsigned int uCellID; // [sp+2Ch] [bp-Ch]@3
835 unsigned int uCellX; // [sp+30h] [bp-8h]@5
836 unsigned int uCellY; // [sp+34h] [bp-4h]@5
837
838 v23 = pRenderer->pActiveZBuffer;
839 pPlayer = pPlayers[uPlayerID];
840 v3 = a2;
841 pPlayer2 = pPlayers[uPlayerID];
842 pRenderer->DrawTextureIndexed(8, 8, (Texture *)(uTextureID_507958 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_507958] : 0));
843 if ( v3 )
844 {
845 v4 = pIcons_LOD->LoadTexture("fr_strip", TEXTURE_16BIT_PALETTE);
846 pRenderer->DrawTextureIndexed(8u, 0x131u, (Texture *)(v4 != -1 ? (int)&pIcons_LOD->pTextures[v4] : 0));
847 }
848 uCellID = 0;
849 v26 = (int)pPlayer->pInventoryIndices;
850 do
851 {
852 if ( *(int *)v26 > 0 )
853 {
854 v24 = *(int *)v26 - 1;
855 uCellY = 32 * (uCellID / 14) + 17;
856 pItem = &pPlayer->pInventoryItems[v24];
857 uCellX = 32 * (uCellID % 14) + 14;
858 pItem2 = pItem;
859 if ( pItem->uItemID )
860 {
861 v6 = pIcons_LOD->LoadTexture(pItemsTable->pItems[pItem->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
862 uTextureId = v6;
863 v7 = (Texture *)(v6 != -1 ? (int)&pIcons_LOD->pTextures[v6] : 0);
864 v8 = (v6 != -1 ? pIcons_LOD->pTextures[v6].uTextureWidth : 24);
865 v9 = v7->uTextureHeight;
866 v10 = v7->uTextureWidth;
867 v11 = v7->uTextureWidth;
868 if ( v10 < 14 )
869 v11 = 14;
870 if ( (v11 - 14) >> 5 == 0 && v8 < 32 )
871 uCellX += (32 - v10) / 2;
872 v12 = v7->uTextureWidth;
873 if ( v10 < 14 )
874 v12 = 14;
875 v13 = v12 - 14;
876 v14 = v7->uTextureHeight;
877 LOBYTE(v13) = v13 & 0xE0;
878 v15 = v13 + 32;
879 if ( v9 < 14 )
880 v14 = 14;
881 v16 = pItem->uAttributes;
882 v17 = uCellX + ((v15 - v10) >> 1) + pSRZBufferLineOffsets[uCellY + ((((v14 - 14) & 0xFFFFFFE0) - v9 + 32) >> 1)];
883 if ( !(v16 & 0xF0) )
884 {
885 if (pItem->Identified() || pCurrentScreen != SCREEN_HOUSE )
886 {
887 if (pItem->Broken())
888 pRenderer->DrawTransparentRedShade(uCellX, uCellY, v7);
889 else
890 pRenderer->DrawTextureTransparent(uCellX, uCellY, v7);
891 }
892 else
893 {
894 pRenderer->DrawTransparentGreenShade(uCellX, uCellY, v7);
895 }
896 ZBuffer_Fill(&v23[v17], uTextureId, v24 + 1);
897 pPlayer = pPlayer2;
898 //goto LABEL_34;
899 ++uCellID;
900 v26 += 4;
901 continue;
902 }
903 if ( (unsigned __int8)(v16 & 0xF0) != 16 )
904 {
905 if ( (unsigned __int8)(v16 & 0xF0) == 32 )
906 {
907 v20 = "sp28a";
908 pTexture = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v20, TEXTURE_16BIT_PALETTE)];
909 dword_50C9A8 -= pEventTimer->uTimeElapsed;
910 if ( dword_50C9A8 <= 0 )
911 {
912 dword_50C9A8 = 0;
913 LOBYTE(pItem2->uAttributes) &= 0xFu;
914 ptr_50C9A4 = 0;
915 }
916 v19 = (double)GetTickCount() * 0.1;
917 pRenderer->_4A63E6(uCellX, uCellY, v7, pTexture, (signed __int64)v19, 0, 255);
918 ZBuffer_Fill(&v23[v17], uTextureId, v24 + 1);
919 pPlayer = pPlayer2;
920 //goto LABEL_34;
921 ++uCellID;
922 v26 += 4;
923 continue;
924 }
925 if ( (unsigned __int8)(v16 & 0xF0) == 64 )
926 {
927 v20 = "sp30a";
928 pTexture = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v20, TEXTURE_16BIT_PALETTE)];
929 dword_50C9A8 -= pEventTimer->uTimeElapsed;
930 if ( dword_50C9A8 <= 0 )
931 {
932 dword_50C9A8 = 0;
933 LOBYTE(pItem2->uAttributes) &= 0xFu;
934 ptr_50C9A4 = 0;
935 }
936 v19 = (double)GetTickCount() * 0.1;
937 pRenderer->_4A63E6(uCellX, uCellY, v7, pTexture, (signed __int64)v19, 0, 255);
938 ZBuffer_Fill(&v23[v17], uTextureId, v24 + 1);
939 pPlayer = pPlayer2;
940 //goto LABEL_34;
941 ++uCellID;
942 v26 += 4;
943 continue;
944 }
945 if ( (unsigned __int8)(v16 & 0xF0) == 128 )
946 {
947 v20 = "sp91a";
948 pTexture = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v20, TEXTURE_16BIT_PALETTE)];
949 dword_50C9A8 -= pEventTimer->uTimeElapsed;
950 if ( dword_50C9A8 <= 0 )
951 {
952 dword_50C9A8 = 0;
953 LOBYTE(pItem2->uAttributes) &= 0xFu;
954 ptr_50C9A4 = 0;
955 }
956 v19 = (double)GetTickCount() * 0.1;
957 pRenderer->_4A63E6(uCellX, uCellY, v7, pTexture, (signed __int64)v19, 0, 255);
958 ZBuffer_Fill(&v23[v17], uTextureId, v24 + 1);
959 pPlayer = pPlayer2;
960 //goto LABEL_34;
961 ++uCellID;
962 v26 += 4;
963 continue;
964 }
965 }
966 v20 = "sptext01";
967 pTexture = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v20, TEXTURE_16BIT_PALETTE)];
968 dword_50C9A8 -= pEventTimer->uTimeElapsed;
969 if ( dword_50C9A8 <= 0 )
970 {
971 dword_50C9A8 = 0;
972 LOBYTE(pItem2->uAttributes) &= 0xFu;
973 ptr_50C9A4 = 0;
974 }
975 v19 = (double)GetTickCount() * 0.1;
976 pRenderer->_4A63E6(uCellX, uCellY, v7, pTexture, (signed __int64)v19, 0, 255);
977 ZBuffer_Fill(&v23[v17], uTextureId, v24 + 1);
978 pPlayer = pPlayer2;
979 }
980 }
981 //LABEL_34:
982 ++uCellID;
983 v26 += 4;
984 }
985 while ( uCellID < 126 );
986 }
987
988 //----- (0041A556) --------------------------------------------------------
989 void __cdecl draw_leather()
990 {
991 pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_Leather));
992 }
993
994 //----- (0041A57E) --------------------------------------------------------
995 void QuickRefDraw()
996 {
997 unsigned int v0; // ebx@1
998 //unsigned int v1; // eax@1
999 Player *pPlayer; // ebp@2
1000 int v3; // eax@6
1001 int v4; // edi@6
1002 unsigned int v5; // eax@7
1003 unsigned int v6; // edi@9
1004 unsigned int v7; // edi@11
1005 signed int v8; // eax@13
1006 unsigned int v9; // eax@13
1007 unsigned int v10; // edi@13
1008 int v11; // eax@15
1009 unsigned int v12; // eax@15
1010 unsigned int v13; // edi@15
1011 int v14; // eax@17
1012 int v15; // ST18_4@17
1013 int v16; // ebx@17
1014 int v17; // eax@17
1015 unsigned int v18; // eax@17
1016 unsigned int v19; // edi@17
1017 int v20; // eax@19
1018 unsigned int v21; // edi@19
1019 char *v22; // eax@21
1020 unsigned int v23; // edi@21
1021 int v24; // eax@23
1022 unsigned int v25; // edi@23
1023 char *v26; // eax@25
1024 unsigned int v27; // edi@25
1025 int v28; // ecx@27
1026 char *v29; // eax@27
1027 signed int v30; // edx@27
1028 unsigned int v31; // edi@31
1029 unsigned int v32; // edi@33
1030 const char *v33; // ST10_4@35
1031 unsigned int v34; // eax@35
1032 unsigned int v35; // edi@35
1033 unsigned __int8 v36; // al@37
1034 char *v37; // eax@38
1035 int v38; // eax@41
1036 signed int v39; // edi@42
1037 char *v40; // eax@45
1038 unsigned int v41; // eax@45
1039 signed int v43; // [sp+10h] [bp-1Ch]@1
1040 unsigned int v44; // [sp+14h] [bp-18h]@2
1041 int v45; // [sp+18h] [bp-14h]@1
1042 unsigned int v46; // [sp+1Ch] [bp-10h]@1
1043 unsigned int v47; // [sp+20h] [bp-Ch]@1
1044 unsigned int v48; // [sp+24h] [bp-8h]@33
1045 //unsigned int v49; // [sp+28h] [bp-4h]@1
1046
1047 v0 = 0;
1048 v47 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
1049 //v49 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0, 0);
1050 v46 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0);
1051 //v1 = pIcons_LOD->LoadTexture("quikref", TEXTURE_16BIT_PALETTE);
1052 pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("quikref", TEXTURE_16BIT_PALETTE));
1053 v43 = 0;
1054 v45 = LOBYTE(pFontArrus->uFontHeight) + 1;
1055 do
1056 {
1057 pPlayer = &pParty->pPlayers[v43];
1058 v44 = 94 * v43 + 89;
1059 if ( v43 == v0 )
1060 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, 0x12u, v0, pGlobalTXT_LocalizationStrings[149], 60, v0);//Name
1061 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 94 * v43 + 89, 0x12u, v47, pPlayer->pName, 84, v0);
1062 if ( v43 == v0 )
1063 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, 0x2Fu, v0, pGlobalTXT_LocalizationStrings[131], 60, v0); //Óðîâ.
1064 v3 = pPlayer->GetActualLevel();
1065 sprintf(pTmpBuf, "%lu", v3);
1066 v4 = pPlayer->GetBaseLevel();
1067 if ( pPlayer->GetActualLevel() <= v4 )
1068 v5 = pPlayer->GetExperienceDisplayColor();
1069 else
1070 v5 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, v0);
1071 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, 0x2Fu, v5, pTmpBuf, 84, v0);
1072 v6 = v45 + 47;
1073 if ( v43 == v0 )
1074 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v45 + 47, v0, pGlobalTXT_LocalizationStrings[41], 60, v0);//Êëàññ
1075 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v6, v0, pClassNames[pPlayer->classType], 84, v0);
1076 v7 = v45 + v6;
1077 if ( v43 == v0 )
1078 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v7, v0, pGlobalTXT_LocalizationStrings[107], 60, v0);//Çäîð.
1079 sprintf(pTmpBuf, "%d", pPlayer->sHealth);
1080 v8 = pPlayer->GetMaxHealth();
1081 v9 = UI_GetHealthManaStringColor(pPlayer->sHealth, v8);
1082 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v7, v9, pTmpBuf, 84, v0);
1083 v10 = v45 + v7;
1084 if ( v43 == v0 )
1085 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v10, v0, pGlobalTXT_LocalizationStrings[209], 60, v0);//Ìàíà
1086 sprintf(pTmpBuf, "%d", pPlayer->sMana);
1087 v11 = pPlayer->GetMaxMana();
1088 v12 = UI_GetHealthManaStringColor(pPlayer->sMana, v11);
1089 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v10, v12, pTmpBuf, 84, v0);
1090 v13 = v45 + v10;
1091 if ( v43 == v0 )
1092 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v13, v0, pGlobalTXT_LocalizationStrings[0], 60, v0);//Êëàññ áðîíè
1093 v14 = pPlayer->GetActualAC();
1094 sprintf(pTmpBuf, "%d", v14);
1095 v15 = v0;
1096 v16 = pPlayer->GetBaseAC();
1097 v17 = pPlayer->GetActualAC();
1098 v18 = UI_GetHealthManaStringColor(v17, v16);
1099 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v13, v18, pTmpBuf, 84, v15);
1100 v0 = 0;
1101 v19 = v45 + v13;
1102 if ( !v43 )
1103 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v19, 0, pGlobalTXT_LocalizationStrings[18], 60, 0);//Àòàêà
1104 v20 = pPlayer->GetActualAttack(0);
1105 sprintf(pTmpBuf, "%+d", v20);
1106 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v19, 0, pTmpBuf, 84, 0);
1107 v21 = v45 + v19;
1108 if ( !v43 )
1109 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v21, 0, pGlobalTXT_LocalizationStrings[66], 60, 0);//Ïîâð.
1110 v22 = pPlayer->GetMeleeDamageString();
1111 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v21, 0, v22, 84, 0);
1112 v23 = v45 + v21;
1113 if ( !v43 )
1114 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v23, 0, pGlobalTXT_LocalizationStrings[203], 60, 0);// Ñòðåëÿòü
1115 v24 = pPlayer->GetRangedAttack();
1116 sprintf(pTmpBuf, "%+d", v24);
1117 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v23, 0, pTmpBuf, 84, 0);
1118 v25 = v45 + v23;
1119 if ( !v43 )
1120 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v25, 0, pGlobalTXT_LocalizationStrings[66], 60, 0);//Ïîâð.
1121 v26 = pPlayer->GetRangedDamageString();
1122 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v25, 0, v26, 84, 0);
1123 v27 = v45 + v25;
1124 if ( !v43 )
1125 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v27, 0, pGlobalTXT_LocalizationStrings[205], 60, 0);//Íàâûêè
1126 v28 = 0;
1127 v29 = (char *)pPlayer->pActiveSkills;
1128 v30 = 36;
1129 do
1130 {
1131 if ( *(short *)v29 )
1132 ++v28;
1133 v29 += 2;
1134 --v30;
1135 }
1136 while ( v30 );
1137 sprintf(pTmpBuf, "%lu", v28);
1138 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v27, 0, pTmpBuf, 84, 0);
1139 v31 = v45 + v27;
1140 if ( !v43 )
1141 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v31, 0, pGlobalTXT_LocalizationStrings[168], 60, 0);//Î÷êè
1142 sprintf(pTmpBuf, "%lu", pPlayer->uSkillPoints);
1143 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v31, pPlayer->uSkillPoints != 0 ? v46 : 0, pTmpBuf, 84, 0);
1144 v32 = v45 + v31;
1145 v48 = pPlayer->GetMajorConditionIdx();
1146 if ( !v43 )
1147 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v32, 0, pGlobalTXT_LocalizationStrings[45], 60, 0);//Ñîñò.
1148 v33 = aCharacterConditionNames[v48];
1149 v34 = GetConditionDrawColor(v48);
1150 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v32, v34, v33, 84, 0);
1151 v35 = v45 + v32;
1152 if ( !v43 )
1153 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v35, 0, pGlobalTXT_LocalizationStrings[170], 60, 0);//Á.Ïðèì.
1154 v36 = pPlayer->uQuickSpell;
1155 if ( v36 )
1156 v37 = pSpellStats->pInfos[v36].pShortName;
1157 else
1158 v37 = pGlobalTXT_LocalizationStrings[153];//Íåò
1159 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v35, 0, v37, 84, 0);
1160 ++v43;
1161 }
1162 while ( v43 < 4 );
1163
1164 v38 = GetPartyReputation();
1165 if ( v38 >= 0 )
1166 {
1167 if ( v38 <= 5 )
1168 v39 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFF, 0xFF, 0xFF);
1169 else
1170 v39 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFF, 0, 0);
1171 }
1172 else
1173 v39 = v46;
1174
1175 v40 = GetReputationString(v38);
1176 sprintf(pTmpBuf, "%s: \f%05d%s\f00000", pGlobalTXT_LocalizationStrings[180], v39, v40);//Reputation
1177 pGUIWindow_CurrentMenu->DrawText(pFontArrus, 22, 323, 0, pTmpBuf, 0, 0, 0);
1178 v41 = pParty->GetPartyFame();
1179 sprintf(pTmpBuf, "\r261%s: %d", pGlobalTXT_LocalizationStrings[84], v41);// Fame Ñëàâà
1180 pGUIWindow_CurrentMenu->DrawText(pFontArrus, 0, 323, 0, pTmpBuf, 0, 0, 0);
1181 }
1182
1183 //----- (0041ABFD) --------------------------------------------------------
1184 void __thiscall CharacterUI_CharacterScreen_Draw(unsigned int uPlayerIdx)
1185 {
1186 unsigned int v1; // edi@1
1187 unsigned int v2; // eax@6
1188 Texture *pTexture; // ecx@6
1189 GUIButton *pButton; // eax@6
1190 unsigned int v5; // eax@7
1191 unsigned int v6; // eax@10
1192 unsigned int v7; // eax@11
1193
1194 v1 = uPlayerIdx;
1195 if ( uPlayerIdx )
1196 {
1197 pRenderer->ClearZBuffer(0, 479);
1198 switch ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] )
1199 {
1200 case WINDOW_CharacterWindow_Stats: // stats
1201 sub_4196A0();
1202 sub_419379();
1203 CharacterUI_StatsTab_Draw(v1);
1204 v7 = pIcons_LOD->LoadTexture("ib-cd1-d", TEXTURE_16BIT_PALETTE);
1205 pTexture = (Texture *)(v7 != -1 ? (int)&pIcons_LOD->pTextures[v7] : 0);
1206 pButton = pCharacterScreen_StatsBtn;
1207 pRenderer->DrawTextureIndexed(pButton->uX, pButton->uY, pTexture);
1208 break;
1209 case WINDOW_CharacterWindow_Skills: // skills
1210 if ( dword_507CC0 != uActiveCharacter )
1211 {
1212 sub_4196A0();
1213 CharacterUI_SkillScreen_Draw();
1214 }
1215 sub_419379();
1216 CharacterUI_SkillsTab_Draw(v1);
1217 v6 = pIcons_LOD->LoadTexture("ib-cd2-d", TEXTURE_16BIT_PALETTE);
1218 pTexture = (Texture *)(v6 != -1 ? (int)&pIcons_LOD->pTextures[v6] : 0);
1219 pButton = pCharacterScreen_SkillsBtn;
1220 pRenderer->DrawTextureIndexed(pButton->uX, pButton->uY, pTexture);
1221 break;
1222 case WINDOW_CharacterWindow_Awards: // awards
1223 sub_4196A0();
1224 sub_419379();
1225 sub_419220();
1226 CharacterUI_AwardsTab_Draw(v1);
1227 v5 = pIcons_LOD->LoadTexture("ib-cd4-d", TEXTURE_16BIT_PALETTE);
1228 pTexture = (Texture *)(v5 != -1 ? (int)&pIcons_LOD->pTextures[v5] : 0);
1229 pButton = pCharacterScreen_AwardsBtn;
1230 pRenderer->DrawTextureIndexed(pButton->uX, pButton->uY, pTexture);
1231 break;
1232 case WINDOW_CharacterWindow_Inventory: // inventory and other
1233 sub_4196A0();
1234 sub_419379();
1235 CharacterUI_InventoryTab_Draw(v1, 0);
1236 v2 = pIcons_LOD->LoadTexture("ib-cd3-d", TEXTURE_16BIT_PALETTE);
1237 pTexture = (Texture *)(v2 != -1 ? (int)&pIcons_LOD->pTextures[v2] : 0);
1238 pButton = pCharacterScreen_InventoryBtn;
1239 pRenderer->DrawTextureIndexed(pButton->uX, pButton->uY, pTexture);
1240 break;
1241 default:
1242 break;
1243 }
1244 if ( bRingsShownInCharScreen )
1245 CharacterUI_DrawPaperdollWithRingOverlay(v1);
1246 else
1247 CharacterUI_DrawPaperdoll(v1);
1248 }
1249 }
1250
1251 //----- (0041AD6E) --------------------------------------------------------
1252 void __cdecl GameUI_DrawRightPanelItems()
1253 {
1254 if (GameUI_RightPanel_BookFlashTimer > pParty->uTimePlayed)
1255 GameUI_RightPanel_BookFlashTimer = 0;
1256
1257 if (pParty->uTimePlayed - GameUI_RightPanel_BookFlashTimer > 128)
1258 {
1259 GameUI_RightPanel_BookFlashTimer = pParty->uTimePlayed;
1260 byte_50697C = byte_50697C == 0;
1261 if ( byte_50697C && pCurrentScreen != SCREEN_REST )
1262 {
1263 if ( bFlashQuestBook )
1264 pRenderer->DrawTextureTransparent(493, 355, pIcons_LOD->GetTexture(uTextureID_ib_td1_A));
1265 if ( bFlashAutonotesBook )
1266 pRenderer->DrawTextureTransparent(527, 353, pIcons_LOD->GetTexture(uTextureID_ib_td2_A));
1267 if ( bFlashHistoryBook )
1268 pRenderer->DrawTextureTransparent(600, 361, pIcons_LOD->GetTexture(uTextureID_ib_td5_A));
1269 }
1270 else
1271 {
1272 pRenderer->DrawTextureRGB(468u, 0, pTexture_RightFrame);
1273 DrawHiredNPCs();
1274 }
1275 }
1276 }
1277
1278 //----- (0041AEBB) --------------------------------------------------------
1279 void __cdecl GameUI_DrawFoodAndGold()
1280 {
1281 int v2; // esi@2
1282
1283 if ( uGameState != GAME_STATE_FINAL_WINDOW )
1284 {
1285 v2 = sub_44100D() != 0 ? 381 : 322;
1286 sprintf(pTmpBuf, "\r087%lu", pParty->uNumFoodRations);
1287 pPrimaryWindow->DrawText(pFontSmallnum, 0, v2, uGameUIFontMain, pTmpBuf, 0, 0, uGameUIFontShadow);
1288 sprintf(pTmpBuf, "\r028%lu", pParty->uNumGold);
1289 pPrimaryWindow->DrawText(pFontSmallnum, 0, v2, uGameUIFontMain, pTmpBuf, 0, 0, uGameUIFontShadow);
1290 }
1291 }
1292
1293 //----- (0041AF52) --------------------------------------------------------
1294 void Actor::DrawHealthBar(Actor *a1, GUIWindow *a2)
1295 {
1296 unsigned int v2; // eax@1
1297 GUIWindow *v3; // edi@1
1298 unsigned int v4; // esi@1
1299 signed int v5; // ebx@4
1300 double v6; // st7@5
1301 unsigned int v7; // eax@6
1302 unsigned int v8; // ebx@10
1303 unsigned int v9; // [sp+14h] [bp-Ch]@4
1304 unsigned int v10; // [sp+1Ch] [bp-4h]@4
1305
1306 v2 = a1->pMonsterInfo.uHP;
1307 v3 = a2;
1308 v4 = 25;
1309 if ( (signed int)v2 > 25 )
1310 {
1311 v4 = 200;
1312 if ( (signed int)v2 < 200 )
1313 v4 = a1->pMonsterInfo.uHP;
1314 }
1315 v5 = a1->sCurrentHP;
1316 v10 = v4;
1317 v9 = uTextureID_mhp_grn;
1318 if ( v5 < (signed int)v2 )
1319 {
1320 v6 = (double)(signed int)v2;
1321 v10 = (signed __int64)((double)(signed int)v4 / (double)(signed int)v2 * (double)a1->sCurrentHP);
1322 if ( v5 <= (signed int)(signed __int64)(0.34 * v6) )
1323 {
1324 v7 = uTextureID_mhp_red;
1325 v9 = v7;
1326 }
1327 else if ( v5 <= (signed int)(signed __int64)(v6 * 0.67) )
1328 {
1329 v7 = uTextureID_mhp_yel;
1330 v9 = v7;
1331 }
1332 }
1333 v8 = a2->uFrameX + (signed int)(a2->uFrameWidth - v4) / 2;
1334 pRenderer->Clip(v8, a2->uFrameY + 32, v8 + v4, a2->uFrameY + 52);
1335 pRenderer->DrawTextureIndexed(
1336 v8,
1337 v3->uFrameY + 32,
1338 (Texture *)(uTextureID_mhp_bd != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_mhp_bd] : 0));
1339 pRenderer->Clip(v8, v3->uFrameY + 32, v8 + v10, v3->uFrameY + 52);
1340 pRenderer->DrawTextureIndexed(
1341 v8,
1342 v3->uFrameY + 34,
1343 (Texture *)(v9 != -1 ? (int)&pIcons_LOD->pTextures[v9] : 0));
1344 pRenderer->ResetClip();
1345 pRenderer->DrawTextureIndexed(
1346 v8 - 5,
1347 v3->uFrameY + 32,
1348 (Texture *)(uTextureID_mhp_capl != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_mhp_capl] : 0));
1349 pRenderer->DrawTextureIndexed(
1350 v8 + v4,
1351 v3->uFrameY + 32,
1352 (Texture *)(uTextureID_mhp_capr != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_mhp_capr] : 0));
1353 }
1354
1355 //----- (0041B0C9) --------------------------------------------------------
1356 void __cdecl GameUI_DrawLifeManaBars()
1357 {
1358 Texture *v0; // ebx@1
1359 Player *v1; // ecx@2
1360 float v2; // ST38_4@3
1361 double v3; // st7@3
1362 signed __int64 v4; // qax@6
1363 Player *v5; // ecx@24
1364 float v6; // ST30_4@25
1365 double v7; // st7@25
1366 bool v8; // ST38_4@27
1367 Texture *v9; // [sp-4h] [bp-30h]@10
1368 Texture *v10; // [sp+Ch] [bp-20h]@1
1369 Player *v11; // [sp+10h] [bp-1Ch]@2
1370 int v12; // [sp+10h] [bp-1Ch]@24
1371 Texture *v13; // [sp+14h] [bp-18h]@1
1372 Texture *v14; // [sp+18h] [bp-14h]@1
1373 float v15; // [sp+1Ch] [bp-10h]@1
1374 signed int v16; // [sp+24h] [bp-8h]@1
1375 signed int v17; // [sp+28h] [bp-4h]@8
1376
1377 v0 = (Texture *)(uTextureID_BarGreen != -1 ? &pIcons_LOD->pTextures[uTextureID_BarGreen] : 0);
1378 v14 = (Texture *)(uTextureID_BarYellow != -1 ? &pIcons_LOD->pTextures[uTextureID_BarYellow] : 0);
1379 v13 = (Texture *)(uTextureID_BarRed != -1 ? &pIcons_LOD->pTextures[uTextureID_BarRed] : 0);
1380 v16 = 0;
1381 v10 = (Texture *)(uTextureID_BarBlue != -1 ? &pIcons_LOD->pTextures[uTextureID_BarBlue] : 0);
1382 v15 = (double)(uTextureID_BarGreen != -1 ? pIcons_LOD->pTextures[uTextureID_BarGreen].uTextureHeight : 26);
1383 do
1384 {
1385 v1 = &pParty->pPlayers[v16];
1386 v11 = v1;
1387 if ( v1->sHealth > 0 )
1388 {
1389 v11 = &pParty->pPlayers[v16];
1390 v2 = (double)v1->sHealth;
1391 v3 = v2 / (double)v1->GetMaxHealth();
1392 if( v3 > 0.5 )
1393 {
1394 if ( v3 > 1.0 )
1395 v3 = 1.0;
1396 v4 = (signed __int64)((1.0 - v3) * v15);
1397 if ( v16 == 2 || v16 == 3 )
1398 v17 = 2;
1399 else
1400 v17 = 0;
1401 pRenderer->Clip(
1402 v17 + pHealthBarPos[v16],
1403 v4 + 402,
1404 v17 + pHealthBarPos[v16] + v0->uTextureWidth,
1405 v0->uTextureHeight + 402);
1406 v9 = v0;
1407 }
1408 else if ( v3 > 0.25 )
1409 {
1410 if ( v16 == 2 || v16 == 3 )
1411 v17 = 2;
1412 else
1413 v17 = 0;
1414 pRenderer->Clip(
1415 v17 + pHealthBarPos[v16],
1416 (unsigned __int64)(signed __int64)((1.0 - v3) * v15) + 402,
1417 v17 + pHealthBarPos[v16] + v14->uTextureWidth,
1418 v14->uTextureHeight + 402);
1419 v9 = v14;
1420 }
1421 else if ( v3 > 0.0 )
1422 {
1423 if ( v16 == 2 || v16 == 3 )
1424 v17 = 2;
1425 else
1426 v17 = 0;
1427 pRenderer->Clip(
1428 v17 + pHealthBarPos[v16],
1429 (unsigned __int64)(signed __int64)((1.0 - v3) * v15) + 402,
1430 v17 + pHealthBarPos[v16] + v13->uTextureWidth,
1431 v13->uTextureHeight + 402);
1432 v9 = v13;
1433 }
1434 if( v3 > 0.0 )
1435 {
1436 pRenderer->DrawTextureIndexed(v17 + pHealthBarPos[v16], 0x192u, v9);
1437 pRenderer->ResetClip();
1438 }
1439 }
1440 v5 = v11;
1441 v12 = v11->sMana;
1442 if ( v12 > 0 )
1443 {
1444 v6 = (double)v12;
1445 v7 = v6 / (double)v5->GetMaxMana();
1446 if ( v7 > 1.0 )
1447 v7 = 1.0;
1448 v8 = v16 == 2;
1449 pRenderer->Clip(
1450 (v16 == 2) + pManaBarPos[v16],
1451 (unsigned __int64)(signed __int64)((1.0 - v7) * v15) + 402,
1452 v8 + pManaBarPos[v16] + v10->uTextureWidth,
1453 v10->uTextureHeight + 402);
1454 pRenderer->DrawTextureIndexed(v8 + pManaBarPos[v16], 0x192u, v10);
1455 pRenderer->ResetClip();
1456 }
1457 ++v16;
1458 }
1459 while ( v16 < 4 );
1460 }
1461
1462 //----- (0041B3B6) --------------------------------------------------------
1463 void __cdecl draw_right_panel()
1464 {
1465 pRenderer->DrawTextureTransparent(
1466 pViewport->uViewportBR_X,
1467 0,
1468 (Texture *)(uTextureID_right_panel != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_right_panel] : 0));
1469 }
1470
1471 //----- (0041B3E2) --------------------------------------------------------
1472 void __cdecl GameUI_DrawRightPanelFrames()
1473 {
1474 pRenderer->DrawTextureRGB(0, 0, pTexture_TopFrame);
1475 pRenderer->DrawTextureRGB(0, 8u, pTexture_LeftFrame);
1476 pRenderer->DrawTextureRGB(468u, 0, pTexture_RightFrame);
1477 pRenderer->DrawTextureRGB(0, 352u, pTexture_BottomFrame);
1478 GameUI_DrawFoodAndGold();
1479 GameUI_DrawRightPanelItems();
1480 }
1481
1482 //----- (0041B438) --------------------------------------------------------
1483 GUIButton *__fastcall GUI_HandleHotkey(unsigned __int8 uHotkey)
1484 {
1485 char v1; // al@1
1486 int v2; // esi@1
1487 char v3; // dl@1
1488 GUIWindow *v4; // ecx@2
1489 GUIButton *result; // eax@2
1490 int v6; // edx@12
1491
1492 v1 = toupper(uHotkey);
1493 v2 = uNumVisibleWindows;
1494 v3 = v1;
1495 if ( uNumVisibleWindows >= 0 )
1496 {
1497 while ( 2 )
1498 {
1499 v4 = &pWindowList[pVisibleWindowsIdxs[v2] - 1];
1500 for ( result = v4->pControlsHead; result; result = result->pNext )
1501 {
1502 if ( result->uHotkey == v3 )
1503 {
1504 v6 = result->uControlParam;
1505 pMessageQueue_50CBD0->AddMessage((UIMessageType)result->uControlID, v6, 0);
1506 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
1507 {
1508 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)result->uControlID;
1509 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v6;
1510 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
1511 ++pMessageQueue_50CBD0->uNumMessages;
1512 }*/
1513 return result;
1514 }
1515 }
1516 if ( v4->uFrameX || v4->uFrameY || !(v4->uFrameWidth == 640 & v4->uFrameHeight == 480) )
1517 {
1518 --v2;
1519 if ( v2 >= 0 )
1520 continue;
1521 }
1522 break;
1523 }
1524 }
1525 return 0;
1526 }
1527 // 5075E0: using guessed type int pVisibleWindowsIdxs[20]; 121 // 5075E0: using guessed type int pVisibleWindowsIdxs[20];
1528 122
1529 //----- (0041B4E1) -------------------------------------------------------- 123
1530 int __fastcall GUI_ReplaceHotkey(unsigned __int8 uOldHotkey, unsigned __int8 uNewHotkey, char bFirstCall)
1531 {
1532 unsigned __int8 v3; // bl@1
1533 int result; // eax@1
1534 int i; // edx@2
1535 GUIButton *j; // ecx@3
1536 int k; // edx@7
1537 GUIButton *l; // ecx@8
1538 unsigned __int8 v9; // [sp+4h] [bp-8h]@1
1539 char v10; // [sp+8h] [bp-4h]@1
1540
1541 v3 = uNewHotkey;
1542 v10 = toupper(uOldHotkey);
1543 result = toupper(v3);
1544 v9 = result;
1545 if ( bFirstCall )
1546 {
1547 for ( i = uNumVisibleWindows; i >= 0; --i )
1548 {
1549 result = 84 * pVisibleWindowsIdxs[i];
1550 //for ( j = *(GUIButton **)((char *)pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_ + result); j; j = j->pNext )
1551 for ( j = pWindowList[pVisibleWindowsIdxs[i] - 1].pControlsHead; j; j = j->pNext )
1552 j->field_28 = 0;
1553 }
1554 }
1555 for ( k = uNumVisibleWindows; k >= 0; --k )
1556 {
1557 result = 84 * pVisibleWindowsIdxs[k];
1558 //for ( l = *(GUIButton **)((char *)pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_ + result); l; l = l->pNext )
1559 for ( l = pWindowList[pVisibleWindowsIdxs[k] - 1].pControlsHead; l; l = l->pNext )
1560 {
1561 LOBYTE(result) = v10;
1562 if ( l->uHotkey == v10 )
1563 {
1564 if ( !l->field_28 )
1565 {
1566 LOBYTE(result) = v9;
1567 l->field_28 = 1;
1568 l->uHotkey = v9;
1569 }
1570 }
1571 }
1572 }
1573 return result;
1574 }
1575 // 5075E0: using guessed type int pVisibleWindowsIdxs[20];
1576
1577 //----- (0041B578) --------------------------------------------------------
1578 void __cdecl MainMenuUI_LoadFontsAndSomeStuff()
1579 {
1580 pIcons_LOD->SetupPalettes(pRenderer->uTargetRBits,
1581 pRenderer->uTargetGBits,
1582 pRenderer->uTargetBBits);
1583 pPaletteManager->SetColorChannelInfo(pRenderer->uTargetRBits,
1584 pRenderer->uTargetGBits,
1585 pRenderer->uTargetBBits);
1586 pPaletteManager->RecalculateAll();
1587
1588 for (uint i = 0; i < 480; ++i)
1589 pSRZBufferLineOffsets[i] = 640 * i;
1590
1591 pRenderer->ResetClip();
1592
1593 uTextureID_FONTPAL = pIcons_LOD->LoadTexture("FONTPAL", TEXTURE_16BIT_PALETTE);
1594 pFontArrus = LoadFont("arrus.fnt", "FONTPAL", NULL);
1595 pFontLucida = LoadFont("lucida.fnt", "FONTPAL", NULL);
1596 pFontCreate = LoadFont("create.fnt", "FONTPAL", NULL);
1597 pFontSmallnum = LoadFont("smallnum.fnt", "FONTPAL", NULL);
1598 pFontComic = LoadFont("comic.fnt", "FONTPAL", NULL);
1599 pFontArrus->field_3 = 0;
1600 pFontLucida->field_3 = 0;
1601 pFontCreate->field_3 = 0;
1602
1603 for (uint i = 0; i < 20; ++i)
1604 pWindowList[i].eWindowType = WINDOW_null;
1605
1606 uNumVisibleWindows = -1;
1607 memset(pVisibleWindowsIdxs, 0, sizeof(pVisibleWindowsIdxs));
1608 }
1609
1610 //----- (0041B690) --------------------------------------------------------
1611 void __cdecl MainMenuUI_Create()
1612 {
1613 //unsigned int v0; // eax@1
1614 //unsigned int v1; // eax@1
1615 //unsigned int v2; // eax@1
1616 //unsigned int v3; // eax@1
1617 //unsigned int v4; // eax@1
1618 //unsigned int v5; // eax@1
1619 Texture *v6; // ST78_4@1
1620 //const char *v7; // ST5C_4@1
1621 unsigned __int8 v8; // al@1
1622 //Texture *v9; // ST60_4@1
1623 Texture *v10; // ST78_4@1
1624 //const char *v11; // ST5C_4@1
1625 unsigned __int8 v12; // al@1
1626 //Texture *v13; // ST60_4@1
1627 unsigned int v14; // eax@1
1628 Texture *v15; // ST78_4@1
1629 //const char *v16; // ST5C_4@1
1630 unsigned __int8 v17; // al@1
1631 //Texture *v18; // ST60_4@1
1632 unsigned int uTextureID_ib_td4_A; // eax@1
1633 Texture *v20; // ST78_4@1
1634 unsigned __int8 v22; // al@1
1635 //Texture *v23; // ST60_4@1
1636 Texture *v24; // eax@1
1637 //Texture *v25; // esi@1
1638 //Texture *v26; // ST60_4@1
1639 //const char *v27; // ST5C_4@1
1640 unsigned __int8 v28; // al@1
1641 Texture *v29; // eax@1
1642 //Texture *v30; // esi@1
1643 //Texture *v31; // ST60_4@1
1644 //const char *v32; // ST5C_4@1
1645 unsigned __int8 v33; // al@1
1646
1647 pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("wizeyeC"));
1648 pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("wizeyeB"));
1649 pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("wizeyeA"));
1650 pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("torchC"));
1651 pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("torchB"));
1652 pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("torchA"));
1653
1654 pTextureIDs_pMapDirs[0] = pIcons_LOD->LoadTexture("MAPDIR8", TEXTURE_16BIT_PALETTE);
1655 pTextureIDs_pMapDirs[1] = pIcons_LOD->LoadTexture("MAPDIR1", TEXTURE_16BIT_PALETTE);
1656 pTextureIDs_pMapDirs[2] = pIcons_LOD->LoadTexture("MAPDIR2", TEXTURE_16BIT_PALETTE);
1657 pTextureIDs_pMapDirs[3] = pIcons_LOD->LoadTexture("MAPDIR3", TEXTURE_16BIT_PALETTE);
1658 pTextureIDs_pMapDirs[4] = pIcons_LOD->LoadTexture("MAPDIR4", TEXTURE_16BIT_PALETTE);
1659 pTextureIDs_pMapDirs[5] = pIcons_LOD->LoadTexture("MAPDIR5", TEXTURE_16BIT_PALETTE);
1660 pTextureIDs_pMapDirs[6] = pIcons_LOD->LoadTexture("MAPDIR6", TEXTURE_16BIT_PALETTE);
1661 pTextureIDs_pMapDirs[7] = pIcons_LOD->LoadTexture("MAPDIR7", TEXTURE_16BIT_PALETTE);
1662
1663 uTextureID_BarBlue = pIcons_LOD->LoadTexture("ib-statB", TEXTURE_16BIT_PALETTE);
1664 uTextureID_BarGreen = pIcons_LOD->LoadTexture("ib-statG", TEXTURE_16BIT_PALETTE);
1665 uTextureID_BarYellow = pIcons_LOD->LoadTexture("ib-statY", TEXTURE_16BIT_PALETTE);
1666 uTextureID_BarRed = pIcons_LOD->LoadTexture("ib-statR", TEXTURE_16BIT_PALETTE);
1667 uTextureID_mhp_bd = pIcons_LOD->LoadTexture("mhp_bg", TEXTURE_16BIT_PALETTE);
1668 uTextureID_mhp_capl = pIcons_LOD->LoadTexture("mhp_capl", TEXTURE_16BIT_PALETTE);
1669 uTextureID_mhp_capr = pIcons_LOD->LoadTexture("mhp_capr", TEXTURE_16BIT_PALETTE);
1670 uTextureID_mhp_grn = pIcons_LOD->LoadTexture("mhp_grn", TEXTURE_16BIT_PALETTE);
1671 uTextureID_mhp_red = pIcons_LOD->LoadTexture("mhp_red", TEXTURE_16BIT_PALETTE);
1672 uTextureID_mhp_yel = pIcons_LOD->LoadTexture("mhp_yel", TEXTURE_16BIT_PALETTE);
1673 uTextureID_Leather = pIcons_LOD->LoadTexture("LEATHER", TEXTURE_16BIT_PALETTE);
1674 pTexture_Leather = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("ibground", TEXTURE_16BIT_PALETTE)];
1675 uTextureID_x_x_u = pIcons_LOD->LoadTexture("x_x_u", TEXTURE_16BIT_PALETTE);
1676 uTextureID_BUTTDESC2 = pIcons_LOD->LoadTexture("BUTTESC2", TEXTURE_16BIT_PALETTE);
1677 uTextureID_x_ok_u = pIcons_LOD->LoadTexture("x_ok_u", TEXTURE_16BIT_PALETTE);
1678 uTextureID_BUTTYES2 = pIcons_LOD->LoadTexture("BUTTYES2", TEXTURE_16BIT_PALETTE);
1679 uTextureID_BUTTMAKE = pIcons_LOD->LoadTexture("BUTTMAKE", TEXTURE_16BIT_PALETTE);
1680 uTextureID_BUTTMAKE2 = pIcons_LOD->LoadTexture("BUTTMAKE2", TEXTURE_16BIT_PALETTE);
1681
1682 pPrimaryWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0);
1683 pPrimaryWindow->CreateButton(7u, 8u, 0x1CCu, 0x157u, 1, 0, 0xAu, 0, 0, "", 0);
1684 pPrimaryWindow->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 1u, 0x31u, "", 0);
1685 pPrimaryWindow->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 2u, 0x32u, "", 0);
1686 pPrimaryWindow->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 3u, 0x33u, "", 0);
1687 pPrimaryWindow->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 4u, 0x34u, "", 0);
1688 pPrimaryWindow->CreateButton(0x18u, 0x194u, 5u, 0x31u, 1, 93, 0, 1u, 0, "", 0);
1689 pPrimaryWindow->CreateButton(0x8Bu, 0x194u, 5u, 0x31u, 1, 93, 0, 2u, 0, "", 0);
1690 pPrimaryWindow->CreateButton(0xFFu, 0x194u, 5u, 0x31u, 1, 93, 0, 3u, 0, "", 0);
1691 pPrimaryWindow->CreateButton(0x172u, 0x194u, 5u, 0x31u, 1, 93, 0, 4u, 0, "", 0);
1692 pPrimaryWindow->CreateButton(0x61u, 0x194u, 5u, 0x31u, 1, 93, 0, 1u, 0, "", 0);
1693 pPrimaryWindow->CreateButton(0xD4u, 0x194u, 5u, 0x31u, 1, 93, 0, 2u, 0, "", 0);
1694 pPrimaryWindow->CreateButton(0x148u, 0x194u, 5u, 0x31u, 1, 93, 0, 3u, 0, "", 0);
1695 pPrimaryWindow->CreateButton(0x1BBu, 0x194u, 5u, 0x31u, 1, 93, 0, 4u, 0, "", 0);
1696
1697 uTextureID_ib_td1_A = pIcons_LOD->LoadTexture("ib-td1-A", TEXTURE_16BIT_PALETTE);
1698 v6 = (Texture *)(uTextureID_ib_td1_A != -1 ? &pIcons_LOD->pTextures[uTextureID_ib_td1_A] : 0);
1699 v8 = pKeyActionMap->GetActionVKey(INPUT_Quest);
1700 pBtn_Quests = pPrimaryWindow->CreateButton(0x1EBu, 0x161u, v6->uTextureWidth, v6->uTextureHeight, 1, 0, 0xC8u, 0, v8, pGlobalTXT_LocalizationStrings[174], v6, 0); //Quests
1701
1702 uTextureID_ib_td2_A = pIcons_LOD->LoadTexture("ib-td2-A", TEXTURE_16BIT_PALETTE);
1703 v10 = (Texture *)(uTextureID_ib_td2_A != -1 ? &pIcons_LOD->pTextures[uTextureID_ib_td2_A] : 0);
1704 v12 = pKeyActionMap->GetActionVKey(INPUT_Autonotes);
1705 pBtn_Autonotes = pPrimaryWindow->CreateButton(0x20Fu, 0x161u, v10->uTextureWidth, v10->uTextureHeight, 1, 0, 0xC9u, 0, v12, pGlobalTXT_LocalizationStrings[154], v10, 0);//Autonotes
1706
1707 v14 = pIcons_LOD->LoadTexture("ib-td3-A", TEXTURE_16BIT_PALETTE);
1708 v15 = (Texture *)(v14 != -1 ? &pIcons_LOD->pTextures[v14] : 0);
1709 v17 = pKeyActionMap->GetActionVKey(INPUT_Mapbook);
1710 pBtn_Maps = pPrimaryWindow->CreateButton(0x222u, 0x161u, v15->uTextureWidth, v15->uTextureHeight, 1, 0, 0xCAu, 0, v17, pGlobalTXT_LocalizationStrings[139], v15, 0); //Maps
1711
1712 uTextureID_ib_td4_A = pIcons_LOD->LoadTexture("ib-td4-A", TEXTURE_16BIT_PALETTE);
1713 v20 = (Texture *)(uTextureID_ib_td4_A != -1 ? &pIcons_LOD->pTextures[uTextureID_ib_td4_A] : 0);
1714 v22 = pKeyActionMap->GetActionVKey(INPUT_TimeCal);
1715 pBtn_Calendar = pPrimaryWindow->CreateButton(0x23Au, 0x161u, v20->uTextureWidth, v20->uTextureHeight, 1, 0, 0xCBu, 0, v22,
1716 pGlobalTXT_LocalizationStrings[78],//Calendar
1717 v20, 0);
1718
1719 uTextureID_ib_td5_A = pIcons_LOD->LoadTexture("ib-td5-A", TEXTURE_16BIT_PALETTE);
1720 pBtn_History = pPrimaryWindow->CreateButton(0x258u, 0x169u,
1721 (uTextureID_ib_td5_A != -1 ? pIcons_LOD->pTextures[uTextureID_ib_td5_A].uTextureWidth : 24),
1722 (uTextureID_ib_td5_A != -1 ? pIcons_LOD->pTextures[uTextureID_ib_td5_A].uTextureHeight : 26),
1723 1, 0, 0xE0u, 0, 0x48u, pGlobalTXT_LocalizationStrings[602],//History
1724 (Texture *)(uTextureID_ib_td5_A != -1 ? &pIcons_LOD->pTextures[uTextureID_ib_td5_A] : 0), 0);
1725
1726 bFlashAutonotesBook = 0;
1727 bFlashQuestBook = 0;
1728 bFlashHistoryBook = 0;
1729
1730 v24 = &pIcons_LOD->pTextures[uTextureID_Btn_ZoomIn];
1731 v28 = pKeyActionMap->GetActionVKey(INPUT_ZoomIn);
1732 pBtn_ZoomIn = pPrimaryWindow->CreateButton(574, 136, v24->uTextureWidth, v24->uTextureHeight, 2, 0, 0x170u, 0, v28, pGlobalTXT_LocalizationStrings[252], // Zoom In
1733 v24, 0);
1734 v29 = &pIcons_LOD->pTextures[uTextureID_Btn_ZoomOut];
1735 v33 = pKeyActionMap->GetActionVKey(INPUT_ZoomOut);
1736 pBtn_ZoomOut = pPrimaryWindow->CreateButton(519, 136, v29->uTextureWidth, v29->uTextureHeight, 2, 0, 0x16Fu, 0, v33, pGlobalTXT_LocalizationStrings[251], // Zoom Out
1737 v29, 0);
1738 pPrimaryWindow->CreateButton(0x1E1u, 0, 0x99u, 0x43u, 1, 92, 0, 0, 0, "", 0);
1739 pPrimaryWindow->CreateButton(0x1EBu, 0x95u, 0x40u, 0x4Au, 1, 0, 0x86u, 0, 0x35u, "", 0);
1740 pPrimaryWindow->CreateButton(0x231u, 0x95u, 0x40u, 0x4Au, 1, 0, 0x87u, 0, 0x36u, "", 0);
1741 pPrimaryWindow->CreateButton(0x1DCu, 0x142u, 0x4Du, 0x11u, 1, 100, 0, 0, 0, "", 0);
1742 pPrimaryWindow->CreateButton(0x22Bu, 0x142u, 0x4Du, 0x11u, 1, 101, 0, 0, 0, "", 0);
1743 pBtn_CastSpell = pPrimaryWindow->CreateButton(0x1DCu, 0x1C2u,
1744 (uTextureID_Btn_CastSpell != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_CastSpell].uTextureWidth : 24),
1745 (uTextureID_Btn_CastSpell != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_CastSpell].uTextureHeight : 26),
1746 1, 0, 0x69u, 0, 0x43u, pGlobalTXT_LocalizationStrings[38],
1747 (Texture *)(uTextureID_Btn_CastSpell != -1 ? &pIcons_LOD->pTextures[uTextureID_Btn_CastSpell] : 0),
1748 0);
1749 pBtn_Rest = pPrimaryWindow->CreateButton(0x206u, 0x1C2u,
1750 (uTextureID_Btn_Rest != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_Rest].uTextureWidth : 24),
1751 (uTextureID_Btn_Rest != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_Rest].uTextureHeight : 26),
1752 1, 0, 0x68u, 0, 0x52u, pGlobalTXT_LocalizationStrings[182],
1753 (Texture *)(uTextureID_Btn_Rest != -1 ? &pIcons_LOD->pTextures[uTextureID_Btn_Rest] : 0), 0);
1754 pBtn_QuickReference = pPrimaryWindow->CreateButton(0x230u, 0x1C2u,
1755 (uTextureID_Btn_QuickReference != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_QuickReference].uTextureWidth : 24),
1756 (uTextureID_Btn_QuickReference != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_QuickReference].uTextureHeight : 26),
1757 1, 0, 0x6Au, 0, 0x5Au, pGlobalTXT_LocalizationStrings[173],
1758 (Texture *)(uTextureID_Btn_QuickReference != -1 ? &pIcons_LOD->pTextures[uTextureID_Btn_QuickReference] : 0), 0);
1759 pBtn_GameSettings = pPrimaryWindow->CreateButton(0x25Au, 0x1C2u,
1760 (uTextureID_Btn_GameSettings != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_GameSettings].uTextureWidth : 24),
1761 (uTextureID_Btn_GameSettings != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_GameSettings].uTextureHeight : 26),
1762 1, 0, 0x6Bu, 0, 0, pGlobalTXT_LocalizationStrings[93],
1763 (Texture *)(uTextureID_Btn_GameSettings != -1 ? &pIcons_LOD->pTextures[uTextureID_Btn_GameSettings] : 0), 0);
1764 pBtn_NPCLeft = pPrimaryWindow->CreateButton(0x1D5u, 0xB2u,
1765 (uTextureID_Btn_NPCLeft != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft].uTextureWidth : 24),
1766 (uTextureID_Btn_NPCLeft != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft].uTextureHeight : 26),
1767 1, 0, 0xBCu, 0, 0, "",
1768 (Texture *)(uTextureID_Btn_NPCLeft != -1 ? &pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft] : 0), 0);
1769 pBtn_NPCRight = pPrimaryWindow->CreateButton(0x272u, 0xB2u,
1770 (uTextureID_Btn_NPCRight != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_NPCRight].uTextureWidth : 24),
1771 (uTextureID_Btn_NPCRight != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_NPCRight].uTextureHeight : 26),
1772 1, 0, 0xBCu, 1u, 0, "",
1773 (Texture *)(uTextureID_Btn_NPCRight != -1 ? &pIcons_LOD->pTextures[uTextureID_Btn_NPCRight] : 0), 0);
1774 LoadPartyBuffIcons();
1775 }
1776
1777
1778 //----- (0041C047) --------------------------------------------------------
1779 void __cdecl GameUI_DrawStatusBar_2()
1780 {
1781 unsigned int v0; // eax@1
1782 char *v1; // edx@2
1783 unsigned int v2; // ST18_4@5
1784 const char *v3; // ST0C_4@5
1785 unsigned int v4; // ST08_4@5
1786 int v5; // eax@5
1787
1788 pRenderer->DrawTextureRGB(0, 352u, pTexture_StatusBar);
1789 if ( GameUI_StatusBar_TimedStringTimeLeft )
1790 {
1791 v1 = GameUI_StatusBar_TimedString;
1792 }
1793 else
1794 {
1795 if ( !pStatusBarString[0] )
1796 return;
1797 v1 = pStatusBarString;
1798 }
1799 LOWORD(v0) = uGameUIFontShadow;
1800 v2 = v0;
1801 LOWORD(v0) = uGameUIFontMain;
1802 v3 = v1;
1803 v4 = v0;
1804 v5 = pFontLucida->AlignText_Center(0x1C2u, v1);
1805 pPrimaryWindow->DrawText(pFontLucida, v5 + 11, 357, v4, v3, 0, 0, v2);
1806 }
1807
1808 //----- (0041C0B8) --------------------------------------------------------
1809 void __thiscall sub_41C0B8_set_status_string(const char *pStr)
1810 {
1811 const char *v1; // esi@1
1812 int i; // eax@7
1813 int j; // eax@11
1814
1815 v1 = pStr;
1816 if ( pStr && strcmp(pStr, "test") && !IsBadStringPtrA(v1, 1u) && (*v1 || GameUI_StatusBar_TimedStringTimeLeft) )
1817 {
1818 if ( GameUI_StatusBar_TimedStringTimeLeft )
1819 {
1820 for ( i = pFontLucida->GetLineWidth(GameUI_StatusBar_TimedString);
1821 i > 450;
1822 i = pFontLucida->GetLineWidth(GameUI_StatusBar_TimedString) )
1823 byte_5C3427[strlen(GameUI_StatusBar_TimedString)] = 0;
1824 }
1825 else
1826 {
1827 strcpy(pStatusBarString, v1);
1828 for ( j = pFontLucida->GetLineWidth(pStatusBarString);
1829 j > 450;
1830 j = pFontLucida->GetLineWidth(pStatusBarString) )
1831 GameUI_StatusBar_TimedString[strlen(pStatusBarString) + 199] = 0;
1832 }
1833 }
1834 }
1835
1836 //----- (0041C179) --------------------------------------------------------
1837 void __cdecl GameUI_DrawStatusBar()
1838 {
1839 unsigned int v0; // ebp@1
1840 char *v1; // edi@5
1841 int v2; // eax@5
1842 unsigned int v3; // esi@5
1843 size_t v4; // eax@6
1844 GUIFont *v5; // ecx@6
1845 int v6; // eax@9
1846 size_t v7; // eax@10
1847 GUIFont *v8; // ecx@10
1848 char v9; // zf@12
1849 unsigned int v10; // ST08_4@13
1850 int v11; // eax@13
1851
1852 v0 = uGameUIFontShadow;
1853 if ( pStatusBarString[0] || GameUI_StatusBar_TimedStringTimeLeft || bForceDrawStatusBar )
1854 {
1855 pRenderer->DrawTextureRGB(0, 352u, pTexture_StatusBar);
1856 if ( GameUI_StatusBar_TimedStringTimeLeft )
1857 {
1858 v1 = GameUI_StatusBar_TimedString;
1859 v2 = pFontLucida->GetLineWidth(GameUI_StatusBar_TimedString);
1860 v3 = 450;
1861 while ( v2 > 450 )
1862 {
1863 v4 = strlen(GameUI_StatusBar_TimedString);
1864 v5 = pFontLucida;
1865 byte_5C3427[v4] = 0;
1866 v2 = pFontLucida->GetLineWidth(GameUI_StatusBar_TimedString);
1867 }
1868 }
1869 else
1870 {
1871 v1 = pStatusBarString;
1872 v6 = pFontLucida->GetLineWidth(pStatusBarString);
1873 v3 = 450;
1874 while ( v6 > 450 )
1875 {
1876 v7 = strlen(pStatusBarString);
1877 v8 = pFontLucida;
1878 GameUI_StatusBar_TimedString[v7 + 199] = 0;
1879 v6 = pFontLucida->GetLineWidth(pStatusBarString);
1880 }
1881 }
1882 v9 = *v1 == 0;
1883 bForceDrawStatusBar = 0;
1884 if ( !v9 )
1885 {
1886 v10 = uGameUIFontMain;
1887 v11 = pFontLucida->AlignText_Center(v3, v1);
1888 pPrimaryWindow->DrawText(pFontLucida, v11 + 11, 357, v10, v1, 0, 0, v0);
1889 }
1890 }
1891 }
1892 // 5C35BC: using guessed type int bForceDrawStatusBar;
1893 124
1894 125
1895 //----- (0041CD4F) -------------------------------------------------------- 126 //----- (0041CD4F) --------------------------------------------------------
1896 bool __thiscall sub_41CD4F(unsigned int _this) 127 bool __thiscall sub_41CD4F(unsigned int _this)
1897 { 128 {
2240 } 471 }
2241 return a1->DrawText(a2, 32, uY, 0, pTmpBuf, 0, 0, 0); 472 return a1->DrawText(a2, 32, uY, 0, pTmpBuf, 0, 0, 0);
2242 } 473 }
2243 474
2244 475
2245 //----- (0041D895) -------------------------------------------------------- 476
2246 void GameUI_DrawItemInfo( struct ItemGen* inspect_item ) 477
2247 { 478
2248 ItemGen *v1; // esi@1 479
2249 unsigned int v2; // eax@3
2250 //char *v3; // edi@5
2251 //unsigned int v4; // eax@5
2252 //unsigned int v5; // esi@5
2253 signed int v6; // eax@5
2254 int v7; // edx@5
2255 //unsigned int v9; // eax@12
2256 char v10; // zf@16
2257 ItemGen *v11; // eax@16
2258 ItemGen *v12; // eax@25
2259 //unsigned int v13; // ecx@32
2260 //unsigned int v14; // eax@32
2261 //Render *v15; // edi@33
2262 const char *v16; // eax@34
2263 int v17; // eax@36
2264 int v18; // esi@37
2265 unsigned __int16 v19; // ax@37
2266 //char v20; // al@40
2267 char v21; // al@44
2268 //char v22; // al@48
2269 //char v23; // al@51
2270 int v24; // eax@52
2271 int v25; // eax@57
2272 int v26; // eax@60
2273 int v27; // eax@67
2274 const char *v28; // edi@69
2275 int v29; // eax@70
2276 char v30; // edi@78
2277 const char *v31; // eax@78
2278 int v32; // ecx@81
2279 unsigned int v33; // eax@81
2280 int v34; // esi@81
2281 const char *v35; // eax@85
2282 const char *v36; // eax@87
2283 unsigned int v37; // eax@109
2284 unsigned int v38; // eax@109
2285 int v39; // eax@113
2286 GUIFont *v40; // edx@113
2287 signed int v41; // [sp-20h] [bp-298h]@113
2288 int v42; // [sp-1Ch] [bp-294h]@113
2289 //char *v43; // [sp-18h] [bp-290h]@46
2290 unsigned int v44; // [sp-18h] [bp-290h]@113
2291 //int v45; // [sp-14h] [bp-28Ch]@46
2292 const char *v46; // [sp-14h] [bp-28Ch]@58
2293 char *v47; // [sp-14h] [bp-28Ch]@110
2294 //char *v48; // [sp-10h] [bp-288h]@46
2295 const char *v49; // [sp-10h] [bp-288h]@56
2296 char *v50; // [sp-10h] [bp-288h]@58
2297 int v51; // [sp-10h] [bp-288h]@110
2298 const char *v52; // [sp-Ch] [bp-284h]@36
2299 //int v53; // [sp-Ch] [bp-284h]@46
2300 char *v54; // [sp-Ch] [bp-284h]@56
2301 int v55; // [sp-Ch] [bp-284h]@58
2302 int v56; // [sp-Ch] [bp-284h]@110
2303 unsigned int v57; // [sp-8h] [bp-280h]@36
2304 //int v58; // [sp-8h] [bp-280h]@46
2305 int v59; // [sp-8h] [bp-280h]@56
2306 int v60; // [sp-8h] [bp-280h]@58
2307 unsigned int v61; // [sp-8h] [bp-280h]@110
2308 char out_text[300]; // [sp+8h] [bp-270h]@40
2309 //char Dest[100]; // [sp+6Ch] [bp-20Ch]@40
2310 //char v64[100]; // [sp+D0h] [bp-1A8h]@40
2311 char v65[120]; // [sp+134h] [bp-144h]@92
2312 char Source[40]; // [sp+1ACh] [bp-CCh]@49
2313 stru351_summoned_item v67;
2314 //int v67; // [sp+1D4h] [bp-A4h]@91
2315 //int v68; // [sp+1D8h] [bp-A0h]@106
2316 //int v69; // [sp+1DCh] [bp-9Ch]@101
2317 //int v70; // [sp+1E0h] [bp-98h]@97
2318 //int v71; // [sp+1E8h] [bp-90h]@93
2319 //int v72; // [sp+1ECh] [bp-8Ch]@91
2320 int var88; // [sp+1F0h] [bp-88h]@1
2321 Texture *v73; // [sp+1F4h] [bp-84h]@5
2322 //unsigned int v75; // [sp+1F8h] [bp-80h]@5
2323 //char *v76; // [sp+1FCh] [bp-7Ch]@5
2324 int v77; // [sp+200h] [bp-78h]@12
2325 int v78; // [sp+204h] [bp-74h]@5
2326 GUIWindow wHintWindow; // [sp+208h] [bp-70h]@2
2327 POINT a2; // [sp+25Ch] [bp-1Ch]@2
2328 int v81; // [sp+264h] [bp-14h]@5
2329 // GUIFont *pFontComic; // [sp+268h] [bp-10h]@1
2330 PlayerSpeech v83; // [sp+26Ch] [bp-Ch]@18
2331 char* v84;
2332 int v85;
2333 char *Str; // [sp+270h] [bp-8h]@65
2334
2335 v1 = inspect_item;
2336 var88 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
2337 if (!inspect_item->uItemID)
2338 return;
2339
2340 wHintWindow.Hint = 0;
2341 wHintWindow.uFrameWidth = 384;
2342 wHintWindow.uFrameHeight = 180;
2343 wHintWindow.uFrameY = 40;
2344 if ( pMouse->GetCursorPos(&a2)->x <= 320 )
2345 v2 = pMouse->GetCursorPos(&a2)->x + 30;
2346 else
2347 v2 = pMouse->GetCursorPos(&a2)->x - wHintWindow.uFrameWidth - 30;
2348 wHintWindow.uFrameX = v2;
2349 auto item_desc = &pItemsTable->pItems[inspect_item->uItemID];
2350 //v3 = (char *)&pItemsTable->pItems[_this->uItemID].pIconName;
2351 //v76 = v3;
2352 //v4 = pIcons_LOD->LoadTexture(pItemsTable->pItems[_this->uItemID].pIconName, TEXTURE_16BIT_PALETTE);
2353 //v5 = v4;
2354 //v4 *= 72;
2355 //v75 = v4;
2356 //v73 = &pIcons_LOD->pTextures[v4];
2357 v73 = pIcons_LOD->LoadTexturePtr(item_desc->pIconName, TEXTURE_16BIT_PALETTE);
2358 v6 = 100 - v73->uTextureWidth;
2359 v7 = v73->uTextureHeight;
2360 v78 = v6;
2361 v81 = 144 - v7;
2362 if ( v6 > 0 )
2363 v78 = v6 >> 1;
2364 if ( v81 <= 0 )
2365 v81 = 0;
2366 else
2367 v81 >>= 1;
2368 if ( !item_desc->uItemID_Rep_St )
2369 inspect_item->SetIdentified();
2370 //v9 = v8->uAttributes;
2371 v77 = 0;
2372 //a2.y = v8->uAttributes & 2;
2373 if (pItemsTable->pItems[inspect_item->uItemID].uEquipType == EQUIP_GOLD)
2374 v77 = inspect_item->uSpecEnchantmentType;
2375 if ( uActiveCharacter )
2376 {
2377 //try to identify
2378 if (!inspect_item->Identified())
2379 {
2380
2381 v11 = inspect_item;
2382 if ( pPlayers[uActiveCharacter]->CanIdentify(inspect_item) == 1 )
2383 inspect_item->SetIdentified();
2384 v83 = SPEECH_9;
2385 if ( !inspect_item->Identified() )
2386 {
2387 ShowStatusBarString(pGlobalTXT_LocalizationStrings[446], 2u);//"Identify Failed"
2388 }
2389 else
2390 {
2391 v83 = SPEECH_8;
2392 if ( inspect_item->GetValue() < 100 * (pPlayers[uActiveCharacter]->uLevel + 5) )
2393 v83 = SPEECH_7;
2394 }
2395 if ( dword_4E455C )
2396 {
2397 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)(int)v83, 0);
2398 dword_4E455C = 0;
2399 }
2400 }
2401 inspect_item->UpdateTempBonus(pParty->uTimePlayed);
2402 if (inspect_item->Broken())
2403 {
2404 if ( pPlayers[uActiveCharacter]->CanRepair(inspect_item) == 1 )
2405 inspect_item->uAttributes = inspect_item->uAttributes & 0xFFFFFFFD | 1;
2406 v83 = SPEECH_11;
2407 if ( !inspect_item->Broken() )
2408 v83 = SPEECH_10;
2409 else
2410 ShowStatusBarString(pGlobalTXT_LocalizationStrings[448], 2u);//"Repair Failed"
2411 if ( dword_4E455C )
2412 {
2413 pPlayers[uActiveCharacter]->PlaySound(v83, 0);
2414 dword_4E455C = 0;
2415 }
2416 }
2417 }
2418 //v13 = _this->uAttributes;
2419 //v14 = _this->Identified();
2420 //a2.y = inspect_item->Identified();
2421 if (inspect_item->Broken())
2422 {
2423 wHintWindow.DrawMessageBox(0);
2424 //v15 = &;
2425 pRenderer->Clip(wHintWindow.uFrameX + 12, wHintWindow.uFrameY + 12,
2426 wHintWindow.uFrameX + wHintWindow.uFrameWidth - 12,
2427 wHintWindow.uFrameY + wHintWindow.uFrameHeight - 12);
2428 wHintWindow.uFrameWidth -= 24;
2429 wHintWindow.uFrameHeight -= 12;
2430 wHintWindow.uFrameZ = wHintWindow.uFrameX + wHintWindow.uFrameWidth - 1;
2431 wHintWindow.uFrameW = wHintWindow.uFrameY + wHintWindow.uFrameHeight - 1;
2432 pRenderer->DrawTransparentRedShade(wHintWindow.uFrameX + v78, v81 + wHintWindow.uFrameY + 30, v73);
2433 if ( inspect_item->Identified())
2434 v16 = inspect_item->GetIdentifiedName();
2435 else
2436 v16 = item_desc->pUnidentifiedName;
2437 wHintWindow.DrawTitleText(pFontArrus, 0, 0xCu, var88, v16, 3u);
2438 v17 = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[32], &wHintWindow, 0, 0); //"Broken Item"
2439 v18 = v17 >> 1;
2440 v19 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0x19u, 0x19u);
2441 wHintWindow.DrawTitleText(pFontArrus, 0x64u, ((signed int)wHintWindow.uFrameHeight >> 1) - v18, v19, pGlobalTXT_LocalizationStrings[32], 3); //"Broken Item"
2442 pRenderer->ResetClip();
2443 if ( !areWeLoadingTexture )
2444 {
2445 v73->Release();
2446 pIcons_LOD->_40F9C5();
2447 }
2448 return;
2449 }
2450 if (!inspect_item->Identified())
2451 {
2452 wHintWindow.DrawMessageBox(0);
2453 pRenderer->Clip(wHintWindow.uFrameX + 12, wHintWindow.uFrameY + 12,
2454 wHintWindow.uFrameX + wHintWindow.uFrameWidth - 12,
2455 wHintWindow.uFrameY + wHintWindow.uFrameHeight - 12);
2456 wHintWindow.uFrameWidth -= 24;
2457 wHintWindow.uFrameHeight -= 12;
2458 wHintWindow.uFrameZ = wHintWindow.uFrameX + wHintWindow.uFrameWidth - 1;
2459 wHintWindow.uFrameW = wHintWindow.uFrameY + wHintWindow.uFrameHeight - 1;
2460 pRenderer->DrawTextureTransparent(wHintWindow.uFrameX + v78, v81 + wHintWindow.uFrameY + 30, v73);
2461 wHintWindow.DrawTitleText(pFontArrus, 0, 0xCu, var88, item_desc->pUnidentifiedName, 3u);
2462 v17 = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[232], &wHintWindow, 0, 0); ///"Not Identified"
2463 v18 = v17 >> 1;
2464 v19 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0x19u, 0x19u);
2465 wHintWindow.DrawTitleText(pFontArrus, 0x64u, ((signed int)wHintWindow.uFrameHeight >> 1) - v18, v19, pGlobalTXT_LocalizationStrings[232], 3);
2466 pRenderer->ResetClip();
2467 if ( !areWeLoadingTexture )
2468 {
2469 v73->Release();
2470 pIcons_LOD->_40F9C5();
2471 }
2472 return;
2473 }
2474
2475 sprintfex(out_text, pGlobalTXT_LocalizationStrings[463], item_desc->pUnidentifiedName); //"Type: %s"
2476 out_text[100] = 0;
2477 out_text[200] = 0;
2478 //v20 = item_desc->uEquipType;
2479 switch (item_desc->uEquipType)
2480 {
2481 case EQUIP_ONE_OR_TWO_HANDS:
2482 case EQUIP_TWO_HANDED:
2483 sprintfex(out_text + 100, "%s: +%d %s: %dd%d", pGlobalTXT_LocalizationStrings[LOCSTR_ATTACK],
2484 (int)item_desc->uDamageMod, pGlobalTXT_LocalizationStrings[53], (int)item_desc->uDamageDice, (int)item_desc->uDamageRoll); //"Damage"
2485 if (item_desc->uDamageMod)
2486 {
2487 char mod[16];
2488 sprintf(mod, "+%d", (int)item_desc->uDamageMod);
2489 strcat(out_text + 100, mod);
2490 }
2491 break;
2492
2493 case EQUIP_BOW:
2494 sprintfex(out_text + 100, "%s: +%d %s: %dd%d", pGlobalTXT_LocalizationStrings[203], //"Shoot"
2495 (int)item_desc->uDamageMod, pGlobalTXT_LocalizationStrings[53], //"Damage"
2496 (int)item_desc->uDamageDice, (int)item_desc->uDamageRoll);
2497 if (item_desc->uDamageMod)
2498 {
2499 char mod[16];
2500 sprintf(mod, "+%d", (int)item_desc->uDamageMod);
2501 strcat(out_text + 100, mod);
2502 }
2503 break;
2504
2505 case EQUIP_ARMOUR:
2506 case EQUIP_SHIELD:
2507 case EQUIP_HELMET:
2508 case EQUIP_BELT:
2509 case EQUIP_CLOAK:
2510 case EQUIP_GAUNTLETS:
2511 case EQUIP_BOOTS:
2512 case EQUIP_RING:
2513 case EQUIP_AMULET:
2514 if (item_desc->uDamageDice) //"Armor"
2515 sprintfex(out_text + 100, "%s: +%d", pGlobalTXT_LocalizationStrings[11], item_desc->uDamageDice + item_desc->uDamageMod);
2516 break;
2517
2518 }
2519
2520 if ( !v77 )
2521 {
2522 if (item_desc->uEquipType ==EQUIP_POTION) //this is CORRECT! do not move to switch!
2523 {
2524 if ( inspect_item->uEnchantmentType )
2525 sprintf(out_text + 200, "%s: %d",pGlobalTXT_LocalizationStrings[449] , inspect_item->uEnchantmentType); //"Power"
2526 }
2527 else if (item_desc->uEquipType == EQUIP_REAGENT)
2528 {
2529 sprintf(out_text + 200, "%s: %d", pGlobalTXT_LocalizationStrings[449], pItemsTable->pItems[inspect_item->uItemID].uDamageDice); //"Power"
2530 }
2531
2532 else if ( inspect_item->uEnchantmentType )
2533 {
2534 sprintf(out_text + 200, "%s: %s +%d", pGlobalTXT_LocalizationStrings[210],
2535 pItemsTable->pEnchantments[inspect_item->uEnchantmentType-1].pBonusStat, inspect_item->_bonus_strength); //"Special"
2536 }
2537 else if ( inspect_item->uSpecEnchantmentType )
2538 {
2539 sprintf(out_text + 200, "%s: %s", pGlobalTXT_LocalizationStrings[210],
2540 pItemsTable->pSpecialEnchantments[inspect_item->uSpecEnchantmentType-1].pBonusStatement, inspect_item->_bonus_strength);
2541 }
2542
2543 else if ( inspect_item->uNumCharges )
2544 {
2545 sprintf(out_text + 200, "%s: %lu", pGlobalTXT_LocalizationStrings[464], inspect_item->uNumCharges); //"Charges"
2546
2547 }
2548 }
2549 wHintWindow.uFrameWidth -= 12;
2550 v85 = 3;
2551 wHintWindow.uFrameZ = wHintWindow.uFrameX + wHintWindow.uFrameWidth - 1;
2552 wHintWindow.uFrameW = wHintWindow.uFrameY + wHintWindow.uFrameHeight - 1;
2553 Str = (char *)(3 * (LOBYTE(pFontArrus->uFontHeight) + 8));
2554 v84 = &out_text[0];
2555 do
2556 {
2557 if ( *v84 )
2558 {
2559 v27 = pFontComic->CalcTextHeight(v84, &wHintWindow, 100, 0);
2560 Str += v27 + 3;
2561 }
2562 v84 += 100;
2563 --v85;
2564 }
2565 while ( v85 );
2566 v28 = item_desc->pDescription;
2567 if ( *v28 )
2568 {
2569 v29 = pFontSmallnum->CalcTextHeight(v28, &wHintWindow, 100, 0);
2570 Str += v29;
2571 }
2572 wHintWindow.uFrameHeight = v73->uTextureHeight + v81 + 54;
2573 if ( (signed int)Str > (signed int)wHintWindow.uFrameHeight )
2574 wHintWindow.uFrameHeight = (unsigned int)Str;
2575 if ( inspect_item->uAttributes & 8 && (inspect_item->uSpecEnchantmentType || inspect_item->uEnchantmentType) )
2576 wHintWindow.uFrameHeight += LOBYTE(pFontComic->uFontHeight);
2577 v85 = 0;
2578 if ( pFontArrus->uFontHeight )
2579 {
2580 wHintWindow.uFrameWidth -= 24;
2581 v30 = pFontArrus->uFontHeight;
2582 v31 = inspect_item->GetIdentifiedName();
2583 if ( pFontArrus->CalcTextHeight(v31, &wHintWindow, 0, 0) / (signed int)v30 )
2584 v85 = v30;
2585 wHintWindow.uFrameWidth += 24;
2586 }
2587 wHintWindow.uFrameWidth += 12;
2588 wHintWindow.uFrameHeight += (unsigned int)v85;
2589 wHintWindow.uFrameW = wHintWindow.uFrameY + wHintWindow.uFrameHeight - 1;
2590 wHintWindow.uFrameZ = wHintWindow.uFrameX + wHintWindow.uFrameWidth - 1;
2591 wHintWindow.DrawMessageBox(0);
2592 //v15 = pRenderer;
2593 pRenderer->Clip(wHintWindow.uFrameX + 12, wHintWindow.uFrameY + 12,
2594 wHintWindow.uFrameX + wHintWindow.uFrameWidth - 12, wHintWindow.uFrameY + wHintWindow.uFrameHeight - 12);
2595 wHintWindow.uFrameWidth -= 12;
2596 v32 = v73->uTextureHeight;
2597 v33 = wHintWindow.uFrameHeight;
2598 wHintWindow.uFrameHeight -= 12;
2599 wHintWindow.uFrameZ = wHintWindow.uFrameX + wHintWindow.uFrameWidth - 1;
2600 wHintWindow.uFrameW = wHintWindow.uFrameY + wHintWindow.uFrameHeight - 1;
2601 pRenderer->DrawTextureTransparent(
2602 wHintWindow.uFrameX + v78,
2603 wHintWindow.uFrameY + (signed int)(v33 - v32) / 2,
2604 v73);
2605
2606 v34 = (int)(v85 + 35);
2607 v85 = 3;
2608 Str = out_text;
2609 do
2610 {
2611 if ( *Str )
2612 {
2613 wHintWindow.DrawText(pFontComic, 100, v34, 0, Str, 0, 0, 0);
2614 v34 += pFontComic->CalcTextHeight(Str, &wHintWindow, 100, 0) + 3;
2615 }
2616 Str += 100;
2617 --v85;
2618 }
2619 while (v85 );
2620 v35 = item_desc->pDescription;
2621 if ( *v35 )
2622 wHintWindow.DrawText(pFontSmallnum, 100, v34, 0, v35, 0, 0, 0);
2623 wHintWindow.uFrameX += 12;
2624 wHintWindow.uFrameWidth -= 24;
2625 v36 = inspect_item->GetIdentifiedName();
2626 wHintWindow.DrawTitleText(pFontArrus, 0, 0xCu, var88, v36, 3u);
2627 wHintWindow.uFrameWidth += 24;
2628 wHintWindow.uFrameX -= 12;
2629 if ( v77 )
2630 {
2631 sprintf(pTmpBuf, "%s: %lu", pGlobalTXT_LocalizationStrings[465], v77);//"Value"
2632 v40 = pFontComic;
2633 v61 = 0;
2634 v56 = 0;
2635 v51 = 0;
2636 v47 = pTmpBuf;
2637 v44 = 0;
2638 v42 = wHintWindow.uFrameHeight - LOBYTE(pFontComic->uFontHeight);
2639 v41 = 100;
2640 }
2641 else
2642 {
2643 if ( (inspect_item->uAttributes & 8) && (inspect_item->uSpecEnchantmentType || inspect_item->uEnchantmentType) )
2644 {
2645 sub_493F79(&v67, inspect_item->uExpireTime - pParty->uTimePlayed);
2646 strcpy(pTmpBuf, "Duration:");
2647 Str = (char *)(v67.field_18_expire_year - game_starting_year);
2648 if (v67.field_18_expire_year != 1168 )
2649 {
2650 sprintf(v65, " %d:yr", v67.field_18_expire_year - game_starting_year);
2651 strcat(pTmpBuf, v65);
2652 }
2653 if ( (((v67.field_14_exprie_month || Str) &&
2654 ((sprintf(v65, " %d:mo", v67.field_14_exprie_month), strcat(pTmpBuf, v65), v67.field_14_exprie_month) || Str)
2655 || v67.field_C_expire_day)
2656 && ((sprintf(v65, " %d:dy", v67.field_C_expire_day), strcat(pTmpBuf, v65), v67.field_14_exprie_month) || Str ||
2657 v67.field_C_expire_day)
2658 || v67.field_8_expire_hour)
2659 && ((sprintf(v65, " %d:hr", v67.field_8_expire_hour), strcat(pTmpBuf, v65), v67.field_14_exprie_month) || Str ||
2660 v67.field_C_expire_day || v67.field_8_expire_hour)
2661 || v67.field_4_expire_minute )
2662 {
2663 sprintf(v65, " %d:mn", v67.field_4_expire_minute);
2664 strcat(pTmpBuf, v65);
2665 }
2666 wHintWindow.DrawText(pFontComic, 100, wHintWindow.uFrameHeight - 2 * LOBYTE(pFontComic->uFontHeight), 0, pTmpBuf, 0, 0, 0);
2667 }
2668 v37 = inspect_item->GetValue();
2669 sprintf(pTmpBuf, "%s: %lu", pGlobalTXT_LocalizationStrings[465], v37);
2670 wHintWindow.DrawText(pFontComic, 100, wHintWindow.uFrameHeight - LOBYTE(pFontComic->uFontHeight), 0, pTmpBuf, 0, 0, 0);
2671 v38 = inspect_item->uAttributes;
2672 if ( BYTE1(v38) & 1 )
2673 {
2674 v61 = 0;
2675 v56 = 0;
2676 v51 = 0;
2677 v47 = pGlobalTXT_LocalizationStrings[187]; //"Stolen"
2678 }
2679 else
2680 {
2681 if ( !(BYTE1(v38) & 2) )
2682 {
2683 pRenderer->ResetClip();
2684 if ( !areWeLoadingTexture )
2685 {
2686 v73->Release();
2687 pIcons_LOD->_40F9C5();
2688 }
2689 return;
2690 }
2691 v61 = 0;
2692 v56 = 0;
2693 v51 = 0;
2694 v47 = pGlobalTXT_LocalizationStrings[651]; //"Hardened"
2695 }
2696 LOWORD(v38) = LOWORD(pRenderer->uTargetRMask);
2697 v44 = v38;
2698 v42 = wHintWindow.uFrameHeight - LOBYTE(pFontComic->uFontHeight);
2699 v39 = pFontComic->GetLineWidth(pTmpBuf);
2700 v40 = pFontComic;
2701 v41 = v39 + 132;
2702 }
2703 wHintWindow.DrawText(v40, v41, v42, v44, v47, v51, v56, v61);
2704 pRenderer->ResetClip();
2705 if ( !areWeLoadingTexture )
2706 {
2707 v73->Release();
2708 pIcons_LOD->_40F9C5();
2709 }
2710 return;
2711 }
2712 // 4E455C: using guessed type int dword_4E455C;
2713 // 506128: using guessed type int areWeLoadingTexture;
2714
2715
2716 //----- (0041E360) --------------------------------------------------------
2717 char *__fastcall MonsterPopup_Draw(unsigned int uActorID, GUIWindow *edx0)
2718 {
2719 unsigned int v2; // esi@1
2720 Actor *v3; // esi@3
2721 int v4; // eax@3
2722 unsigned int v5; // ecx@3
2723 NPCData *v6; // eax@3
2724 unsigned __int16 v7; // cx@3
2725 int v8; // eax@4
2726 unsigned __int16 v9; // dx@4
2727 SpriteFrame *v10; // edi@17
2728 LODSprite *v11; // esi@17
2729 unsigned int v12; // ecx@17
2730 Sprite *v13; // edi@18
2731 int v14; // ecx@18
2732 int v15; // edx@18
2733 int v16; // edx@18
2734 int v17; // eax@18
2735 unsigned int v18; // ecx@19
2736 unsigned int v19; // eax@21
2737 char *v20; // esi@28
2738 int v21; // edx@29
2739 unsigned __int16 *v22; // ecx@29
2740 int v23; // eax@29
2741 int v24; // eax@32
2742 int v25; // esi@32
2743 char *v26; // edx@34
2744 unsigned __int8 v27; // sf@36
2745 unsigned __int8 v28; // of@36
2746 int v29; // esi@40
2747 char *v30; // ecx@40
2748 int v31; // eax@40
2749 int v32; // esi@43
2750 unsigned __int16 v33; // ax@45
2751 int v34; // edx@45
2752 int v35; // eax@45
2753 int v36; // eax@49
2754 char *v37; // eax@52
2755 int v38; // eax@55
2756 unsigned __int16 v39; // ax@59
2757 SpellBuff *v40; // eax@60
2758 int v41; // edi@61
2759 unsigned int v42; // eax@61
2760 int v43; // eax@62
2761 int v44; // eax@63
2762 signed int v45; // edi@65
2763 unsigned __int16 v46; // ax@73
2764 Player *v47; // ecx@77
2765 unsigned int v48; // eax@85
2766 GUIFont *v49; // edi@90
2767 int v50; // edi@90
2768 SpellBuff *v51; // eax@91
2769 char *v52; // ecx@98
2770 char *v53; // ecx@101
2771 char *v54; // ST0C_4@118
2772 unsigned int v55; // eax@118
2773 GUIFont *v56; // edi@124
2774 unsigned __int8 v57; // al@128
2775 int v58; // eax@132
2776 Actor *v59; // ecx@133
2777 unsigned __int8 v60; // dl@138
2778 char *v62; // eax@147
2779 int v63; // eax@152
2780 char *result; // eax@152
2781 int v65; // eax@155
2782 const char *v66; // [sp-10h] [bp-1FCh]@121
2783 const char *v67; // [sp-10h] [bp-1FCh]@125
2784 const char *v68; // [sp-10h] [bp-1FCh]@142
2785 int v69; // [sp-Ch] [bp-1F8h]@121
2786 char *v70; // [sp-Ch] [bp-1F8h]@125
2787 char *v71; // [sp-Ch] [bp-1F8h]@142
2788 char *v72; // [sp-8h] [bp-1F4h]@54
2789 int v73; // [sp-8h] [bp-1F4h]@79
2790 int v74; // [sp-8h] [bp-1F4h]@121
2791 int v75; // [sp-8h] [bp-1F4h]@125
2792 int v76; // [sp-8h] [bp-1F4h]@142
2793 size_t v77; // [sp-4h] [bp-1F0h]@54
2794 unsigned int v78; // [sp-4h] [bp-1F0h]@121
2795 unsigned int v79; // [sp-4h] [bp-1F0h]@125
2796 char *v80; // [sp-4h] [bp-1F0h]@142
2797 char *v81; // [sp-4h] [bp-1F0h]@148
2798 DDBLTFX Dst; // [sp+Ch] [bp-1E0h]@18
2799 DDSURFACEDESC2 pDesc; // [sp+70h] [bp-17Ch]@18
2800 RECT v84; // [sp+ECh] [bp-100h]@26
2801 char *v85[10]; // [sp+FCh] [bp-F0h]@145
2802 char *v95[11]; // [sp+124h] [bp-C8h]@127
2803 RenderBillboardTransform_local0 v106; // [sp+150h] [bp-9Ch]@3
2804 unsigned int v107; // [sp+1A0h] [bp-4Ch]@18
2805 unsigned __int16 *v108; // [sp+1A4h] [bp-48h]@34
2806 unsigned int v109; // [sp+1A8h] [bp-44h]@32
2807 LPVOID v110; // [sp+1ACh] [bp-40h]@28
2808 unsigned int v111; // [sp+1B0h] [bp-3Ch]@29
2809 char **v112; // [sp+1B4h] [bp-38h]@3
2810 IDirectDrawSurface *v222; // [sp+1B8h] [bp-34h]@18
2811 unsigned __int8 v114; // [sp+1BFh] [bp-2Dh]@133
2812 int v115; // [sp+1C0h] [bp-2Ch]@3
2813 unsigned int v116; // [sp+1C4h] [bp-28h]@18
2814 int i; // [sp+1C8h] [bp-24h]@18
2815 Player *a2; // [sp+1CCh] [bp-20h]@28
2816 int v119; // [sp+1D0h] [bp-1Ch]@18
2817 SpellBuff *v120; // [sp+1D4h] [bp-18h]@18
2818 Actor *v121; // [sp+1D8h] [bp-14h]@3
2819 int a5; // [sp+1DCh] [bp-10h]@3
2820 GUIWindow *a1; // [sp+1E0h] [bp-Ch]@1
2821 int v124; // [sp+1E4h] [bp-8h]@18
2822 char *a4; // [sp+1E8h] [bp-4h]@18
2823
2824 a1 = edx0;
2825 v2 = uActorID;
2826
2827 static Actor pMonsterInfoUI_Doll;
2828 /*if ( !(bMonsterInfoUI_bDollInitialized & 1) )
2829 {
2830 bMonsterInfoUI_bDollInitialized |= 1u;
2831 Actor::Actor(&pMonsterInfoUI_Doll);
2832 atexit(nullsub_3);
2833 }*/
2834 v106.uParentBillboardID = -1;
2835 v3 = &pActors[v2];
2836 v121 = v3;
2837 v4 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xFFu, 0x9Bu);
2838 v5 = v3->sNPC_ID;
2839 a5 = v4;
2840 v6 = GetNPCData(v5);
2841 v7 = v3->pMonsterInfo.uID;
2842 v112 = (char **)v6;
2843 v115 = byte_4E2B70[((signed __int16)v7 - 1) / 3] - 40;
2844 if ( v7 == pMonsterInfoUI_Doll.pMonsterInfo.uID )
2845 {
2846 v9 = pMonsterInfoUI_Doll.uCurrentActionLength;
2847 }
2848 else
2849 {
2850 memcpy(&pMonsterInfoUI_Doll, v3, sizeof(pMonsterInfoUI_Doll));
2851 pMonsterInfoUI_Doll.uCurrentActionAnimation = ANIM_Bored;
2852 pMonsterInfoUI_Doll.uCurrentActionTime = 0;
2853 v8 = rand();
2854 v3 = v121;
2855 v9 = v8 % 256 + 128;
2856 pMonsterInfoUI_Doll.uCurrentActionLength = v8 % 256 + 128;
2857 }
2858 if ( (signed int)pMonsterInfoUI_Doll.uCurrentActionTime > (signed __int16)v9 )
2859 {
2860 pMonsterInfoUI_Doll.uCurrentActionTime = 0;
2861 if ( pMonsterInfoUI_Doll.uCurrentActionAnimation == ANIM_Bored || pMonsterInfoUI_Doll.uCurrentActionAnimation == ANIM_AtkMelee)
2862 {
2863 pMonsterInfoUI_Doll.uCurrentActionAnimation = ANIM_Standing;
2864 pMonsterInfoUI_Doll.uCurrentActionLength = rand() % 128 + 128;
2865 }
2866 else
2867 {
2868 rand();
2869 pMonsterInfoUI_Doll.uCurrentActionAnimation = ANIM_Bored;
2870 if ( (pMonsterInfoUI_Doll.pMonsterInfo.uID < 115 || pMonsterInfoUI_Doll.pMonsterInfo.uID > 186)
2871 && (pMonsterInfoUI_Doll.pMonsterInfo.uID < 232 || pMonsterInfoUI_Doll.pMonsterInfo.uID > 249)
2872 && rand() % 30 < 100 )
2873 pMonsterInfoUI_Doll.uCurrentActionAnimation = ANIM_AtkMelee;
2874 pMonsterInfoUI_Doll.uCurrentActionLength = 8 * pSpriteFrameTable->pSpriteSFrames[v3->pSpriteIDs[(signed __int16)pMonsterInfoUI_Doll.uCurrentActionAnimation]].uAnimLength;
2875 }
2876 }
2877 v10 = pSpriteFrameTable->GetFrame( v3->pSpriteIDs[(signed __int16)pMonsterInfoUI_Doll.uCurrentActionAnimation], pMonsterInfoUI_Doll.uCurrentActionTime);
2878 v11 = &pSprites_LOD->pSpriteHeaders[v10->pHwSpriteIDs[0]];//40 * v10->pHwSpriteIDs[0] + 7218180;
2879 v106.pTarget = pRenderer->pTargetSurface;
2880 v106.pTargetZ = pRenderer->pActiveZBuffer;
2881 v106.uTargetPitch = pRenderer->uTargetSurfacePitch;
2882 v12 = a1->uFrameY + 52;
2883 v106.uViewportX = a1->uFrameX + 13;
2884 v106.uViewportY = v12;
2885 v106.uViewportW = v12 + 128;
2886 v106.uViewportZ = v106.uViewportX + 128;
2887 v106.uScreenSpaceX = (signed int)(v106.uViewportX + 128 + v106.uViewportX) / 2;
2888 v106._screenspace_x_scaler_packedfloat = 65536;
2889 v106._screenspace_y_scaler_packedfloat = 65536;
2890 v106.uScreenSpaceY = v115 + v12 + v11->uHeight;
2891 v106.pPalette = PaletteManager::Get_Dark_or_Red_LUT(v10->uPaletteIndex, 0, 1);
2892 v106.sZValue = 0;
2893 v106.uFlags = 0;
2894 pRenderer->Clip_v2(0, 0, 0x27Fu, 0x1DFu);
2895 pRenderer->Line2D(v106.uViewportX - 1, v106.uViewportY - 1, v106.uViewportX + 129, v106.uViewportY - 1, a5);
2896 pRenderer->Line2D( v106.uViewportX + 129, v106.uViewportY - 1, v106.uViewportX + 129, v106.uViewportW + 1, a5);
2897 pRenderer->Line2D(v106.uViewportX + 129, v106.uViewportW + 1, v106.uViewportX - 1, v106.uViewportW + 1, a5);
2898 pRenderer->Line2D(v106.uViewportX - 1, v106.uViewportW + 1, v106.uViewportX - 1, v106.uViewportY - 1, a5);
2899 if ( pRenderer->pRenderD3D )
2900 {
2901 v13 = &pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]];
2902 v106.uScreenSpaceY = v115 + v106.uViewportY + v13->uBufferHeight;
2903 v222 = (IDirectDrawSurface *)v13->pTextureSurface;
2904 memset(&Dst, 0, 0x64u);
2905 Dst.dwSize = 100;
2906 Dst.dwFillColor = 0;
2907 memset(&pDesc, 0, 0x7Cu);
2908 pDesc.dwSize = 124;
2909 v222->GetSurfaceDesc((LPDDSURFACEDESC)&pDesc);
2910 v14 = v13->uBufferHeight;
2911 v120 = (SpellBuff *)v13->uBufferWidth;
2912 v107 = 0;
2913 v15 = v13->uAreaX;
2914 v119 = (signed int)v120 / 2;
2915 i = 0;
2916 a4 = (char *)(v106.uScreenSpaceX + v15 - (signed int)v120 / 2);
2917 v115 = v13->uAreaY;
2918 v16 = v13->uAreaWidth + (signed int)v120 / 2 + v15 - (int)v120;
2919 v124 = v106.uScreenSpaceY + v115 - v14;
2920 v17 = v13->uAreaHeight + v115 - v14;
2921 v116 = v106.uScreenSpaceX + v16;
2922 v119 = v106.uScreenSpaceY + v17;
2923 if ( (signed int)a4 < (signed int)v106.uViewportX )
2924 {
2925 v18 = v106.uViewportX - (int)a4;
2926 a4 = (char *)v106.uViewportX;
2927 v107 = v18;
2928 }
2929 if ( v124 < (signed int)v106.uViewportY )
2930 {
2931 v19 = v106.uViewportY - v124;
2932 v124 = v106.uViewportY;
2933 i = v19;
2934 }
2935 if ( (signed int)v116 > (signed int)v106.uViewportZ )
2936 v116 = v106.uViewportZ;
2937 if ( v119 > (signed int)v106.uViewportW )
2938 v119 = v106.uViewportW;
2939 pRenderer->FillRectFast(v106.uViewportX, v106.uViewportY, v106.uViewportZ - v106.uViewportX, v106.uViewportW - v106.uViewportY,
2940 pRenderer->uTargetBMask | pRenderer->uTargetGMask);
2941 pRenderer->FillRectFast(v106.uViewportX, v106.uViewportY, v106.uViewportZ - v106.uViewportX, v106.uViewportW - v106.uViewportY,
2942 pRenderer->uTargetBMask | pRenderer->uTargetGMask);
2943 v84.left = v106.uViewportX;
2944 v84.top = v106.uViewportY;
2945 v84.right = v106.uViewportZ;
2946 v84.bottom = v106.uViewportW;
2947 ErrD3D(pRenderer->pBackBuffer4->Blt(&v84, 0, 0, 16778240u, &Dst));
2948 if ( pRenderer->uTargetGBits == 5 )
2949 {
2950 memset(&pDesc, 0, 0x7Cu);
2951 pDesc.dwSize = 124;
2952 if ( pRenderer->LockSurface_DDraw4((IDirectDrawSurface4 *)v222, &pDesc, DDLOCK_WAIT))
2953 {
2954 v20 = (char *)v124;
2955 v110 = pDesc.lpSurface;
2956 a2 = (Player *)v124;
2957 if ( v124 < v119 )
2958 {
2959 v111 = 2 * pRenderer->uTargetSurfacePitch;
2960 v21 = (int)a4;
2961 v22 = &pRenderer->pTargetSurface[(int)&a4[v124 * pRenderer->uTargetSurfacePitch]];
2962 v23 = i - v124;
2963 v120 = (SpellBuff *)&pRenderer->pTargetSurface[(int)&a4[v124 * pRenderer->uTargetSurfacePitch]];
2964 v115 = i - v124;
2965 while ( 1 )
2966 {
2967 v124 = v21;
2968 if ( v21 < (signed int)v116 )
2969 {
2970 v24 = (int)&v20[v23];
2971 v25 = v107 - v21;
2972 v109 = v24;
2973 for ( i = v107 - v21; ; v25 = i )
2974 {
2975 v108 = (unsigned __int16 *)((pDesc.lPitch >> 1) * pDesc.dwHeight * v109 / v13->uAreaHeight);
2976 v26 = (char *)v108 + pDesc.dwWidth * (v25 + v124++) / v13->uAreaWidth;
2977 *v22 = *((short *)v110 + (int)v26);
2978 ++v22;
2979 if ( v124 >= (signed int)v116 )
2980 break;
2981 }
2982 v23 = v115;
2983 }
2984 v22 = (unsigned __int16 *)((char *)v120 + v111);
2985 v20 = (char *)&a2->pConditions[0] + 1;
2986 v28 = __OFSUB__((int)&a2->pConditions[0] + 1, v119);
2987 v27 = (signed int)((char *)&a2->pConditions[0] + -v119 + 1) < 0;
2988 a2 = (Player *)((char *)a2 + 1);
2989 v120 = (SpellBuff *)((char *)v120 + v111);
2990 if ( !(v27 ^ v28) )
2991 break;
2992 v21 = (int)a4;
2993 }
2994 }
2995 v222->Unlock(0);
2996 }
2997 }
2998 else
2999 {
3000 memset(&pDesc, 0, 0x7Cu);
3001 pDesc.dwSize = 124;
3002 if ( pRenderer->LockSurface_DDraw4((IDirectDrawSurface4 *)v222, &pDesc, DDLOCK_WAIT) )
3003 {
3004 v108 = (unsigned __int16 *)pDesc.lpSurface;
3005 a2 = (Player *)v124;
3006 if ( v124 < v119 )
3007 {
3008 v109 = 2 * pRenderer->uTargetSurfacePitch;
3009 v29 = (int)a4;
3010 v30 = (char *)&pRenderer->pTargetSurface[(int)&a4[v124 * pRenderer->uTargetSurfacePitch]];
3011 v31 = i - v124;
3012 v120 = (SpellBuff *)&pRenderer->pTargetSurface[(int)&a4[v124 * pRenderer->uTargetSurfacePitch]];
3013 v115 = i - v124;
3014 while ( 1 )
3015 {
3016 v124 = v29;
3017 if ( v29 < (signed int)v116 )
3018 {
3019 v32 = v107 - (int)a4;
3020 v111 = (unsigned int)((char *)a2 + v31);
3021 for ( i = v107 - (int)a4; ; v32 = i )
3022 {
3023 v110 = (LPVOID)((pDesc.lPitch >> 1) * pDesc.dwHeight * v111 / v13->uAreaHeight);
3024 v33 = v108[(int)((char *)v110 + pDesc.dwWidth * (v32 + v124) / v13->uAreaWidth)];
3025 v34 = v33 & 0x1F | 2 * (unsigned __int16)(v108[(int)((char *)v110 + pDesc.dwWidth * (v32 + v124++) / v13->uAreaWidth)] & 0xFFE0);
3026 v35 = v124;
3027 *(short *)v30 = v34;
3028 v30 += 2;
3029 if ( v35 >= (signed int)v116 )
3030 break;
3031 }
3032 v31 = v115;
3033 }
3034 a2 = (Player *)((char *)a2 + 1);
3035 v30 = (char *)v120 + v109;
3036 v120 = (SpellBuff *)((char *)v120 + v109);
3037 if ( (signed int)a2 >= v119 )
3038 break;
3039 v29 = (int)a4;
3040 }
3041 }
3042 v222->Unlock(0);
3043 }
3044 }
3045 }
3046 else
3047 {
3048 pRenderer->FillRectFast(v106.uViewportX, v106.uViewportY, v106.uViewportZ - v106.uViewportX, v106.uViewportW - v106.uViewportY, 0);
3049 v36 = v10->pHwSpriteIDs[0];
3050 if ( v36 >= 0 )
3051 pSprites_LOD->pSpriteHeaders[v36]._4ACC38(&v106, 0);
3052 }
3053 if ( v121->sNPC_ID )
3054 {
3055 v37 = v112[6];
3056 if ( v37 )
3057 {
3058 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[429], *v112, aNPCProfessionNames[(signed int)v37]);
3059 }
3060 else
3061 {
3062 v77 = 2000;
3063 v72 = *v112;
3064 }
3065 }
3066 else
3067 {
3068 v38 = v121->dword_000334_unique_name;
3069 v77 = 2000;
3070 if ( v38 )
3071 v72 = pMonsterStats->pPlaceStrings[v38];
3072 else
3073 v72 = pMonsterStats->pInfos[v121->pMonsterInfo.uID].pName;
3074 }
3075 if(!v121->sNPC_ID || (v121->sNPC_ID && !v37))
3076 strncpy(pTmpBuf, v72, v77);
3077 v39 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
3078 a1->DrawTitleText(pFontComic, 0, 0xCu, v39, pTmpBuf, 3u);
3079 Actor::DrawHealthBar(v121, a1);
3080 v119 = 0;
3081 pMonsterInfoUI_Doll.uCurrentActionTime += pMiscTimer->uTimeElapsed;
3082 v115 = 0;
3083 v116 = 0;
3084 i = 0;
3085 v112 = 0;
3086 if ( !uActiveCharacter )
3087 {
3088 v45 = 1;
3089 }
3090 else
3091 {
3092 LOBYTE(v40) = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID);
3093 v120 = v40;
3094 if ( !v40 )
3095 v45 = 1;
3096 else
3097 {
3098 v41 = (unsigned __int8)v40 & 0x3F;
3099 v42 = SkillToMastery((unsigned __int16)v40) - 1;
3100 if ( !v42 )
3101 {
3102 if ( v41 + 10 >= v121->pMonsterInfo.uLevel )
3103 {
3104 v45 = 1;
3105 v119 = 1;
3106 }
3107 else
3108 v45 = 1;
3109 }
3110 else
3111 {
3112 v43 = v42 - 1;
3113 if ( !v43 )
3114 {
3115 if ( 2 * v41 + 10 >= v121->pMonsterInfo.uLevel )
3116 {
3117 v45 = 1;
3118 v119 = 1;
3119 v116 = 1;
3120 }
3121 else
3122 v45 = 1;
3123 }
3124 else
3125 {
3126 v44 = v43 - 1;
3127 if ( !v44 )
3128 {
3129 if ( 3 * v41 + 10 >= v121->pMonsterInfo.uLevel )
3130 {
3131 v45 = 1;
3132 v119 = 1;
3133 v116 = 1;
3134 i = 1;
3135 }
3136 else
3137 {
3138 v45 = 1;
3139 }
3140 }
3141 else
3142 {
3143 if ( v44 != 1 )
3144 v45 = 1;
3145 else
3146 {
3147 v45 = 1;
3148 v119 = 1;
3149 v116 = 1;
3150 i = 1;
3151 v112 = (char **)1;
3152 }
3153 }
3154 }
3155 }
3156 }
3157 // LABEL_73:
3158 v46 = v121->uAIState;
3159 if ( v46 != 5 && v46 != 4 && !dword_507BF0_is_there_popup_onscreen && v120 )
3160 {
3161 v47 = pPlayers[uActiveCharacter];
3162 if ( v119 | v116 | i | (unsigned int)v112 )
3163 {
3164 if ( v121->pMonsterInfo.uLevel >= v47->uLevel - 5 )
3165 v73 = SPEECH_105;
3166 else
3167 v73 = SPEECH_104;
3168 }
3169 else
3170 {
3171 v73 = SPEECH_106;
3172 }
3173 v47->PlaySound((PlayerSpeech)v73, 0);
3174 }
3175 }
3176 a2 = pParty->pPlayers;
3177 do
3178 {
3179 LOBYTE(v48) = a2->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID);
3180 v111 = v48;
3181 v120 = (SpellBuff *)138;
3182 do
3183 {
3184 if ( (signed int)SkillToMastery(v111) >= 3 )
3185 v115 = v45;
3186 v120 = (SpellBuff *)((char *)v120 - 1);
3187 }
3188 while ( v120 );
3189 ++a2;
3190 }
3191 while ( (signed int)a2 < (signed int)pParty->pHirelings );
3192 v49 = pFontSmallnum;
3193 a2 = (Player *)pFontSmallnum;
3194 a1->DrawText(pFontSmallnum, 12, 196, a5, pGlobalTXT_LocalizationStrings[631], 0, 0, 0);
3195 v50 = LOBYTE(v49->uFontHeight) + 193;
3196 if ( !v115 )
3197 {
3198 v78 = 0;
3199 v74 = 0;
3200 v69 = 0;
3201 v66 = pGlobalTXT_LocalizationStrings[630];
3202 a1->DrawText((GUIFont *)a2, 28, v50, a5, v66, v69, v74, v78);
3203 }
3204 else
3205 {
3206 a4 = 0;
3207 v51 = &v121->pActorBuffs[1];
3208 v222 = 0;
3209 v120 = &v121->pActorBuffs[1];
3210 do
3211 {
3212 if ( (signed __int64)v51->uExpireTime > 0 )
3213 {
3214 switch ( (int)v51 )
3215 {
3216 case 0u:
3217 v124 = 60;
3218 a4 = pGlobalTXT_LocalizationStrings[591];
3219 break;
3220 case 1u:
3221 v124 = 82;
3222 a4 = pGlobalTXT_LocalizationStrings[649];
3223 break;
3224 case 2u:
3225 v124 = 92;
3226 a4 = pGlobalTXT_LocalizationStrings[592];
3227 break;
3228 case 3u:
3229 v124 = 63;
3230 a4 = pGlobalTXT_LocalizationStrings[4];
3231 break;
3232 case 4u:
3233 v52 = pGlobalTXT_LocalizationStrings[220];
3234 a4 = v52;
3235 v124 = 81;
3236 break;
3237 case 5u:
3238 v52 = pGlobalTXT_LocalizationStrings[162];
3239 a4 = v52;
3240 v124 = 81;
3241 break;
3242 case 6u:
3243 v53 = pGlobalTXT_LocalizationStrings[593];
3244 v124 = 35;
3245 a4 = v53;
3246 break;
3247 case 8u:
3248 v53 = pGlobalTXT_LocalizationStrings[608];
3249 v124 = 62;
3250 a4 = v53;
3251 break;
3252 case 7u:
3253 case 9u:
3254 a4 = 0;
3255 v124 = 0;
3256 ++v51;
3257 v222 = (IDirectDrawSurface *)((char *)v222 + 1);
3258 v120 = v51;
3259 __debugbreak(); // fix condition
3260 continue;
3261 case 0xAu:
3262 v124 = 47;
3263 a4 = pGlobalTXT_LocalizationStrings[221];
3264 break;
3265 case 0xBu:
3266 v124 = 66;
3267 a4 = pGlobalTXT_LocalizationStrings[607];
3268 break;
3269 case 0xCu:
3270 v124 = 85;
3271 a4 = pGlobalTXT_LocalizationStrings[610];
3272 break;
3273 case 0xDu:
3274 v124 = 86;
3275 a4 = pGlobalTXT_LocalizationStrings[609];
3276 break;
3277 case 0xEu:
3278 v124 = 17;
3279 a4 = pGlobalTXT_LocalizationStrings[279];
3280 break;
3281 case 0xFu:
3282 v124 = 38;
3283 a4 = pGlobalTXT_LocalizationStrings[442];
3284 break;
3285 case 0x10u:
3286 v124 = 46;
3287 a4 = pGlobalTXT_LocalizationStrings[443];
3288 break;
3289 case 0x11u:
3290 v124 = 51;
3291 a4 = pGlobalTXT_LocalizationStrings[440];
3292 break;
3293 case 0x12u:
3294 v124 = 5;
3295 a4 = pGlobalTXT_LocalizationStrings[441];
3296 break;
3297 case 0x13u:
3298 v124 = 95;
3299 a4 = pGlobalTXT_LocalizationStrings[229];
3300 break;
3301 case 0x14u:
3302 v124 = 73;
3303 a4 = pGlobalTXT_LocalizationStrings[228];
3304 break;
3305 default:
3306 a4 = 0;
3307 break;
3308 }
3309 if ( a4 )
3310 {
3311 v54 = a4;
3312 v55 = GetSpellColor(v124);
3313 a1->DrawText((GUIFont *)a2, 28, v50, v55, v54, 0, 0, 0);
3314 v50 = v50 + BYTE5(a2->pConditions[0]) - 3;
3315 v51 = v120;
3316 }
3317 }
3318
3319 ++v51;
3320 v222 = (IDirectDrawSurface *)((char *)v222 + 1);
3321 v120 = v51;
3322
3323 __debugbreak(); // fix condition
3324 }
3325 //while ( (signed int)((char *)&v222->lpVtbl + 1) < 22 );
3326 while (true);
3327 if ( !a4 )
3328 {
3329 v78 = 0;
3330 v74 = 0;
3331 v69 = 0;
3332 v66 = pGlobalTXT_LocalizationStrings[153];
3333 a1->DrawText((GUIFont *)a2, 28, v50, a5, v66, v69, v74, v78);
3334 }
3335 }
3336 v56 = pFontSmallnum;
3337 a4 = (char *)v106.uViewportY;
3338 if ( v119 )
3339 {
3340 sprintf(pTmpBuf, "%s\f%05u\t100%d\n", pGlobalTXT_LocalizationStrings[108], 0, v121->pMonsterInfo.uHP);
3341 a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0);
3342 a4 = &a4[LOBYTE(v56->uFontHeight) - 3];
3343 v79 = v121->pMonsterInfo.uAC;
3344 v75 = 0;
3345 v70 = pGlobalTXT_LocalizationStrings[12];
3346 v67 = "%s\f%05u\t100%d\n";
3347 }
3348 else
3349 {
3350 sprintf(pTmpBuf, "%s\f%05u\t100%s\n", pGlobalTXT_LocalizationStrings[108], 0, pGlobalTXT_LocalizationStrings[630]);
3351 a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0);
3352 v79 = (unsigned int)pGlobalTXT_LocalizationStrings[630];
3353 v75 = 0;
3354 v70 = pGlobalTXT_LocalizationStrings[12];
3355 a4 = &a4[LOBYTE(v56->uFontHeight) - 3];
3356 v67 = "%s\f%05u\t100%s\n";
3357 }
3358 sprintf(pTmpBuf, v67, v70, v75, v79);
3359 a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0);
3360 a4 = &a4[LOBYTE(v56->uFontHeight) - 6] + LOBYTE(v56->uFontHeight);
3361 v95[0] = pGlobalTXT_LocalizationStrings[87];
3362 v95[1] = pGlobalTXT_LocalizationStrings[6];
3363 v95[2] = pGlobalTXT_LocalizationStrings[240];
3364 v95[3] = pGlobalTXT_LocalizationStrings[70];
3365 v95[4] = pGlobalTXT_LocalizationStrings[624];
3366 v95[5] = pGlobalTXT_LocalizationStrings[138];
3367 v95[6] = pGlobalTXT_LocalizationStrings[214];
3368 v95[7] = pGlobalTXT_LocalizationStrings[142];
3369 v95[8] = pGlobalTXT_LocalizationStrings[29];
3370 v95[9] = pGlobalTXT_LocalizationStrings[133];
3371 v95[10] = pGlobalTXT_LocalizationStrings[54];
3372 if ( v116 )
3373 {
3374 sprintf(pTmpBuf, "%s\f%05u\t080%s\n", pGlobalTXT_LocalizationStrings[18], 0, v95[v121->pMonsterInfo.uAttack1Type]);
3375 a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0);
3376 a4 = &a4[LOBYTE(v56->uFontHeight) - 3];
3377 v57 = v121->pMonsterInfo.uAttack1DamageBonus;
3378 if ( v57 )
3379 sprintf(pTmpBuf, "%s\f%05u\t080%dd%d+%d\n", pGlobalTXT_LocalizationStrings[53],
3380 0, v121->pMonsterInfo.uAttack1DamageDiceRolls, v121->pMonsterInfo.uAttack1DamageDiceSides, v57);
3381 else
3382 sprintf(pTmpBuf, "%s\f%05u\t080%dd%d\n", pGlobalTXT_LocalizationStrings[53],
3383 0, v121->pMonsterInfo.uAttack1DamageDiceRolls, v121->pMonsterInfo.uAttack1DamageDiceSides);
3384 }
3385 else
3386 {
3387 sprintf(pTmpBuf, "%s\f%05u\t080%s\n", pGlobalTXT_LocalizationStrings[18], 0, pGlobalTXT_LocalizationStrings[630]);
3388 a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0);
3389 a4 = &a4[LOBYTE(v56->uFontHeight) - 3];
3390 sprintf(pTmpBuf, "%s\f%05u\t080%s\n", pGlobalTXT_LocalizationStrings[53], 0, pGlobalTXT_LocalizationStrings[630]);
3391 }
3392 a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0);
3393 v58 = LOBYTE(v56->uFontHeight);
3394 a4 = &a4[v58 - 6] + v58;
3395 if ( !i )
3396 {
3397 v80 = pGlobalTXT_LocalizationStrings[630];
3398 v76 = 0;
3399 v71 = pGlobalTXT_LocalizationStrings[628];
3400 v68 = "%s\f%05u\t080%s\n";
3401 sprintf(pTmpBuf, v68, v71, v76, v80);
3402 a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0);
3403 v58 = LOBYTE(v56->uFontHeight);
3404 a4 = &a4[v58 - 3];
3405 }
3406 else
3407 {
3408 v120 = (SpellBuff *)pGlobalTXT_LocalizationStrings[628];
3409 v59 = v121;
3410 v114 = v121->pMonsterInfo.uSpell1ID;
3411 if ( v114 && v121->pMonsterInfo.uSpell2ID )
3412 v120 = (SpellBuff *)pGlobalTXT_LocalizationStrings[629];
3413 if ( v114 )
3414 {
3415 sprintf(pTmpBuf, "%s\f%05u\t060%s\n", v120, 0, pSpellStats->pInfos[v114].pShortName);
3416 a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0);
3417 v58 = LOBYTE(v56->uFontHeight);
3418 a4 = &a4[v58 - 3];
3419 v59 = v121;
3420 }
3421 v60 = v59->pMonsterInfo.uSpell2ID;
3422 if ( v60 )
3423 {
3424 sprintf(pTmpBuf, "\f%05u\t060%s\n", 0, pSpellStats->pInfos[v60].pShortName);
3425 a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0);
3426 v58 = LOBYTE(v56->uFontHeight);
3427 a4 = &a4[v58 - 3];
3428 v59 = v121;
3429 }
3430 if ( !v59->pMonsterInfo.uSpell1ID && !v59->pMonsterInfo.uSpell2ID )
3431 {
3432 v80 = pGlobalTXT_LocalizationStrings[153];
3433 v76 = 0;
3434 v71 = pGlobalTXT_LocalizationStrings[628];
3435 v68 = "%s\f%05u\t060%s\n";
3436 sprintf(pTmpBuf, v68, v71, v76, v80);
3437 a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0);
3438 v58 = LOBYTE(v56->uFontHeight);
3439 a4 = &a4[v58 - 3];
3440 }
3441 }
3442 a4 = &a4[v58 - 3];
3443 a1->DrawText(v56, 150, (int)a4, a5, pGlobalTXT_LocalizationStrings[626], 0, 0, 0);
3444 a4 = &a4[LOBYTE(v56->uFontHeight) - 3];
3445 v85[0] = pGlobalTXT_LocalizationStrings[87];
3446 v85[1] = pGlobalTXT_LocalizationStrings[6];
3447 v85[2] = pGlobalTXT_LocalizationStrings[240];
3448 v85[3] = pGlobalTXT_LocalizationStrings[70];
3449 v85[4] = pGlobalTXT_LocalizationStrings[142];
3450 v85[5] = pGlobalTXT_LocalizationStrings[214];
3451 v85[6] = pGlobalTXT_LocalizationStrings[29];
3452 v85[7] = pGlobalTXT_LocalizationStrings[133];
3453 v85[8] = pGlobalTXT_LocalizationStrings[54];
3454 v85[9] = pGlobalTXT_LocalizationStrings[624];
3455 v95[1] = (char *)v121->pMonsterInfo.uResFire;
3456 v95[2] = (char *)v121->pMonsterInfo.uResAir;
3457 v95[3] = (char *)v121->pMonsterInfo.uResWater;
3458 v95[4] = (char *)v121->pMonsterInfo.uResEarth;
3459 v95[5] = (char *)v121->pMonsterInfo.uResMind;
3460 v95[6] = (char *)v121->pMonsterInfo.uResSpirit;
3461 v95[7] = (char *)v121->pMonsterInfo.uResBody;
3462 v95[8] = (char *)v121->pMonsterInfo.uResLight;
3463 v95[9] = (char *)v121->pMonsterInfo.uResPhysical;
3464 v95[10] = (char *)v121->pMonsterInfo.uResDark;
3465 if ( v112 )
3466 {
3467 v124 = 0;
3468 do
3469 {
3470 v62 = v95[v124+1];
3471 if ( v62 == (char *)200 )
3472 {
3473 v81 = pGlobalTXT_LocalizationStrings[625];
3474 }
3475 else
3476 {
3477 if ( v62 )
3478 v81 = pGlobalTXT_LocalizationStrings[627];
3479 else
3480 v81 = pGlobalTXT_LocalizationStrings[153];
3481 }
3482 sprintf(pTmpBuf, "%s\f%05u\t070%s\n", v85[v124], 0, v81);
3483 a1->DrawText(v56, 170, (int)a4, a5, pTmpBuf, 0, 0, 0);
3484 v63 = LOBYTE(v56->uFontHeight);
3485 v124 += 4;
3486 result = &a4[v63 - 3];
3487 a4 = result;
3488 }
3489 while ( v124 < 40 );
3490 }
3491 else
3492 {
3493 i = 0;
3494 do
3495 {
3496 sprintf(pTmpBuf, "%s\f%05u\t070%s\n", v85[i], 0, pGlobalTXT_LocalizationStrings[630]); // "?"
3497 a1->DrawText(v56, 170, (int)a4, a5, pTmpBuf, 0, 0, 0);
3498 v65 = LOBYTE(v56->uFontHeight);
3499 ++i;
3500 result = &a4[v65 - 3];
3501 a4 = result;
3502 }
3503 while ( i < 10 );
3504 }
3505 if ( (signed __int64)pParty->pPartyBuffs[3].uExpireTime > 0 )
3506 {
3507 sprintf(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[650], v121->sCurrentHP);
3508 pFontSmallnum->GetLineWidth(pTmpBuf);
3509 result = a1->DrawTitleText(pFontSmallnum, 0, a1->uFrameHeight - LOBYTE(pFontSmallnum->uFontHeight) - 12, 0, pTmpBuf, 3);
3510 }
3511 return result;
3512 }
3513 480
3514 //----- (0041F54A) -------------------------------------------------------- 481 //----- (0041F54A) --------------------------------------------------------
3515 void __cdecl LoadActualSkyFrame() 482 void __cdecl LoadActualSkyFrame()
3516 { 483 {
3517 if ( pTexture_RestUI_CurrentSkyFrame ) 484 if ( pTexture_RestUI_CurrentSkyFrame )
3567 LoadActualSkyFrame(); 534 LoadActualSkyFrame();
3568 } 535 }
3569 viewparams->bRedrawGameUI = 1; 536 viewparams->bRedrawGameUI = 1;
3570 } 537 }
3571 538
3572 //----- (0041F6C1) -------------------------------------------------------- 539
3573 void __cdecl RestUI_Initialize()
3574 {
3575 Player *v0; // eax@10
3576
3577 if ( !dword_506F14 )
3578 pAudioPlayer->StopChannels(-1, -1);
3579 if ( pCurrentScreen )
3580 {
3581 pGUIWindow_CurrentMenu->Release();
3582 pCurrentScreen = SCREEN_GAME;
3583 viewparams->bRedrawGameUI = 1;
3584 }
3585 pEventTimer->Pause();
3586 if ( dword_506F14 != 2 )
3587 GUIWindow::Create(518u, 450u, 0, 0, (enum WindowType)90, (int)pBtn_Rest, 0);
3588 _506F18_num_hours_to_sleep = 0;
3589 dword_506F14 = 0;
3590 uRestUI_FoodRequiredToRest = 2;
3591 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
3592 uRestUI_FoodRequiredToRest = pOutdoor->GetNumFoodRequiredToRestInCurrentPos(
3593 pParty->vPosition.x,
3594 pParty->vPosition.y,
3595 pParty->vPosition.z);
3596 if ( PartyHasDragon() )
3597 {
3598 v0 = pParty->pPlayers;//[0].uClass;
3599 while ( v0 <= &pParty->pPlayers[3] )
3600 {
3601 ++v0;
3602 if ( v0 > &pParty->pPlayers[3] )
3603 break;
3604 }
3605 if(v0->classType == PLAYER_CLASS_WARLOCK)
3606 ++uRestUI_FoodRequiredToRest;
3607 }
3608 if ( CheckHiredNPCSpeciality(Porter) )
3609 --uRestUI_FoodRequiredToRest;
3610 if ( CheckHiredNPCSpeciality(QuarterMaster) )
3611 uRestUI_FoodRequiredToRest -= 2;
3612 if ( CheckHiredNPCSpeciality(Gypsy) )
3613 --uRestUI_FoodRequiredToRest;
3614 if ( uRestUI_FoodRequiredToRest < 1 )
3615 uRestUI_FoodRequiredToRest = 1;
3616 if ( !_strcmpi(pCurrentMapName, "d29.blv") && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 98) )
3617 uRestUI_FoodRequiredToRest = 0;
3618 ++pIcons_LOD->uTexturePacksCount;
3619 if ( !pIcons_LOD->uNumPrevLoadedFiles )
3620 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
3621 pCurrentScreen = SCREEN_REST;
3622 _507CD4_RestUI_hourglass_anim_controller = 0;
3623 uTextureID_RestUI_restmain = pIcons_LOD->LoadTexture("restmain", TEXTURE_16BIT_PALETTE);
3624 uTextureID_RestUI_restb1 = pIcons_LOD->LoadTexture("restb1", TEXTURE_16BIT_PALETTE);
3625 uTextureID_RestUI_restb2 = pIcons_LOD->LoadTexture("restb2", TEXTURE_16BIT_PALETTE);
3626 uTextureID_RestUI_restb3 = pIcons_LOD->LoadTexture("restb3", TEXTURE_16BIT_PALETTE);
3627 uTextureID_RestUI_restb4 = pIcons_LOD->LoadTexture("restb4", TEXTURE_16BIT_PALETTE);
3628 uTextureID_RestUI_restexit = pIcons_LOD->LoadTexture("restexit", TEXTURE_16BIT_PALETTE);
3629 LoadActualSkyFrame();
3630 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640u, 480u, (enum WindowType)16, 0, 0);
3631 pButton_RestUI_Exit = pGUIWindow_CurrentMenu->CreateButton(
3632 280u,
3633 297u,
3634 154u,
3635 37u,
3636 1,
3637 0,
3638 0xA7u,
3639 0,
3640 0,
3641 "",
3642 (Texture *)(uTextureID_RestUI_restexit != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_RestUI_restexit] : 0),
3643 0);
3644 pButton_RestUI_Main = pGUIWindow_CurrentMenu->CreateButton(
3645 24u,
3646 154u,
3647 225u,
3648 37u,
3649 1,
3650 0,
3651 0x61u,
3652 0,
3653 0x52u,
3654 "",
3655 (Texture *)(uTextureID_RestUI_restb4 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_RestUI_restb4] : 0),
3656 0);
3657 pButton_RestUI_WaitUntilDawn = pGUIWindow_CurrentMenu->CreateButton(
3658 61u,
3659 232u,
3660 154u,
3661 33u,
3662 1,
3663 0,
3664 0x6Du,
3665 0,
3666 0x44u,
3667 "",
3668 (Texture *)(uTextureID_RestUI_restb1 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_RestUI_restb1] : 0),
3669 0);
3670 pButton_RestUI_Wait1Hour = pGUIWindow_CurrentMenu->CreateButton(
3671 61u,
3672 264u,
3673 154u,
3674 33u,
3675 1,
3676 0,
3677 0x60u,
3678 0,
3679 0x48u,
3680 "",
3681 (Texture *)(uTextureID_RestUI_restb2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_RestUI_restb2] : 0),
3682 0);
3683 pButton_RestUI_Wait5Minutes = pGUIWindow_CurrentMenu->CreateButton(
3684 61u,
3685 296u,
3686 154u,
3687 33u,
3688 1,
3689 0,
3690 0x5Fu,
3691 0,
3692 0x4Du,
3693 "",
3694 (Texture *)(uTextureID_RestUI_restb3 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_RestUI_restb3] : 0),
3695 0);
3696 }
3697
3698 //----- (0041FA01) --------------------------------------------------------
3699 void __cdecl RestUI_Draw()
3700 {
3701 int v0; // esi@1
3702 Player **ppPlayers; // ecx@1
3703 Player *pPlayer; // eax@2
3704 unsigned int v3; // eax@15
3705 //char v4; // al@17
3706 bool v5; // eax@21
3707 GUIButton Dst; // [sp+8h] [bp-DCh]@19
3708 //double v7; // [sp+C4h] [bp-20h]@17
3709 float v8; // [sp+CCh] [bp-18h]@17
3710 __int64 v9; // [sp+D0h] [bp-14h]@17
3711 unsigned int v10; // [sp+D8h] [bp-Ch]@9
3712 __int16 a9[2]; // [sp+DCh] [bp-8h]@1
3713 int a5; // [sp+E0h] [bp-4h]@1
3714
3715 v0 = 0;
3716 a5 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xAu, 0, 0);
3717 *(int *)a9 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE6u, 0xD6u, 0xC1u);
3718 ppPlayers = &pPlayers[1];
3719 do
3720 {
3721 pPlayer = *ppPlayers;
3722 if ( !(*ppPlayers)->pConditions[14] && !pPlayer->pConditions[16] && pPlayer->sHealth > 0 )
3723 ++v0;
3724 ++ppPlayers;
3725 }
3726 while ( (signed int)ppPlayers <= (signed int)&pPlayers[4] );
3727 if ( v0 )
3728 {
3729 pRenderer->DrawTextureIndexed(
3730 8u,
3731 8u,
3732 (Texture *)(uTextureID_RestUI_restmain != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_RestUI_restmain] : 0));
3733 v10 = pParty->uCurrentHour;
3734 dword_506F1C = pGUIWindow_CurrentMenu->pCurrentPosActiveItem;
3735 if ( (signed int)pParty->uCurrentHour <= 12 )
3736 {
3737 if ( !v10 )
3738 v10 = 12;
3739 }
3740 else
3741 {
3742 v10 -= 12;
3743 }
3744 pRenderer->DrawTextureIndexed(16u, 26u, pTexture_RestUI_CurrentSkyFrame);
3745 if ( pTexture_RestUI_CurrentHourglassFrame )
3746 {
3747 pTexture_RestUI_CurrentHourglassFrame->Release();
3748 pIcons_LOD->_40F9C5();
3749 }
3750 v3 = pEventTimer->uTimeElapsed + _507CD4_RestUI_hourglass_anim_controller;
3751 _507CD4_RestUI_hourglass_anim_controller += pEventTimer->uTimeElapsed;
3752 if ( (unsigned int)_507CD4_RestUI_hourglass_anim_controller >= 512 )
3753 {
3754 v3 = 0;
3755 _507CD4_RestUI_hourglass_anim_controller = 0;
3756 }
3757 v9 = v3;
3758 v8 = (double)v3 / 512.0 * 120.0;
3759 //v7 = v8 + 6.7553994e15;
3760 HIDWORD(v9) = floorf(v8 + 0.5f);//LODWORD(v7);
3761 hourglass_icon_idx = (int)floorf(v8 + 0.5f) % 256 + 1;//LOBYTE(v7) + 1;
3762 //hourglass_icon_idx = v4;
3763 if (hourglass_icon_idx >= 120 )
3764 {
3765 //v4 = 1;
3766 hourglass_icon_idx = 1;
3767 }
3768 sprintf(pTmpBuf, "hglas%03d", hourglass_icon_idx);
3769 pTexture_RestUI_CurrentHourglassFrame = pIcons_LOD->LoadTexturePtr(pTmpBuf, TEXTURE_16BIT_PALETTE);
3770 pRenderer->DrawTextureIndexed(0x10Bu, 0x9Fu, pTexture_RestUI_CurrentHourglassFrame);
3771 memset(&Dst, 0, 0xBCu);
3772 Dst.uX = 24;
3773 Dst.uY = 154;
3774 Dst.uWidth = 171;
3775 Dst.uHeight = 37;
3776 Dst.uZ = 194;
3777 Dst.uW = 190;
3778 Dst.pParent = pButton_RestUI_WaitUntilDawn->pParent;
3779 Dst.DrawLabel(pGlobalTXT_LocalizationStrings[183], pFontCreate, a5, *(int **)a9);
3780 Dst.pParent = 0;
3781 sprintf(pTmpBuf, "\r408%d", uRestUI_FoodRequiredToRest);
3782 pGUIWindow_CurrentMenu->DrawText(pFontCreate, 0, 164, a5, pTmpBuf, 0, 0, *(unsigned int *)a9);
3783 pButton_RestUI_WaitUntilDawn->DrawLabel(
3784 pGlobalTXT_LocalizationStrings[237],
3785 pFontCreate,
3786 a5,
3787 *(int **)a9);
3788 pButton_RestUI_Wait1Hour->DrawLabel(pGlobalTXT_LocalizationStrings[239], pFontCreate, a5, *(int **)a9);
3789 pButton_RestUI_Wait5Minutes->DrawLabel(pGlobalTXT_LocalizationStrings[238], pFontCreate, a5, *(int **)a9);
3790 pButton_RestUI_Exit->DrawLabel(pGlobalTXT_LocalizationStrings[81], pFontCreate, a5, *(int **)a9);
3791 memset(&Dst, 0, 0xBCu);
3792 Dst.uX = 45;
3793 Dst.uY = 199;
3794 Dst.uWidth = 185;
3795 Dst.uHeight = 30;
3796 Dst.uZ = 229;
3797 Dst.uW = 228;
3798 Dst.pParent = pButton_RestUI_WaitUntilDawn->pParent;
3799 Dst.DrawLabel(pGlobalTXT_LocalizationStrings[236], pFontCreate, a5, *(int **)a9);
3800 Dst.pParent = 0;
3801 v5 = pParty->uCurrentHour >= 0xC && pParty->uCurrentHour < 0x18;
3802 sprintf(pTmpBuf, "%d:%02d %s", v10, pParty->uCurrentMinute, aAMPMNames[v5]);
3803 pGUIWindow_CurrentMenu->DrawText(pFontCreate, 368, 168, a5, pTmpBuf, 0, 0, *(unsigned int *)a9);
3804 sprintf(pTmpBuf, "%s\r190%d", pGlobalTXT_LocalizationStrings[56], pParty->uDaysPlayed + 1);
3805 pGUIWindow_CurrentMenu->DrawText(pFontCreate, 350, 190, a5, pTmpBuf, 0, 0, *(unsigned int *)a9);
3806 sprintf(pTmpBuf, "%s\r190%d", pGlobalTXT_LocalizationStrings[146], pParty->uCurrentMonth + 1);
3807 pGUIWindow_CurrentMenu->DrawText(pFontCreate, 350, 222, a5, pTmpBuf, 0, 0, *(unsigned int *)a9);
3808 sprintf(pTmpBuf, "%s\r190%d", pGlobalTXT_LocalizationStrings[245], pParty->uCurrentYear);
3809 pGUIWindow_CurrentMenu->DrawText(pFontCreate, 350, 254, a5, pTmpBuf, 0, 0, *(unsigned int *)a9);
3810 if ( dword_506F14 )
3811 Sleep6Hours();
3812 }
3813 else
3814 {
3815 GUIWindow::Create(
3816 pButton_RestUI_Exit->uX,
3817 pButton_RestUI_Exit->uY,
3818 0,
3819 0,
3820 (enum WindowType)96,
3821 (int)pButton_RestUI_Exit,
3822 (int)pGlobalTXT_LocalizationStrings[81]);
3823 }
3824 }
3825 540
3826 541
3827 //----- (0042038D) -------------------------------------------------------- 542 //----- (0042038D) --------------------------------------------------------
3828 void __cdecl sub_42038D() 543 void __cdecl sub_42038D()
3829 { 544 {
4004 pParty->SetHoldingItem(&pChests[chest_id].igChestItems[v4]); 719 pParty->SetHoldingItem(&pChests[chest_id].igChestItems[v4]);
4005 } 720 }
4006 sub_420B13(v4, v3); 721 sub_420B13(v4, v3);
4007 } 722 }
4008 } 723 }
4009 }
4010
4011 //----- (00420EFF) --------------------------------------------------------
4012 void __cdecl GameUI_WritePointedObjectStatusString()
4013 {
4014 int v1; // ebx@6
4015 GUIWindow *pWindow; // edi@7
4016 GUIButton *pButton; // ecx@11
4017 Player *pPlayer; // eax@19
4018 char v5; // cl@19
4019 unsigned int v6; // eax@19
4020 int v7; // ecx@19
4021 __int16 v8; // fps@23
4022 unsigned __int8 v9; // c0@23
4023 unsigned __int8 v10; // c3@23
4024 enum UIMessageType pMessageType1; // esi@24
4025 int v12; // edx@25
4026 char *v13; // ecx@28
4027 int v14; // eax@41
4028 ItemGen *pItemGen; // ecx@44
4029 int v16; // ecx@46
4030 const char *v17; // eax@49
4031 signed int v18; // eax@55
4032 signed int v19; // ecx@63
4033 BLVFace *pFace; // eax@69
4034 __int16 v21; // ax@70
4035 const char *v22; // eax@72
4036 LevelDecoration *v23; // ecx@75
4037 LevelDecoration *v24; // esi@75
4038 __int16 v25; // ax@75
4039 const char *v26; // ecx@79
4040 Actor *pActor; // ecx@82
4041 char *v28; // esi@82
4042 int v29; // eax@82
4043 signed int v30; // ecx@88
4044 const char *v31; // eax@91
4045 __int16 v32; // fps@109
4046 //unsigned __int8 v33; // c0@109
4047 //unsigned __int8 v34; // c3@109
4048 enum UIMessageType pMessageType2; // esi@110
4049 int v36; // edx@111
4050 enum UIMessageType pMessageType3; // edx@117
4051 int v38; // ecx@118
4052 const char *v39; // [sp-8h] [bp-E8h]@20
4053 char *v40; // [sp-8h] [bp-E8h]@83
4054 int v41; // [sp-4h] [bp-E4h]@20
4055 char Str1[200]; // [sp+Ch] [bp-D4h]@129
4056 unsigned int pX; // [sp+D4h] [bp-Ch]@1
4057 unsigned int pY; // [sp+D8h] [bp-8h]@1
4058 unsigned int v45; // [sp+DCh] [bp-4h]@21
4059
4060 v13 = nullptr;
4061
4062 pMouse->uPointingObjectID = 0;
4063 pMouse->GetClickPos(&pX, &pY);
4064 if ( pX < 0 || (signed int)pX > 639 || pY < 0 || (signed int)pY > 479 )//( (pX & 0x80000000u) != 0 || (signed int)pX > 639 || (pY & 0x80000000u) != 0 || (signed int)pY > 479 )
4065 return;
4066 if (pCurrentScreen == SCREEN_GAME)
4067 {
4068 if ( (signed int)pX > 467 || (signed int)pY > 351 )
4069 goto _click_on_game_ui;
4070 if ( pRenderer->pRenderD3D )
4071 {
4072 v18 = pGame->pVisInstance->get_picked_object_zbuf_val();
4073 if ( (signed int)pX < (signed int)pViewport->uScreen_TL_X
4074 || (signed int)pX > (signed int)pViewport->uScreen_BR_X
4075 || (signed int)pY < (signed int)pViewport->uScreen_TL_Y
4076 || (signed int)pY > (signed int)pViewport->uScreen_BR_Y )
4077 v18 = -1;
4078 if ( v18 == -1 )
4079 //goto LABEL_61;
4080 {
4081 pMouse->uPointingObjectID = 0;
4082 if ( pMouse->uPointingObjectID == 0 )
4083 {
4084 if ( uLastPointedObjectID != 0 )
4085 {
4086 pStatusBarString[0] = 0;
4087 bForceDrawStatusBar = 1;
4088 }
4089 }
4090 uLastPointedObjectID = pMouse->uPointingObjectID;
4091 return;
4092 }
4093 }
4094 else
4095 {
4096 v18 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]];
4097 }
4098 pMouse->uPointingObjectID = (unsigned __int16)v18;
4099 v19 = (signed int)(unsigned __int16)v18 >> 3;
4100 if ( (v18 & 7) == OBJECT_Item )
4101 {
4102 v30 = v19;
4103 if ( pObjectList->pObjects[pSpriteObjects[v30].uObjectDescID].uFlags & 0x10 )
4104 //goto LABEL_73;
4105 {
4106 pMouse->uPointingObjectID = 0;
4107 //goto LABEL_50;
4108 uLastPointedObjectID = 1;
4109 if ( pMouse->uPointingObjectID == 0 )
4110 {
4111 if ( uLastPointedObjectID != 0 )
4112 {
4113 pStatusBarString[0] = 0;
4114 bForceDrawStatusBar = 1;
4115 }
4116 }
4117 uLastPointedObjectID = pMouse->uPointingObjectID;
4118 return;
4119 }
4120 if ( v18 >= (signed int)0x2000000u || pParty->pPickedItem.uItemID )
4121 {
4122 v22 = pSpriteObjects[v30].stru_24.GetDisplayName();
4123 //LABEL_93:
4124 v26 = v22;
4125 //goto LABEL_87;
4126 sub_41C0B8_set_status_string(v26);
4127 if ( pMouse->uPointingObjectID == 0 )
4128 {
4129 if ( uLastPointedObjectID != 0 )
4130 {
4131 pStatusBarString[0] = 0;
4132 bForceDrawStatusBar = 1;
4133 }
4134 }
4135 uLastPointedObjectID = pMouse->uPointingObjectID;
4136 return;
4137 }
4138 v31 = pSpriteObjects[v30].stru_24.GetDisplayName();
4139 v28 = pTmpBuf;
4140 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[470], v31);// "Get %s"
4141 }
4142 else
4143 {
4144 if ( (v18 & 7) != OBJECT_Actor )
4145 {
4146 if ( (v18 & 7) == OBJECT_Decoration )
4147 {
4148 v23 = &pLevelDecorations[v19];
4149 v24 = v23;
4150 v25 = v23->field_16_event_id;
4151 if ( !v25 )
4152 {
4153 if ( v23->IsInteractive() )
4154 v26 = pNPCTopics[stru_5E4C90._decor_events[v24->_idx_in_stru123 - 75] + 379].pTopic;
4155 else
4156 v26 = pDecorationList->pDecorations[v24->uDecorationDescID].field_20;
4157 //goto LABEL_87;
4158 sub_41C0B8_set_status_string(v26);
4159 if ( pMouse->uPointingObjectID == 0 )
4160 {
4161 if ( uLastPointedObjectID != 0 )
4162 {
4163 pStatusBarString[0] = 0;
4164 bForceDrawStatusBar = 1;
4165 }
4166 }
4167 uLastPointedObjectID = pMouse->uPointingObjectID;
4168 return;
4169 }
4170 v22 = GetEventHintString(v25);
4171 if ( !v22 )
4172 //goto _return;
4173 {
4174 if ( pMouse->uPointingObjectID == 0 )
4175 {
4176 if ( uLastPointedObjectID != 0 )
4177 {
4178 pStatusBarString[0] = 0;
4179 bForceDrawStatusBar = 1;
4180 }
4181 }
4182 uLastPointedObjectID = pMouse->uPointingObjectID;
4183 return;
4184 }
4185 //goto LABEL_93;
4186 v26 = v22;
4187 //goto LABEL_87;
4188 sub_41C0B8_set_status_string(v26);
4189 if ( pMouse->uPointingObjectID == 0 )
4190 {
4191 if ( uLastPointedObjectID != 0 )
4192 {
4193 pStatusBarString[0] = 0;
4194 bForceDrawStatusBar = 1;
4195 }
4196 }
4197 uLastPointedObjectID = pMouse->uPointingObjectID;
4198 return;
4199 }
4200 if ( (v18 & 7) == OBJECT_BModel)
4201 {
4202 if ( v18 < (signed int)0x2000000u )
4203 {
4204 if ( uCurrentlyLoadedLevelType != LEVEL_Indoor)
4205 {
4206 v21 = pOutdoor->pBModels[(signed int)(unsigned __int16)v18 >> 9].pFaces[v19 & 0x3F].sCogTriggeredID;
4207 //goto LABEL_71;
4208 if ( !v21 || (v22 = GetEventHintString(v21)) == 0 )
4209 //goto LABEL_73;
4210 {
4211 pMouse->uPointingObjectID = 0;
4212 //goto LABEL_50;
4213 uLastPointedObjectID = 1;
4214 if ( pMouse->uPointingObjectID == 0 )
4215 {
4216 if ( uLastPointedObjectID != 0 )
4217 {
4218 pStatusBarString[0] = 0;
4219 bForceDrawStatusBar = 1;
4220 }
4221 }
4222 uLastPointedObjectID = pMouse->uPointingObjectID;
4223 return;
4224 }
4225 //goto LABEL_93;
4226 v26 = v22;
4227 //goto LABEL_87;
4228 sub_41C0B8_set_status_string(v26);
4229 if ( pMouse->uPointingObjectID == 0 )
4230 {
4231 if ( uLastPointedObjectID != 0 )
4232 {
4233 pStatusBarString[0] = 0;
4234 bForceDrawStatusBar = 1;
4235 }
4236 }
4237 uLastPointedObjectID = pMouse->uPointingObjectID;
4238 return;
4239 }
4240 pFace = &pIndoor->pFaces[v19];
4241 if ( BYTE3(pFace->uAttributes) & 6 )
4242 {
4243 v21 = pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID;
4244 //LABEL_71:
4245 if ( !v21 || (v22 = GetEventHintString(v21)) == 0 )
4246 //goto LABEL_73;
4247 {
4248 pMouse->uPointingObjectID = 0;
4249 //goto LABEL_50;
4250 uLastPointedObjectID = 1;
4251 if ( pMouse->uPointingObjectID == 0 )
4252 {
4253 if ( uLastPointedObjectID != 0 )
4254 {
4255 pStatusBarString[0] = 0;
4256 bForceDrawStatusBar = 1;
4257 }
4258 }
4259 uLastPointedObjectID = pMouse->uPointingObjectID;
4260 return;
4261 }
4262 //goto LABEL_93;
4263 v26 = v22;
4264 //goto LABEL_87;
4265 sub_41C0B8_set_status_string(v26);
4266 if ( pMouse->uPointingObjectID == 0 )
4267 {
4268 if ( uLastPointedObjectID != 0 )
4269 {
4270 pStatusBarString[0] = 0;
4271 bForceDrawStatusBar = 1;
4272 }
4273 }
4274 uLastPointedObjectID = pMouse->uPointingObjectID;
4275 return;
4276 }
4277 }
4278 //LABEL_73:
4279 pMouse->uPointingObjectID = 0;
4280 //goto LABEL_50;
4281 uLastPointedObjectID = 1;
4282 if ( pMouse->uPointingObjectID == 0 )
4283 {
4284 if ( uLastPointedObjectID != 0 )
4285 {
4286 pStatusBarString[0] = 0;
4287 bForceDrawStatusBar = 1;
4288 }
4289 }
4290 uLastPointedObjectID = pMouse->uPointingObjectID;
4291 return;
4292 }
4293 //LABEL_61:
4294 pMouse->uPointingObjectID = 0;
4295 //goto _return;
4296 if ( pMouse->uPointingObjectID == 0 )
4297 {
4298 if ( uLastPointedObjectID != 0 )
4299 {
4300 pStatusBarString[0] = 0;
4301 bForceDrawStatusBar = 1;
4302 }
4303 }
4304 uLastPointedObjectID = pMouse->uPointingObjectID;
4305 return;
4306 }
4307 if ( v18 >= 335544320 )
4308 //goto LABEL_61;
4309 {
4310 pMouse->uPointingObjectID = 0;
4311 if ( pMouse->uPointingObjectID == 0 )
4312 {
4313 if ( uLastPointedObjectID != 0 )
4314 {
4315 pStatusBarString[0] = 0;
4316 bForceDrawStatusBar = 1;
4317 }
4318 }
4319 uLastPointedObjectID = pMouse->uPointingObjectID;
4320 return;
4321 }
4322 pActor = &pActors[v19];
4323 v28 = pTmpBuf;
4324 v29 = pActor->dword_000334_unique_name;
4325 if ( v29 )
4326 v40 = pMonsterStats->pPlaceStrings[v29];
4327 else
4328 v40 = pMonsterStats->pInfos[pActor->pMonsterInfo.uID].pName;
4329 strncpy(pTmpBuf, v40, 0x7D0u);
4330 }
4331 v26 = v28;
4332 //LABEL_87:
4333 sub_41C0B8_set_status_string(v26);
4334 //goto _return;
4335 if ( pMouse->uPointingObjectID == 0 )
4336 {
4337 if ( uLastPointedObjectID != 0 )
4338 {
4339 pStatusBarString[0] = 0;
4340 bForceDrawStatusBar = 1;
4341 }
4342 }
4343 uLastPointedObjectID = pMouse->uPointingObjectID;
4344 return;
4345 }
4346 v1 = uNumVisibleWindows;
4347 if ( uNumVisibleWindows > 0 )
4348 {
4349 while ( 1 ) // some other fullscreen ui
4350 {
4351 pWindow = &pWindowList[pVisibleWindowsIdxs[v1] - 1];
4352 if ( (signed int)pX >= (signed int)pWindow->uFrameX
4353 && (signed int)pX <= (signed int)pWindow->uFrameZ
4354 && (signed int)pY >= (signed int)pWindow->uFrameY
4355 && (signed int)pY <= (signed int)pWindow->uFrameW )
4356 {
4357 for ( pButton = pWindow->pControlsHead; ; pButton = pButton->pNext )
4358 {
4359 if ( !pButton )
4360 break;
4361 if ( pButton->uButtonType == 1 )
4362 {
4363 if ( (signed int)pX >= (signed int)pButton->uX
4364 && (signed int)pX <= (signed int)pButton->uZ
4365 && (signed int)pY >= (signed int)pButton->uY
4366 && (signed int)pY <= (signed int)pButton->uW )
4367 {
4368 //LABEL_24:
4369 pMessageType1 = (UIMessageType)pButton->field_1C;
4370 if ( pMessageType1 )
4371 {
4372 v12 = pButton->uControlParam;
4373 pMessageQueue_50CBD0->AddMessage(pMessageType1, v12, 0);
4374 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
4375 {
4376 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = pMessageType1;
4377 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v12;
4378 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
4379 //LABEL_27:
4380 ++pMessageQueue_50CBD0->uNumMessages;
4381 }*/
4382 }
4383 //LABEL_28:
4384 v13 = pButton->pButtonName;
4385 //_set_status_and_ret:
4386 sub_41C0B8_set_status_string(v13);
4387 //LABEL_131:
4388 uLastPointedObjectID = 1;
4389 return;
4390 }
4391 }
4392 else
4393 {
4394 if ( pButton->uButtonType == 2 )
4395 {
4396 v45 = pX - pButton->uX;
4397 v45 = pY - pButton->uY;
4398 if ( (double)(signed int)pButton->uWidth != 0.0 )
4399 {
4400 if ( (double)(signed int)pButton->uHeight != 0.0 )
4401 {
4402 //UNDEF(v8);
4403 //if ( v9 | v10 )
4404 //goto LABEL_24;
4405 //{
4406 pMessageType1 = (UIMessageType)pButton->field_1C;
4407 if ( pMessageType1 )
4408 {
4409 v12 = pButton->uControlParam;
4410 pMessageQueue_50CBD0->AddMessage(pMessageType1, v12, 0);
4411 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
4412 {
4413 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = pMessageType1;
4414 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v12;
4415 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
4416 ++pMessageQueue_50CBD0->uNumMessages;
4417 }*/
4418 }
4419 v13 = pButton->pButtonName;
4420 sub_41C0B8_set_status_string(v13);
4421 uLastPointedObjectID = 1;
4422 return;
4423 //}
4424 }
4425 }
4426 }
4427 else // click on skill
4428 {
4429 if ( pButton->uButtonType == 3
4430 && (signed int)pX >= (signed int)pButton->uX
4431 && (signed int)pX <= (signed int)pButton->uZ
4432 && (signed int)pY >= (signed int)pButton->uY
4433 && (signed int)pY <= (signed int)pButton->uW )
4434 {
4435 //LABEL_19:
4436 pPlayer = pPlayers[uActiveCharacter];
4437 v5 = LOBYTE(pPlayer->pActiveSkills[pButton->uControlParam]);
4438 v6 = pPlayer->uSkillPoints;
4439 v7 = (v5 & 0x3F) + 1;
4440 if ( v6 < v7 )
4441 {
4442 v41 = v7 - v6;
4443 v39 = pGlobalTXT_LocalizationStrings[469];// "You need %d more Skill Points to advance here"
4444 }
4445 else
4446 {
4447 v41 = v7;
4448 v39 = pGlobalTXT_LocalizationStrings[468];// "Clicking here will spend %d Skill Points"
4449 }
4450 sprintf(Str1, v39, v41);
4451 v13 = Str1;
4452 //goto _set_status_and_ret;
4453 sub_41C0B8_set_status_string(v13);
4454 uLastPointedObjectID = 1;
4455 return;
4456 }
4457 }
4458 }
4459 }
4460 }
4461 if ( pWindow->uFrameHeight == 480 )
4462 break;
4463 --v1;
4464 if ( v1 <= 0 )
4465 {
4466 break;
4467 }
4468 }
4469 }
4470 if ( uNumVisibleWindows <= 0 || (uNumVisibleWindows > 0 && pWindow->uFrameHeight != 480 && v1 <= 0))
4471 {
4472 if ( pCurrentScreen == SCREEN_CHEST )
4473 {
4474 sub_42038D();
4475 //goto _return;
4476 if ( pMouse->uPointingObjectID == 0 )
4477 {
4478 if ( uLastPointedObjectID != 0 )
4479 {
4480 pStatusBarString[0] = 0;
4481 bForceDrawStatusBar = 1;
4482 }
4483 }
4484 uLastPointedObjectID = pMouse->uPointingObjectID;
4485 return;
4486 }
4487 if ( pCurrentScreen == SCREEN_HOUSE )
4488 {
4489 if ( dialog_menu_id != 2
4490 || (v16 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]], v16 == 0)
4491 || v16 == -65536 )
4492 //goto _return;
4493 {
4494 if ( pMouse->uPointingObjectID == 0 )
4495 {
4496 if ( uLastPointedObjectID != 0 )
4497 {
4498 pStatusBarString[0] = 0;
4499 bForceDrawStatusBar = 1;
4500 }
4501 }
4502 uLastPointedObjectID = pMouse->uPointingObjectID;
4503 return;
4504 }
4505 pItemGen = (ItemGen *)((char *)&pParty->pPickedItem + 36 * (v16 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 4);
4506 //LABEL_49:
4507 v17 = pItemGen->GetDisplayName();
4508 sub_41C0B8_set_status_string(v17);
4509 //LABEL_50:
4510 uLastPointedObjectID = 1;
4511 //_return:
4512 if ( pMouse->uPointingObjectID == 0 )
4513 {
4514 if ( uLastPointedObjectID != 0 )
4515 {
4516 pStatusBarString[0] = 0;
4517 bForceDrawStatusBar = 1;
4518 }
4519 }
4520 uLastPointedObjectID = pMouse->uPointingObjectID;
4521 return;
4522 }
4523 if ( (signed int)pY < 350 )
4524 {
4525 v14 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]];
4526 if ( v14 == 0 || v14 == -65536 || (unsigned int)v14 >= 0x1388 )
4527 //goto _return;
4528 {
4529 if ( pMouse->uPointingObjectID == 0 )
4530 {
4531 if ( uLastPointedObjectID != 0 )
4532 {
4533 pStatusBarString[0] = 0;
4534 bForceDrawStatusBar = 1;
4535 }
4536 }
4537 uLastPointedObjectID = pMouse->uPointingObjectID;
4538 return;
4539 }
4540 pItemGen = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[v14-1];
4541 //goto LABEL_49;
4542 v17 = pItemGen->GetDisplayName();
4543 sub_41C0B8_set_status_string(v17);
4544 uLastPointedObjectID = 1;
4545 if ( pMouse->uPointingObjectID == 0 )
4546 {
4547 if ( uLastPointedObjectID != 0 )
4548 {
4549 pStatusBarString[0] = 0;
4550 bForceDrawStatusBar = 1;
4551 }
4552 }
4553 uLastPointedObjectID = pMouse->uPointingObjectID;
4554 return;
4555 }
4556 _click_on_game_ui:
4557 if ( (signed int)pX >= (signed int)pWindowList[0].uFrameX
4558 && (signed int)pX <= (signed int)pWindowList[0].uFrameZ
4559 && (signed int)pY >= (signed int)pWindowList[0].uFrameY
4560 && (signed int)pY <= (signed int)pWindowList[0].uFrameW )
4561 {
4562 for ( pButton = pWindowList[0].pControlsHead; pButton != (GUIButton *)0; pButton = pButton->pNext )
4563 {
4564 if ( pButton->uButtonType == 1 )
4565 {
4566 if ( (signed int)pX >= (signed int)pButton->uX
4567 && (signed int)pX <= (signed int)pButton->uZ
4568 && (signed int)pY >= (signed int)pButton->uY
4569 && (signed int)pY <= (signed int)pButton->uW )
4570 {
4571 pMessageType3 = (UIMessageType)pButton->field_1C;
4572 if ( pMessageType3 == 0 ) // For books
4573 //goto LABEL_28;
4574 {
4575 v13 = pButton->pButtonName;
4576 sub_41C0B8_set_status_string(v13);
4577 uLastPointedObjectID = 1;
4578 return;
4579 }
4580 v38 = pButton->uControlParam;
4581 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
4582 {
4583 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = pMessageType3;
4584 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v38;
4585 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
4586 ++pMessageQueue_50CBD0->uNumMessages;
4587 }*/
4588 pMessageQueue_50CBD0->AddMessage(pMessageType3, v38, 0);
4589 //goto LABEL_131;
4590 uLastPointedObjectID = 1;
4591 return;
4592 }
4593 }
4594 else
4595 {
4596 if ( pButton->uButtonType == 2 )
4597 {
4598 v45 = pX - pButton->uX;
4599 v45 = pY - pButton->uY;
4600
4601 if (pX >= pButton->uX && pX <= pButton->uZ &&
4602 pY >= pButton->uY && pY <= pButton->uW)
4603 if ( (double)(signed int)pButton->uWidth != 0.0 )
4604 {
4605 if ( (double)(signed int)pButton->uHeight != 0.0 )
4606 {
4607 //UNDEF(v32);
4608 //if ( v33 | v34 )
4609 //{
4610 pMessageType2 = (UIMessageType)pButton->field_1C;
4611 if ( pMessageType2 != 0 )
4612 {
4613 v36 = pButton->uControlParam;
4614 if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
4615 {
4616 pMessageQueue_50CBD0->AddMessage(pMessageType2, v36, 0);
4617 /*pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = pMessageType2;
4618 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v36;
4619 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
4620 //goto LABEL_27;
4621 ++pMessageQueue_50CBD0->uNumMessages;*/
4622 v13 = pButton->pButtonName;
4623 sub_41C0B8_set_status_string(v13);
4624 uLastPointedObjectID = 1;
4625 return;
4626 }
4627 }
4628 //goto LABEL_28;
4629 v13 = pButton->pButtonName;
4630 sub_41C0B8_set_status_string(v13);
4631 uLastPointedObjectID = 1;
4632 return;
4633 //}
4634 }
4635 }
4636 }
4637 else
4638 {
4639 if ( pButton->uButtonType == 3
4640 && (signed int)pX >= (signed int)pButton->uX
4641 && (signed int)pX <= (signed int)pButton->uZ
4642 && (signed int)pY >= (signed int)pButton->uY
4643 && (signed int)pY <= (signed int)pButton->uW )
4644 //goto LABEL_19;
4645 {
4646 pPlayer = pPlayers[uActiveCharacter];
4647 v5 = LOBYTE(pPlayer->pActiveSkills[pButton->uControlParam]);
4648 v6 = pPlayer->uSkillPoints;
4649 v7 = (v5 & 0x3F) + 1;
4650 if ( v6 < v7 )
4651 {
4652 v41 = v7 - v6;
4653 v39 = pGlobalTXT_LocalizationStrings[469];// "You need %d more Skill Points to advance here"
4654 }
4655 else
4656 {
4657 v41 = v7;
4658 v39 = pGlobalTXT_LocalizationStrings[468];// "Clicking here will spend %d Skill Points"
4659 }
4660 sprintf(Str1, v39, v41);
4661 v13 = Str1;
4662 //goto _set_status_and_ret;
4663 sub_41C0B8_set_status_string(v13);
4664 uLastPointedObjectID = 1;
4665 return;
4666 }
4667 }
4668 }
4669 }
4670 }
4671 pMouse->uPointingObjectID = sub_46A99B();
4672 //goto _return;
4673 if ( pMouse->uPointingObjectID == 0 )
4674 {
4675 if ( uLastPointedObjectID != 0 )
4676 {
4677 pStatusBarString[0] = 0;
4678 bForceDrawStatusBar = 1;
4679 }
4680 }
4681 uLastPointedObjectID = pMouse->uPointingObjectID;
4682 return;
4683 }
4684 }
4685
4686
4687 //----- (00421626) --------------------------------------------------------
4688 GUIWindow *GameUI_InitializeCharacterWindow(unsigned int _this)
4689 {
4690 unsigned int v1; // edi@1
4691 GUIWindow *pWindow; // edi@3
4692
4693 ++pIcons_LOD->uTexturePacksCount;
4694 v1 = _this;
4695 if ( !pIcons_LOD->uNumPrevLoadedFiles )
4696 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles;
4697 pEventTimer->Pause();
4698 pAudioPlayer->StopChannels(-1, -1);
4699 bRingsShownInCharScreen = 0;
4700 CharacterUI_LoadPaperdollTextures();
4701 pCurrentScreen = v1;
4702 pWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_CharacterRecord, uActiveCharacter, 0);
4703 pCharacterScreen_StatsBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 12, pViewport->uViewportTL_Y + 308,
4704 (papredoll_dbrds[9] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[9]].uTextureWidth : 24),
4705 (papredoll_dbrds[9] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[9]].uTextureHeight : 26),
4706 1, 0, 0x73u, 0, 0x53u, pGlobalTXT_LocalizationStrings[216],// Stats
4707 (Texture *)(papredoll_dbrds[10] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[10]] : 0),
4708 papredoll_dbrds[9] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[9]] : 0, 0);
4709 pCharacterScreen_SkillsBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 102, pViewport->uViewportTL_Y + 308,
4710 (papredoll_dbrds[7] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[7]].uTextureWidth : 24),
4711 (papredoll_dbrds[7] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[7]].uTextureHeight : 26),
4712 1, 0, 0x72u, 0, 0x4Bu, pGlobalTXT_LocalizationStrings[205],//Skills
4713 (Texture *)(papredoll_dbrds[8] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[8]] : 0),
4714 papredoll_dbrds[7] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[7]] : 0, 0);
4715 pCharacterScreen_InventoryBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 192, pViewport->uViewportTL_Y + 308,
4716 (papredoll_dbrds[5] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[5]].uTextureWidth : 24),
4717 (papredoll_dbrds[5] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[5]].uTextureHeight : 26),
4718 1, 0, 0x74u, 0, 0x49u, pGlobalTXT_LocalizationStrings[120], //Inventory
4719 (Texture *)(papredoll_dbrds[6] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[6]] : 0),
4720 papredoll_dbrds[5] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[5]] : 0, 0);
4721 pCharacterScreen_AwardsBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 282, pViewport->uViewportTL_Y + 308,
4722 (papredoll_dbrds[3] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[3]].uTextureWidth : 24),
4723 (papredoll_dbrds[3] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[3]].uTextureHeight : 26),
4724 1, 0, 0x75u, 0, 0x41u, pGlobalTXT_LocalizationStrings[22], //Awards
4725 (Texture *)(papredoll_dbrds[4] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[4]] : 0),
4726 papredoll_dbrds[3] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[3]] : 0, 0);
4727 pCharacterScreen_ExitBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 371, pViewport->uViewportTL_Y + 308,
4728 (papredoll_dbrds[1] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[1]].uTextureWidth : 24),
4729 (papredoll_dbrds[1] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[1]].uTextureHeight : 26),
4730 1, 0, 0xA8u, 0, 0, pGlobalTXT_LocalizationStrings[79],//Exit
4731 (Texture *)(papredoll_dbrds[2] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[2]] : 0),
4732 papredoll_dbrds[1] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[1]] : 0, 0);
4733 pWindow->CreateButton(0, 0, 0x1DCu, 0x159u, 1, 122, 0x78u, 0, 0, "", 0);
4734 pCharacterScreen_DetalizBtn = pWindow->CreateButton(0x258u, 0x12Cu, 0x1Eu, 0x1Eu, 1, 0, 0x55u, 0, 0, pGlobalTXT_LocalizationStrings[64], 0);
4735 pCharacterScreen_DollBtn = pWindow->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, 1, 0, 0x85u, 0, 0, "", 0);
4736 pWindow->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 1u, 0x31u, "", 0);
4737 pWindow->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 2u, 0x32u, "", 0);
4738 pWindow->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 3u, 0x33u, "", 0);
4739 pWindow->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 4u, 0x34u, "", 0);
4740 pWindow->CreateButton(0, 0, 0, 0, 1, 0, 0xB0u, 0, 9u, "", 0);
4741 FillAwardsData();
4742 return pWindow;
4743 } 724 }
4744 725
4745 726
4746 727
4747 //----- (004219BE) -------------------------------------------------------- 728 //----- (004219BE) --------------------------------------------------------