comparison UI/UiGame.cpp @ 1298:b97d0cdd6c79

new folder UI
author Ritor1
date Wed, 19 Jun 2013 17:18:35 +0600
parents
children 8c2f689b5f0b
comparison
equal deleted inserted replaced
1297:5450af4f57ef 1298:b97d0cdd6c79
1 #ifdef _MSC_VER
2 #define _CRT_SECURE_NO_WARNINGS
3 #endif
4
5 #include <assert.h>
6
7 #include "Texture.h"
8 #include "MM7.h"
9
10 #include "Mouse.h"
11 #include "Keyboard.h"
12 #include "mm7_data.h"
13
14 #include "Vis.h"
15 #include "MapInfo.h"
16 #include "Game.h"
17 #include "GUIWindow.h"
18 #include "GUIFont.h"
19 #include "Party.h"
20 #include "AudioPlayer.h"
21 #include "Outdoor.h"
22 #include "LOD.h"
23 #include "Actor.h"
24 #include "Viewport.h"
25 #include "SpriteObject.h"
26 #include "ObjectList.h"
27 #include "DecorationList.h"
28 #include "PlayerFrameTable.h"
29 #include "stru123.h"
30 #include "Time.h"
31 #include "IconFrameTable.h"
32 #include "TurnEngine.h"
33 #include "texts.h"
34 #include "UIHouses.h"
35 #include "BSPModel.h"
36
37
38
39
40
41 int uTextureID_GameUI_CharSelectionFrame; // 50C98C
42
43
44
45
46
47 //----- (00421D00) --------------------------------------------------------
48 void __fastcall GameUI_OnPlayerPortraitLeftClick(unsigned int uPlayerID)
49 {
50 //unsigned int v1; // esi@1
51 //int v2; // eax@2
52 //Player *v3; // ecx@2
53 //Player *v4; // ecx@5
54 unsigned int v5; // [sp-4h] [bp-10h]@21
55
56 //v1 = uPlayerID;
57 auto player = &pParty->pPlayers[uPlayerID - 1];
58 if (pParty->pPickedItem.uItemID)
59 {
60 //v3 = player;
61 if (auto slot = player->AddItem(-1, pParty->pPickedItem.uItemID))
62 {
63 memcpy(&player->pInventoryItems[slot-1], &pParty->pPickedItem, 0x24u);
64 viewparams->bRedrawGameUI = true;
65 pMouse->RemoveHoldingItem();
66 return;
67 }
68
69 if (!player->CanAct())
70 {
71 player = pPlayers[uActiveCharacter];
72 }
73 if(player->CanAct() || !pPlayers[uActiveCharacter]->CanAct())
74 player->PlaySound(SPEECH_NoRoom, 0);
75 }
76
77 //LABEL_9:
78 if (pCurrentScreen == SCREEN_GAME)
79 {
80 viewparams->bRedrawGameUI = true;
81 if ( uActiveCharacter != uPlayerID )
82 //goto LABEL_27;
83 {
84 if ( pPlayers[uPlayerID]->uTimeToRecovery )
85 return;
86
87 uActiveCharacter = uPlayerID;
88 return;
89 }
90 v5 = 7;
91 //LABEL_22:
92 pGUIWindow_CurrentMenu = CharacterUI_Initialize(v5);
93 return;
94 }
95 if ( pCurrentScreen == SCREEN_SPELL_BOOK )
96 return;
97 if ( pCurrentScreen == SCREEN_CHEST )
98 {
99 //LABEL_23:
100 viewparams->bRedrawGameUI = true;
101 if ( uActiveCharacter == uPlayerID )
102 {
103 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103;
104 pCurrentScreen = SCREEN_CHEST_INVENTORY;
105 //goto LABEL_28;
106 uActiveCharacter = uPlayerID;
107 return;
108 }
109 //LABEL_27:
110 if ( pPlayers[uPlayerID]->uTimeToRecovery )
111 return;
112 //goto LABEL_28;
113 uActiveCharacter = uPlayerID;
114 return;
115 }
116 if ( pCurrentScreen != SCREEN_HOUSE )
117 {
118 if ( pCurrentScreen == SCREEN_E )
119 {
120 //LABEL_28:
121 uActiveCharacter = uPlayerID;
122 return;
123 }
124 if ( pCurrentScreen != SCREEN_CHEST_INVENTORY )
125 {
126 viewparams->bRedrawGameUI = true;
127 uActiveCharacter = uPlayerID;
128 if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 102 )
129 FillAwardsData();
130 return;
131 }
132 //goto LABEL_23;
133 viewparams->bRedrawGameUI = true;
134 if ( uActiveCharacter == uPlayerID )
135 {
136 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103;
137 pCurrentScreen = SCREEN_CHEST_INVENTORY;
138 //goto LABEL_28;
139 uActiveCharacter = uPlayerID;
140 return;
141 }
142 //LABEL_27:
143 if ( pPlayers[uPlayerID]->uTimeToRecovery )
144 return;
145 //goto LABEL_28;
146 uActiveCharacter = uPlayerID;
147 return;
148 }
149 if ( window_SpeakInHouse->receives_keyboard_input_2 == WINDOW_INPUT_IN_PROGRESS)
150 return;
151 viewparams->bRedrawGameUI = true;
152 if ( uActiveCharacter != uPlayerID )
153 //goto LABEL_28;
154 uActiveCharacter = uPlayerID;
155 return;
156 if (dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD || dialog_menu_id == HOUSE_DIALOGUE_SHOP_6)
157 {
158 __debugbreak(); // fix indexing
159 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103;
160 v5 = 14;
161 //goto LABEL_22;
162 pGUIWindow_CurrentMenu = CharacterUI_Initialize(v5);
163 return;
164 }
165 }
166 // 4E28F8: using guessed type int pCurrentScreen;
167 // F8B19C: using guessed type int dword_F8B19C;
168
169 //----- (00416B01) --------------------------------------------------------
170 void GameUI_DrawNPCPopup(void *_this)//PopupWindowForBenefitAndJoinText
171 {
172 int v1; // edi@2
173 int v2; // ecx@2
174 NPCData *v3; // eax@2
175 NPCData *v4; // esi@7
176 NPCData *v5; // eax@16
177 NPCData *v6; // esi@16
178 const CHAR *v7; // eax@18
179 unsigned int v8; // eax@25
180 unsigned int v9; // eax@25
181 const char *v10; // ST14_4@26
182 char *v11; // esi@26
183 const char *v12; // ST18_4@27
184 unsigned __int16 v13; // ax@28
185 char *v14; // eax@28
186 GUIWindow a1; // [sp+Ch] [bp-60h]@23
187 int a2; // [sp+60h] [bp-Ch]@16
188 void *v17; // [sp+64h] [bp-8h]@1
189 LPCSTR lpsz; // [sp+68h] [bp-4h]@6
190
191 v17 = _this;
192 if ( bNoNPCHiring != 1 )
193 {
194 v1 = 0;
195 v2 = 0;
196 v3 = pParty->pHirelings;
197 /*do
198 {
199 if ( v3->pName )
200 pTmpBuf[v1++] = v2;
201 ++v3;
202 ++v2;
203 }
204 while ( (signed int)v3 < (signed int)&pParty->pPickedItem );*/
205 for (int i = 0; i < 2; ++i)
206 {
207 if (pParty->pHirelings[i].pName)
208 pTmpBuf[v1++] = i;
209 }
210 lpsz = 0;
211 if ( (signed int)pNPCStats->uNumNewNPCs > 0 )
212 {
213 /*v4 = pNPCStats->pNewNPCData;
214 do
215 {
216 if ( v4->uFlags & 0x80
217 && (!pParty->pHirelings[0].pName || strcmp(v4->pName, pParty->pHirelings[0].pName))
218 && (!pParty->pHirelings[1].pName || strcmp(v4->pName, pParty->pHirelings[1].pName)) )
219 pTmpBuf[v1++] = (char)lpsz + 2;
220 ++lpsz;
221 ++v4;
222 }
223 while ( (signed int)lpsz < (signed int)pNPCStats->uNumNewNPCs );*/
224 for (int i = 0; i < pNPCStats->uNumNewNPCs; ++i)
225 {
226 if (pNPCStats->pNewNPCData[i].Hired())
227 {
228 if (!pParty->pHirelings[0].pName || strcmp((char *)pNPCStats->pNewNPCData[i].pName, (char *)pParty->pHirelings[0].pName))
229 {
230 if (!pParty->pHirelings[1].pName || strcmp((char *)pNPCStats->pNewNPCData[i].pName, (char *)pParty->pHirelings[1].pName))
231 pTmpBuf[v1++] = i + 2;
232 }
233 }
234 }
235 }
236 if ( (signed int)((char *)v17 + (unsigned __int8)pParty->field_709) < v1 )
237 {
238 sDialogue_SpeakingActorNPC_ID = -1 - (unsigned __int8)pParty->field_709 - (int)v17;
239 v5 = GetNewNPCData(sDialogue_SpeakingActorNPC_ID, &a2);
240 v6 = v5;
241 if ( v5 )
242 {
243 if ( a2 == 57 )
244 v7 = pNPCTopics[512].pText; // Baby dragon
245 else
246 v7 = (const CHAR *)pNPCStats->pProfessions[v5->uProfession].pBenefits;
247 lpsz = v7;
248 if ( !v7 )
249 {
250 lpsz = (LPCSTR)pNPCStats->pProfessions[v5->uProfession].pJoinText;
251 if ( !lpsz )
252 lpsz = "";
253 }
254 a1.Hint = 0;
255 a1.uFrameX = 38;
256 a1.uFrameY = 60;
257 a1.uFrameWidth = 276;
258 a1.uFrameZ = 313;
259 a1.uFrameHeight = pFontArrus->CalcTextHeight(lpsz, &a1, 0, 0)
260 + 2 * LOBYTE(pFontArrus->uFontHeight)
261 + 24;
262 if ( (signed int)a1.uFrameHeight < 130 )
263 a1.uFrameHeight = 130;
264 a1.uFrameWidth = 400;
265 a1.uFrameZ = a1.uFrameX + 399;
266 a1.DrawMessageBox(0);
267 sprintfex(pTmpBuf2.data(), "NPC%03d", v6->uPortraitID);
268 v8 = pIcons_LOD->LoadTexture(pTmpBuf2.data(), TEXTURE_16BIT_PALETTE);
269 pRenderer->DrawTextureIndexed(
270 a1.uFrameX + 22,
271 a1.uFrameY + 36,
272 (Texture *)(v8 != -1 ? &pIcons_LOD->pTextures[v8] : 0));
273 v9 = v6->uProfession;
274 if ( v9 )
275 {
276 v10 = v6->pName;
277 v11 = pTmpBuf.data();
278 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[429], v10, aNPCProfessionNames[v9]);
279 }
280 else
281 {
282 v12 = v6->pName;
283 v11 = pTmpBuf.data();
284 strcpy(pTmpBuf.data(), v12);
285 }
286 v13 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
287 a1.DrawTitleText(pFontArrus, 0, 0xCu, v13, v11, 3u);
288 a1.uFrameWidth -= 24;
289 a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1;
290 v14 = BuilDialogueString((char *)lpsz, uActiveCharacter - 1, 0, 0, 0, 0);
291 a1.DrawText(pFontArrus, 100, 36, 0, v14, 0, 0, 0);
292 }
293 }
294 }
295 }
296
297
298
299 //----- (00445D4A) --------------------------------------------------------
300 void GameUI_InitializeDialogue(Actor *actor, int bPlayerSaysHello)
301 {
302 NPCData *pNPCInfo; // ebp@1
303 int v9; // esi@8
304 int pNumberContacts; // eax@11
305 char pContainer[32]; // [sp+14h] [bp-28h]@3
306
307 dword_A74CDC = -1;
308 dword_AE336C = -1;
309 pEventTimer->Pause();
310 pMiscTimer->Pause();
311 pAudioPlayer->StopChannels(-1, -1);
312 uDialogueType = 0;
313 sDialogue_SpeakingActorNPC_ID = actor->sNPC_ID;
314 pDialogue_SpeakingActor = actor;
315 pNPCInfo = GetNPCData(actor->sNPC_ID);
316 if ( (pNPCInfo->uFlags & 3) != 2 )
317 pNPCInfo->uFlags = pNPCInfo->uFlags + 1;
318
319 switch (pParty->alignment)
320 {
321 case PartyAlignment_Good: sprintfex(pContainer, "evt%02d-b", const_2()); break;
322 case PartyAlignment_Neutral: sprintfex(pContainer, "evt%02d", const_2()); break;
323 case PartyAlignment_Evil: sprintfex(pContainer, "evt%02d-c", const_2()); break;
324 }
325
326 pDialogueNPCCount = 0;
327 uNumDialogueNPCPortraits = 1;
328 pTexture_Dialogue_Background = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE);
329 sprintfex(pContainer, "npc%03u", pNPCInfo->uPortraitID);
330 v9 = 0;
331 pDialogueNPCPortraits[0] = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE);
332 dword_591084 = areWeLoadingTexture;
333 uTextureID_right_panel_loop = uTextureID_right_panel;
334 if ( !pNPCInfo->Hired() && pNPCInfo->Location2D >= 0 )
335 {
336 if ( (signed int)pParty->GetPartyFame() <= pNPCInfo->fame
337 || (pNumberContacts = pNPCInfo->uFlags & 0xFFFFFF7F, (pNumberContacts & 0x80000000u) != 0) )
338 {
339 v9 = 1;
340 }
341 else
342 {
343 if ( pNumberContacts > 1 )
344 {
345 if ( pNumberContacts == 2 )
346 {
347 v9 = 3;
348 }
349 else
350 {
351 if ( pNumberContacts != 3 )
352 {
353 if ( pNumberContacts != 4 )
354 v9 = 1;
355 }
356 else
357 {
358 v9 = 2;
359 }
360 }
361 }
362 else if ( pNPCInfo->rep )
363 {
364 v9 = 2;
365 }
366 }
367 }
368 if (sDialogue_SpeakingActorNPC_ID < 0)
369 v9 = 4;
370 pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Dialogue, v9, 0);//pNumberContacts = 1, v9 = 0; pNumberContacts = 2, v9 = 3;
371 if (pNPCInfo->Hired())
372 {
373 if ( !pNPCInfo->bHasUsedTheAbility )
374 {
375 if ( pNPCInfo->uProfession >= 10 )
376 {
377 if ( pNPCInfo->uProfession <= 12 || pNPCInfo->uProfession > 32 && (pNPCInfo->uProfession <= 34
378 || pNPCInfo->uProfession > 38 && (pNPCInfo->uProfession <= 43 || pNPCInfo->uProfession == 52)) )
379 {
380 pDialogueWindow->CreateButton(480, 250, 140, LOBYTE(pFontArrus->uFontHeight) - 3, 1, 0, UIMSG_SelectNPCDialogueOption, 9, 0, "", 0);
381 pDialogueWindow->_41D08F_set_keyboard_control_group(4, 1, 0, 1);
382 }
383 }
384 }
385 }
386
387 pDialogueWindow->CreateButton( 61, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0);
388 pDialogueWindow->CreateButton(177, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0);
389 pDialogueWindow->CreateButton(292, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0);
390 pDialogueWindow->CreateButton(407, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0);
391
392 if (bPlayerSaysHello && uActiveCharacter && !pNPCInfo->Hired())
393 {
394 if (pParty->uCurrentHour < 5 || pParty->uCurrentHour > 21)
395 pPlayers[uActiveCharacter]->PlaySound(SPEECH_GoodEvening, 0);
396 else
397 pPlayers[uActiveCharacter]->PlaySound(SPEECH_GoodDay, 0);
398 }
399 }
400
401 //----- (00445350) --------------------------------------------------------
402 void GameUI_DrawDialogue()
403 {
404 NPCData *pNPC; // ebx@2
405 int pGreetType; // eax@2
406 unsigned __int16 v2; // di@2
407 //unsigned int v3; // eax@2
408 char *v4; // esi@3
409 //int v5; // eax@11
410 //char *v6; // ecx@13
411 //char *v7; // eax@16
412 //unsigned int v8; // edi@19
413 //char *v9; // ecx@27
414 char *v10; // eax@29
415 //int v11; // eax@30
416 int v12; // esi@39
417 char *v13; // eax@41
418 GUIButton *v14; // eax@43
419 //GUIButton *v15; // edi@43
420 signed int v16; // eax@44
421 //unsigned int v23; // eax@53
422 //const char *v24; // eax@59
423 //unsigned __int16 v30; // cx@83
424 int v31; // ecx@86
425 int v32; // ebx@93
426 unsigned int v33; // eax@93
427 GUIWindow *v34; // ecx@93
428 int v35; // esi@93
429 int i; // eax@93
430 GUIButton *v37; // eax@94
431 int v38; // eax@95
432 signed int v39; // esi@99
433 signed int v40; // eax@102
434 unsigned int v41; // ebx@102
435 int v42; // edi@102
436 GUIButton *v43; // esi@103
437 int v44; // eax@104
438 unsigned int v45; // ecx@104
439 unsigned __int16 *v46; // edx@104
440 unsigned __int16 v47; // ax@104
441 GUIWindow pWindow; // [sp+4h] [bp-110h]@39
442 int v49; // [sp+Ch] [bp-108h]@39
443 int v50; // [sp+14h] [bp-100h]@39
444 GUIWindow v51; // [sp+58h] [bp-BCh]@2
445 GUIWindow v52; // [sp+ACh] [bp-68h]@42
446 char *Str; // [sp+100h] [bp-14h]@104
447 //int v54; // [sp+104h] [bp-10h]@2
448 //unsigned __int16 *v55; // [sp+108h] [bp-Ch]@82
449 GUIFont *pOutString; // [sp+10Ch] [bp-8h]@39
450 char *pInString=NULL; // [sp+110h] [bp-4h]@32
451
452 if ( !pDialogueWindow )
453 return;
454
455 memcpy(&v51, pDialogueWindow, sizeof(v51));
456 pNPC = GetNPCData(sDialogue_SpeakingActorNPC_ID);
457 pGreetType = GetGreetType(sDialogue_SpeakingActorNPC_ID);
458 v51.uFrameWidth -= 10;
459 v51.uFrameZ -= 10;
460 //v54 = v1;
461 TargetColor(0xFFu, 0xFFu, 0xFFu);
462 TargetColor(0xE1u, 0xCDu, 0x23u);
463 v2 = TargetColor(0x15u, 0x99u, 0xE9u);
464 pRenderer->DrawTextureIndexed(477, 0, pTexture_Dialogue_Background);
465 pRenderer->DrawTextureTransparent(468, 0, (Texture *)(uTextureID_right_panel_loop != -1 ? &pIcons_LOD->pTextures[uTextureID_right_panel_loop] : 0));
466 pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0] - 4, pNPCPortraits_y[0][0] - 4, (Texture *)(uTextureID_50795C != -1 ? &pIcons_LOD->pTextures[uTextureID_50795C] : 0));
467 pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], pDialogueNPCPortraits[0]);
468
469 if (pNPC->uProfession)
470 {
471 assert(pNPC->uProfession < sizeof(aNPCProfessionNames) / sizeof(*aNPCProfessionNames.data())); // sometimes buffer overflows; errors emerge both here and in dialogue text
472 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[429], pNPC->pName, aNPCProfessionNames[pNPC->uProfession]);//^Pi[%s] %s
473 }
474 else
475 strcpy(pTmpBuf.data(), pNPC->pName);
476
477 v51.DrawTitleText(pFontArrus, 483, 112, v2, pTmpBuf.data(), 3);
478 pParty->GetPartyFame();
479
480 pInString = nullptr;
481 switch (uDialogueType)
482 {
483 case DIALOGUE_13:
484 pInString = BuilDialogueString(pNPCStats->pProfessions[pNPC->uProfession - 1].pJoinText, uActiveCharacter - 1, 0, 0, 0, 0);
485 break;
486
487 case DIALOGUE_PROFESSION_DETAILS:
488 {
489 auto prof = pNPCStats->pProfessions + pNPC->uProfession - 1;
490
491 if (dialogue_show_profession_details)
492 pInString = BuilDialogueString(prof->pBenefits, uActiveCharacter - 1, 0, 0, 0, 0);
493 else if (pNPC->Hired())
494 pInString = BuilDialogueString(prof->pDismissText, uActiveCharacter - 1, 0, 0, 0, 0);
495 else
496 pInString = BuilDialogueString(prof->pJoinText, uActiveCharacter - 1, 0, 0, 0, 0);
497 }
498 break;
499
500
501 case DIALOGUE_ARENA_WELCOME:
502 pInString = pGlobalTXT_LocalizationStrings[574]; // "Welcome to the Arena of Life and Death. Remember, you are only allowed one arena combat per visit. To fight an arena battle, select the option that best describes your abilities and return to me- if you survive:"
503 break;
504
505 case DIALOGUE_ARENA_FIGHT_NOT_OVER_YET:
506 pInString = pGlobalTXT_LocalizationStrings[577]; //"Get back in there you wimps:"
507 break;
508
509 case DIALOGUE_ARENA_REWARD:
510 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[576], gold_transaction_amount);// "Congratulations on your win: here's your stuff: %u gold."
511 pInString = pTmpBuf.data();
512 break;
513
514 case DIALOGUE_ARENA_ALREADY_WON:
515 pInString = pGlobalTXT_LocalizationStrings[582]; // "You already won this trip to the Arena:"
516 break;
517
518 default:
519 if (uDialogueType > DIALOGUE_18 && uDialogueType < DIALOGUE_23 && !byte_5B0938[0])
520 {
521 pInString = (char *)current_npc_text;
522 }
523 else if (pGreetType == 1)//QuestNPC_greet
524 {
525 if (pNPC->greet)
526 {
527 if ((pNPC->uFlags & 3) == 2)
528 pInString = pNPCStats->pNPCGreetings[pNPC->greet - 1].pGreeting2;
529 else
530 pInString = pNPCStats->pNPCGreetings[pNPC->greet - 1].pGreeting1;
531 }
532 }
533 else if (pGreetType == 2)//HiredNPC_greet
534 {
535 auto prof = pNPCStats->pProfessions + pNPC->uProfession - 1;
536
537 if (pNPC->Hired())
538 pInString = BuilDialogueString(prof->pDismissText, uActiveCharacter - 1, 0, 0, 0, 0);
539 else
540 pInString = BuilDialogueString(prof->pJoinText, uActiveCharacter - 1, 0, 0, 0, 0);
541 }
542 break;
543 }
544
545 if (pInString)
546 {
547 pWindow.uFrameWidth = game_viewport_width;
548 pWindow.uFrameZ = 452;
549 auto font = pFontArrus;
550 v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
551 if ( 352 - v12 < 8 )
552 {
553 font = pFontCreate;
554 v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, 0) + 7;
555 }
556 if (uTextureID_Leather != -1)
557 pRenderer->_4A6A68(8, 352 - v12, &pIcons_LOD->pTextures[uTextureID_Leather], pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight - v12);
558 pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428);
559 v13 = FitTextInAWindow(pInString, font, &pWindow, 0xDu, 0);
560 pDialogueWindow->DrawText(font, 13, 354 - v12, 0, v13, 0, 0, 0);
561 }
562
563
564 memcpy(&v52, pDialogueWindow, sizeof(v52));
565 v52.uFrameX = 483;
566 v52.uFrameWidth = 148;
567 v52.uFrameZ = 334;
568 for (int i = v52.pStartingPosActiveItem;
569 i < v52.pStartingPosActiveItem + v52.pNumPresenceButton; ++i)
570 {
571 v14 = v52.GetControl(i);
572 //v15 = v14;
573 if ( !v14 )
574 break;
575 v16 = v14->msg_param;
576
577 if ( v16 > 88 )
578 v14->pButtonName[0] = 0;
579 else if (v16 == 88)
580 strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[581]); // Lord
581 else if (v16 == 87)
582 strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[580]); // Knight
583 else if (v16 == 86)
584 strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[579]); // Squire
585 else if (v16 == 85)
586 strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[578]); // Page
587 else if (v16 == 77)
588 strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[407]); // Details
589 else if (v16 == 76)
590 {
591 if (pNPC->Hired())
592 sprintf(v14->pButtonName, (const char*)pGlobalTXT_LocalizationStrings[408], pNPC->pName); // Release %s
593 else
594 strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[406]); // Hire
595 }
596 else if (v16 == 24)
597 {
598 __debugbreak(); // learn conditions of this event
599 auto topic = pNPCTopics[pNPC->evt_F - 1].pTopic;//(&dword_721660)[8 * v23];
600 if (!topic)
601 {
602 v14->pButtonName[0] = 0;
603 v14->msg_param = 0;
604 }
605 else
606 strcpy(v14->pButtonName, topic);
607 }
608 else if (v16 == 9)
609 strcpy(v14->pButtonName, GetProfessionActionText(pNPC->uProfession));
610 else if (v16 == 19)
611 {
612 // __debugbreak(); // learn conditions of this event Scavenger Hunt
613 auto topic = pNPCTopics[pNPC->evt_A - 1].pTopic;//(&dword_721660)[8 * v23];
614 if (!topic)
615 {
616 v14->pButtonName[0] = 0;
617 v14->msg_param = 0;
618 }
619 else strcpy(v14->pButtonName, topic);
620 }
621 else if (v16 == 20)
622 {
623 //__debugbreak(); // learn conditions of this event instruments
624 auto topic = pNPCTopics[pNPC->evt_B - 1].pTopic;//(&dword_721660)[8 * v23];
625 if (!topic)
626 {
627 v14->pButtonName[0] = 0;
628 v14->msg_param = 0;
629 }
630 else strcpy(v14->pButtonName, topic);
631 }
632 else if (v16 == 21)
633 {
634 //__debugbreak(); // learn conditions of this event
635 auto topic = pNPCTopics[pNPC->evt_C - 1].pTopic;//(&dword_721660)[8 * v23];
636 if (!topic)
637 {
638 v14->pButtonName[0] = 0;
639 v14->msg_param = 0;
640 }
641 else strcpy(v14->pButtonName, topic);
642 }
643 else if (v16 == 22)
644 {
645 //__debugbreak(); // learn conditions of this event
646 auto topic = pNPCTopics[pNPC->evt_D - 1].pTopic;//(&dword_721660)[8 * v23];
647 if (!topic)
648 {
649 v14->pButtonName[0] = 0;
650 v14->msg_param = 0;
651 }
652 else strcpy(v14->pButtonName, topic);
653 }
654 else if (v16 == 23)
655 {
656 //__debugbreak(); // learn conditions of this event
657 auto topic = pNPCTopics[pNPC->evt_E - 1].pTopic;//(&dword_721660)[8 * v23];
658 if (!topic)
659 {
660 v14->pButtonName[0] = 0;
661 v14->msg_param = 0;
662 }
663 else strcpy(v14->pButtonName, topic);
664 }
665 else if (v16 == 13)
666 {
667 if (pNPC->Hired())
668 sprintf(v14->pButtonName, pGlobalTXT_LocalizationStrings[408], pNPC->pName); // Release %s
669 else
670 strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[122]); // Join
671 }
672 else
673 v14->pButtonName[0] = 0;
674
675
676 if (pParty->field_7B5_in_arena_quest && pParty->field_7B5_in_arena_quest != -1)
677 {
678 int num_dead_actors = 0;
679 pInString = 0;
680 for (uint i = 0; i < uNumActors; ++i)
681 {
682 if (pActors[i].uAIState == Dead || pActors[i].uAIState == Removed ||
683 pActors[i].uAIState == Disabled)
684 ++num_dead_actors;
685 else
686 {
687 int sumonner_type = PID_TYPE(pActors[i].uSummonerID);
688 if (sumonner_type == OBJECT_Player)
689 ++num_dead_actors;
690 }
691 }
692 if (num_dead_actors == uNumActors)
693 strcpy(v14->pButtonName, pGlobalTXT_LocalizationStrings[658]); // Collect Prize
694 }
695 }
696
697
698 v32 = 0;
699 //pInString = (char *)TargetColor(0xFFu, 0xFFu, 0xFFu);
700 v33 = TargetColor(0xE1u, 0xCDu, 0x23u);
701 v34 = pDialogueWindow;
702 //v54 = v33;
703 v35 = pDialogueWindow->pStartingPosActiveItem;
704 for ( i = v35 + pDialogueWindow->pNumPresenceButton; v35 < i; i = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem )
705 {
706 v37 = v34->GetControl(v35);
707 if ( !v37 )
708 {
709 v34 = pDialogueWindow;
710 break;
711 }
712 v38 = pFontArrus->CalcTextHeight(v37->pButtonName, &v52, 0, 0);
713 v34 = pDialogueWindow;
714 v32 += v38;
715 ++v35;
716 }
717 v39 = v34->pNumPresenceButton;
718 if ( v39 )
719 {
720 pOutString = (GUIFont *)((174 - v32) / v39);
721 if ( (174 - v32) / v39 > 32 )
722 pOutString = (GUIFont *)32;
723 int v55 = 1;
724 v40 = 174 - (int)pOutString * v39 - v32;
725 v41 = v34->pStartingPosActiveItem;
726 v42 = v40 / 2 - (signed int)pOutString / 2 + 138;
727 if ( (signed int)v41 < (signed int)(v41 + v39) )
728 {
729 do
730 {
731 v43 = v34->GetControl(v41);
732 if ( !v43 )
733 break;
734 v43->uY = (unsigned int)((char *)pOutString + v42);
735 Str = v43->pButtonName;
736 v44 = pFontArrus->CalcTextHeight(v43->pButtonName, &v52, 0, 0);
737 v45 = v43->uY;
738 v46 = (unsigned short *)v55;
739 v43->uHeight = v44;
740 v42 = v45 + v44 - 1;
741 v43->uW = v42;
742 v47 = v33;
743 if ( (unsigned __int16 *)pDialogueWindow->pCurrentPosActiveItem != v46 )
744 v47 = TargetColor(0xFFu, 0xFFu, 0xFFu);
745 v52.DrawTitleText(pFontArrus, 0, v45, v47, Str, 3u);
746 v34 = pDialogueWindow;
747 ++v55;
748 ++v41;
749 }
750 while ( (signed int)v41 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
751 }
752 }
753 pRenderer->DrawTextureIndexed(471, 445, pIcons_LOD->GetTexture(uExitCancelTextureId));
754 }
755
756
757
758 //----- (00444FBE) --------------------------------------------------------
759 void GameUI_DrawBranchlessDialogue()
760 {
761 //GUIFont *v0; // esi@1
762 int v1; // esi@4
763 char *v2; // eax@6
764 int v3; // edi@12
765 char Str[200]; // [sp+Ch] [bp-120h]@12
766 GUIWindow v5; // [sp+D4h] [bp-58h]@4
767 GUIFont *pFont; // [sp+128h] [bp-4h]@1
768
769 pFont = pFontArrus;
770 if ( current_npc_text && !byte_5B0938[0] )
771 strcpy(byte_5B0938.data(), current_npc_text);
772 v5.uFrameWidth = game_viewport_width;
773 v5.uFrameZ = 452;
774 v1 = pFontArrus->CalcTextHeight(byte_5B0938.data(), &v5, 12, 0) + 7;
775 if ( 352 - v1 < 8 )
776 {
777 pFont = pFontCreate;
778 v1 = pFontCreate->CalcTextHeight(byte_5B0938.data(), &v5, 12, 0) + 7;
779 }
780 pRenderer->_4A6A68(8, 352 - v1,
781 pIcons_LOD->GetTexture(uTextureID_Leather),
782 pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - v1);
783 pRenderer->DrawTextureIndexed(8, 347 - v1, pTexture_591428);
784 v2 = FitTextInAWindow(byte_5B0938.data(), pFont, &v5, 0xCu, 0);
785 pGUIWindow2->DrawText(pFont, 12, 354 - v1, 0, v2, 0, 0, 0);
786 pRenderer->DrawTextureRGB(0, 0x160u, pTexture_StatusBar);
787 if ( pGUIWindow2->receives_keyboard_input_2 != WINDOW_INPUT_IN_PROGRESS)
788 {
789 if ( pGUIWindow2->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED)
790 {
791 pGUIWindow2->receives_keyboard_input_2 = WINDOW_INPUT_NONE;
792 strcpy(GameUI_Footer_TimedString.data(), (const char *)pKeyActionMap->pPressedKeysBuffer);
793 LABEL_16:
794 sub_4452BB();
795 return;
796 }
797 if ( pGUIWindow2->receives_keyboard_input_2 != WINDOW_INPUT_CANCELLED)
798 return;
799 pGUIWindow2->receives_keyboard_input_2 = WINDOW_INPUT_NONE;
800 LABEL_15:
801 memset(GameUI_Footer_TimedString.data(), 0, 0xC8u);
802 goto LABEL_16;
803 }
804 if ( pGUIWindow2->ptr_1C == (void *)26 )
805 {
806 sprintf(Str, "%s %s", GameUI_Footer_TimedString, pKeyActionMap->pPressedKeysBuffer);
807 v3 = pFontLucida->GetLineWidth(Str);
808 pGUIWindow2->DrawText(pFontLucida, 13, 357, 0, Str, 0, 0, 0);
809 pGUIWindow2->DrawFlashingInputCursor(v3 + 13, 357, pFontLucida);
810 return;
811 }
812 if ( pKeyActionMap->pPressedKeysBuffer[0] )
813 {
814 pKeyActionMap->SetWindowInputStatus(0);
815 goto LABEL_15;
816 }
817 }
818
819
820 //----- (004443D5) --------------------------------------------------------
821 const char *GameUI_GetMinimapHintText()
822 {
823 int v0; // ST20_4@1
824 unsigned int v1; // esi@1
825 signed int v2; // ebx@1
826 double v3; // st7@1
827 int v4; // esi@3
828 int v5; // edi@4
829 int v6; // eax@4
830 int v7; // eax@4
831 BSPModel *v8; // ecx@4
832 unsigned __int8 v9; // zf@5
833 char v10; // sf@5
834 unsigned __int8 v11; // of@5
835 ODMFace *v12; // eax@6
836 __int16 v13; // cx@6
837 const char *v14; // eax@8
838 const char *v15; // edi@8
839 char *result; // eax@12
840 unsigned int v17; // eax@14
841 unsigned int v18; // [sp+Ch] [bp-20h]@1
842 int v19; // [sp+10h] [bp-1Ch]@1
843 int v20; // [sp+14h] [bp-18h]@1
844 char *v21; // [sp+18h] [bp-14h]@1
845 unsigned int pY; // [sp+1Ch] [bp-10h]@1
846 int v23; // [sp+20h] [bp-Ch]@1
847 int v24; // [sp+24h] [bp-8h]@1
848 int pX; // [sp+28h] [bp-4h]@1
849
850 v24 = pParty->vPosition.x;
851 v0 = pParty->vPosition.y;
852 v1 = pOutdoor->uNumBModels;
853 *(float *)&v23 = (double)(signed int)viewparams->uMinimapZoom * 0.000015258789;
854 v2 = 0;
855 v18 = pOutdoor->uNumBModels;
856 v21 = 0;
857 pMouse->GetClickPos((unsigned int *)&pX, &pY);
858 v3 = 1.0 / *(float *)&v23;
859 v23 = pX - 557;
860 v19 = (signed __int64)((double)(pX - 557) * v3 + (double)v24);
861 v20 = (signed __int64)((double)v0 - (double)(signed int)(pY - 74) * v3);
862 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor || (*(float *)&v23 = 0.0, (signed int)v1 <= 0) )
863 {
864 LABEL_14:
865 v17 = pMapStats->GetMapInfo(pCurrentMapName.data());
866 if ( v17 == v2 )
867 result = "No Maze Info for this maze on file!";
868 else
869 result = pMapStats->pInfos[v17].pName;
870 }
871 else
872 {
873 v4 = 0;
874 while ( 1 )
875 {
876 pX = pOutdoor->pBModels[v4].vBoundingCenter.x - v19;
877 pY = pOutdoor->pBModels[v4].vBoundingCenter.y - v20;
878 v5 = abs((signed)pY);
879 v6 = abs((signed)pX);
880 v7 = int_get_vector_length(v6, v5, v2);
881 v8 = &pOutdoor->pBModels[0];
882 if ( v7 < 2 * pOutdoor->pBModels[v4].sBoundingRadius )
883 {
884 v11 = __OFSUB__(pOutdoor->pBModels[v4].uNumFaces, v2);
885 v9 = pOutdoor->pBModels[v4].uNumFaces == v2;
886 v10 = ((pOutdoor->pBModels[v4].uNumFaces - v2) & 0x80000000u) != 0;
887 v24 = v2;
888 if ( !((unsigned __int8)(v10 ^ v11) | v9) )
889 {
890 do
891 {
892 v12 = &v8[v4].pFaces[v2 / 0x134u];
893 v13 = v12->sCogTriggeredID;
894 if ( v13 )
895 {
896 if ( !(BYTE2(v12->uAttributes) & 0x10) )
897 {
898 v14 = GetEventHintString(v13);
899 v15 = v14;
900 if ( v14 )
901 {
902 if ( _stricmp(v14, "") )
903 v21 = (char *)v15;
904 }
905 }
906 }
907 ++v24;
908 v8 = pOutdoor->pBModels;
909 v2 += 308;
910 }
911 while ( v24 < (signed int)pOutdoor->pBModels[v4].uNumFaces );
912 }
913 result = v21;
914 v2 = 0;
915 if ( v21 )
916 break;
917 }
918 ++v23;
919 ++v4;
920 if ( v23 >= (signed int)v18 )
921 goto LABEL_14;
922 }
923 }
924 return result;
925 }
926
927
928
929
930
931 //----- (0041D3B7) --------------------------------------------------------
932 void GameUI_CharacterQuickRecord_Draw(GUIWindow *window, Player *player)
933 {
934 //Player *pPlayer; // esi@1
935 int v6; // eax@5
936 int v7; // ebx@5
937 //unsigned int v8; // ecx@5
938 int v9; // ebx@5
939 //unsigned int v10; // eax@5
940 //int v11; // eax@5
941 //unsigned int v12; // ecx@5
942 Texture *v13; // eax@6
943 unsigned int v14; // eax@12
944 PlayerFrame *v15; // eax@12
945 //unsigned int v16; // eax@15
946 unsigned int v20; // eax@15
947 unsigned int v24; // eax@15
948 unsigned int v25; // eax@15
949 unsigned __int8 v28; // al@15
950 char *v29; // eax@16
951 __int64 v35; // ST38_8@22
952 int v36; // esi@22
953 unsigned int v38; // eax@22
954 char *v39; // eax@24
955 signed int uFramesetID; // [sp+20h] [bp-8h]@9
956 int uFramesetIDa; // [sp+20h] [bp-8h]@18
957
958 uint numActivePlayerBuffs = 0;
959 for (uint i = 0; i < 24; ++i)
960 if (player->pPlayerBuffs[i].uExpireTime > 0)
961 ++numActivePlayerBuffs;
962
963 v6 = pFontArrus->uFontHeight + 162;
964 v7 = (numActivePlayerBuffs - 1) * pFontArrus->uFontHeight;
965 v9 = v6 + v7;
966 window->uFrameHeight = v9;
967 window->uFrameZ = window->uFrameWidth + window->uFrameX - 1;
968 window->uFrameW = v9 + window->uFrameY - 1;
969 window->DrawMessageBox(0);
970
971 if (player->Eradicated())
972 v13 = pTexture_PlayerFaceEradicated;
973 else if (player->Dead())
974 v13 = pTexture_PlayerFaceDead;
975 else
976 {
977 uFramesetID = pPlayerFrameTable->GetFrameIdByExpression(player->expression);
978 if ( !uFramesetID )
979 uFramesetID = 1;
980 if ( player->expression == CHARACTER_EXPRESSION_21)
981 {
982 v15 = pPlayerFrameTable->GetFrameBy_y(&player->_expression21_frameset, &player->_expression21_animtime, pMiscTimer->uTimeElapsed);
983 }
984 else
985 {
986 v14 = pMiscTimer->Time();
987 v15 = pPlayerFrameTable->GetFrameBy_x(uFramesetID, v14);
988 }
989 player->field_1AA2 = v15->uTextureID - 1;
990 v13 = pTextures_PlayerFaces[(unsigned int)window->ptr_1C][v15->uTextureID - 1];
991 }
992
993 pRenderer->DrawTextureTransparent(window->uFrameX + 24, window->uFrameY + 24, v13);
994
995 sprintfex(pTmpBuf.data(), "\f%05d", ui_character_header_text_color);
996 sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[429], player->pName, pClassNames[player->classType]); // "%s the %s"
997 strcat(pTmpBuf.data(), pTmpBuf2.data());
998 strcat(pTmpBuf.data(), "\f00000\n");
999
1000 v20 = UI_GetHealthManaStringColor(player->sHealth, player->GetMaxHealth());
1001 sprintf(pTmpBuf2.data(), "%s : \f%05u%d\f00000 / %d\n",
1002 pGlobalTXT_LocalizationStrings[108], // "Hit Points"
1003 v20, player->sHealth, player->GetMaxHealth());
1004 strcat(pTmpBuf.data(), pTmpBuf2.data());
1005
1006 v24 = UI_GetHealthManaStringColor(player->sMana, player->GetMaxMana());
1007 sprintf(pTmpBuf2.data(), "%s : \f%05u%d\f00000 / %d\n",
1008 pGlobalTXT_LocalizationStrings[212], // "Spell Points"
1009 v24, player->sMana, player->GetMaxMana());
1010 strcat(pTmpBuf.data(), pTmpBuf2.data());
1011
1012 v25 = player->GetMajorConditionIdx();
1013 sprintf(pTmpBuf2.data(), "%s: \f%05d%s\f00000\n",
1014 pGlobalTXT_LocalizationStrings[47], // "Condition
1015 GetConditionDrawColor(v25), aCharacterConditionNames[v25]);
1016 strcat(pTmpBuf.data(), pTmpBuf2.data());
1017
1018 v28 = player->uQuickSpell;
1019 if ( v28 )
1020 v29 = pSpellStats->pInfos[v28].pShortName;
1021 else
1022 v29 = pGlobalTXT_LocalizationStrings[153];
1023 sprintfex(pTmpBuf2.data(), "%s: %s", pGlobalTXT_LocalizationStrings[172], v29); // "Quick Spell"
1024 strcat(pTmpBuf.data(), pTmpBuf2.data());
1025
1026 window->DrawText(pFontArrus, 120, 22, 0, pTmpBuf.data(), 0, 0, 0);
1027
1028 uFramesetIDa = 0;
1029 for (uint i = 0; i < 24; ++i)
1030 {
1031 auto buff = player->pPlayerBuffs + i;
1032 if (buff->uExpireTime > 0)
1033 {
1034 v35 = buff->uExpireTime - pParty->uTimePlayed;
1035 v36 = uFramesetIDa++ * pFontComic->uFontHeight + 134;
1036 v38 = ui_game_character_record_playerbuff_colors[i];
1037 window->DrawText(pFontComic, 52, v36, v38, aSpellNames[20 + i], 0, 0, 0);
1038 sub_41D20D_buff_remaining_time_string(v36, window, v35, pFontComic);
1039 }
1040 }
1041
1042 v39 = "";
1043 if ( uFramesetIDa == 0 )
1044 v39 = pGlobalTXT_LocalizationStrings[153]; // "None"
1045 sprintf(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[450], v39); // "Active Spells: %s"
1046 window->DrawText(pFontArrus, 14, 114, 0, pTmpBuf.data(), 0, 0, 0);
1047 }
1048
1049
1050
1051 //----- (0041A57E) --------------------------------------------------------
1052 void GameUI_QuickRef_Draw()
1053 {
1054 //unsigned int v0; // ebx@1
1055 //unsigned int v1; // eax@1
1056 //Player *pPlayer; // ebp@2
1057 //int v3; // eax@6
1058 //int v4; // edi@6
1059 unsigned int v5; // eax@7
1060 unsigned int v6; // edi@9
1061 unsigned int v7; // edi@11
1062 //signed int v8; // eax@13
1063 unsigned int v9; // eax@13
1064 unsigned int v10; // edi@13
1065 //int v11; // eax@15
1066 unsigned int v12; // eax@15
1067 unsigned int v13; // edi@15
1068 //int v14; // eax@17
1069 //int v15; // ST18_4@17
1070 //int v16; // ebx@17
1071 //int v17; // eax@17
1072 unsigned int v18; // eax@17
1073 unsigned int v19; // edi@17
1074 //int v20; // eax@19
1075 unsigned int v21; // edi@19
1076 char *v22; // eax@21
1077 unsigned int v23; // edi@21
1078 //int v24; // eax@23
1079 unsigned int v25; // edi@23
1080 char *v26; // eax@25
1081 unsigned int v27; // edi@25
1082 int v28; // ecx@27
1083 char *v29; // eax@27
1084 signed int v30; // edx@27
1085 unsigned int v31; // edi@31
1086 unsigned int v32; // edi@33
1087 const char *v33; // ST10_4@35
1088 unsigned int v34; // eax@35
1089 unsigned int v35; // edi@35
1090 //unsigned __int8 v36; // al@37
1091 char *v37; // eax@38
1092 int v38; // eax@41
1093 signed int v39; // edi@42
1094 //char *v40; // eax@45
1095 //unsigned int v41; // eax@45
1096 signed int v43; // [sp+10h] [bp-1Ch]@1
1097 unsigned int v44; // [sp+14h] [bp-18h]@2
1098 int v45; // [sp+18h] [bp-14h]@1
1099 //unsigned int v46; // [sp+1Ch] [bp-10h]@1
1100 //unsigned int v47; // [sp+20h] [bp-Ch]@1
1101 unsigned int v48; // [sp+24h] [bp-8h]@33
1102 //unsigned int v49; // [sp+28h] [bp-4h]@1
1103
1104 //v0 = 0;
1105 //v47 = TargetColor(0xFFu, 0xFFu, 0x9Bu);
1106 //v49 = TargetColor(0xFFu, 0, 0);
1107 //v46 = TargetColor(0, 0xFFu, 0);
1108 //v1 = pIcons_LOD->LoadTexture("quikref", TEXTURE_16BIT_PALETTE);
1109 pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("quikref", TEXTURE_16BIT_PALETTE));
1110 v43 = 0;
1111 v45 = LOBYTE(pFontArrus->uFontHeight) + 1;
1112 do
1113 {
1114 auto player = &pParty->pPlayers[v43];
1115 v44 = 94 * v43 + 89;
1116 if ( v43 == 0 )
1117 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, 0x12u, 0, pGlobalTXT_LocalizationStrings[149], 60, 0);//Name
1118 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 94 * v43 + 89, 0x12u, ui_character_header_text_color, player->pName, 84, 0);
1119 if ( v43 == 0 )
1120 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, 0x2Fu, 0, pGlobalTXT_LocalizationStrings[131], 60, 0); //Óðîâ.
1121 sprintf(pTmpBuf.data(), "%lu", player->GetActualLevel());
1122 if ( player->GetActualLevel() <= player->GetBaseLevel())
1123 v5 = player->GetExperienceDisplayColor();
1124 else
1125 v5 = ui_character_bonus_text_color;
1126 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, 0x2Fu, v5, pTmpBuf.data(), 84, 0);
1127 v6 = v45 + 47;
1128 if ( v43 == 0 )
1129 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v45 + 47, 0, pGlobalTXT_LocalizationStrings[41], 60, 0);//Êëàññ
1130 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v6, 0, pClassNames[player->classType], 84, 0);
1131 v7 = v45 + v6;
1132 if ( v43 == 0 )
1133 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v7, 0, pGlobalTXT_LocalizationStrings[107], 60, 0);//Çäîð.
1134 sprintf(pTmpBuf.data(), "%d", player->sHealth);
1135 v9 = UI_GetHealthManaStringColor(player->sHealth, player->GetMaxHealth());
1136 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v7, v9, pTmpBuf.data(), 84, 0);
1137 v10 = v45 + v7;
1138 if ( v43 == 0 )
1139 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v10, 0, pGlobalTXT_LocalizationStrings[209], 60, 0);//Ìàíà
1140 sprintf(pTmpBuf.data(), "%d", player->sMana);
1141 v12 = UI_GetHealthManaStringColor(player->sMana, player->GetMaxMana());
1142 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v10, v12, pTmpBuf.data(), 84, 0);
1143 v13 = v45 + v10;
1144 if ( v43 == 0 )
1145 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v13, 0, pGlobalTXT_LocalizationStrings[0], 60, 0);//Êëàññ áðîíè
1146 sprintf(pTmpBuf.data(), "%d", player->GetActualAC());
1147 v18 = UI_GetHealthManaStringColor(player->GetActualAC(), player->GetBaseAC());
1148 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v13, v18, pTmpBuf.data(), 84, 0);
1149 v19 = v45 + v13;
1150 if ( !v43 )
1151 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v19, 0, pGlobalTXT_LocalizationStrings[18], 60, 0);//Àòàêà
1152 sprintf(pTmpBuf.data(), "%+d", player->GetActualAttack(0));
1153 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v19, 0, pTmpBuf.data(), 84, 0);
1154 v21 = v45 + v19;
1155 if ( !v43 )
1156 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v21, 0, pGlobalTXT_LocalizationStrings[66], 60, 0);//Ïîâð.
1157 v22 = player->GetMeleeDamageString();
1158 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v21, 0, v22, 84, 0);
1159 v23 = v45 + v21;
1160 if ( !v43 )
1161 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v23, 0, pGlobalTXT_LocalizationStrings[203], 60, 0);// Ñòðåëÿòü
1162 sprintf(pTmpBuf.data(), "%+d", player->GetRangedAttack());
1163 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v23, 0, pTmpBuf.data(), 84, 0);
1164 v25 = v45 + v23;
1165 if ( !v43 )
1166 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v25, 0, pGlobalTXT_LocalizationStrings[66], 60, 0);//Ïîâð.
1167 v26 = player->GetRangedDamageString();
1168 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v25, 0, v26, 84, 0);
1169 v27 = v45 + v25;
1170 if ( !v43 )
1171 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v27, 0, pGlobalTXT_LocalizationStrings[205], 60, 0);//Íàâûêè
1172 v28 = 0;
1173 v29 = (char *)player->pActiveSkills;
1174 v30 = 36;
1175 do
1176 {
1177 if ( *(short *)v29 )
1178 ++v28;
1179 v29 += 2;
1180 --v30;
1181 }
1182 while ( v30 );
1183 sprintf(pTmpBuf.data(), "%lu", v28);
1184 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v27, 0, pTmpBuf.data(), 84, 0);
1185 v31 = v45 + v27;
1186 if ( !v43 )
1187 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v31, 0, pGlobalTXT_LocalizationStrings[168], 60, 0);//Î÷êè
1188 sprintf(pTmpBuf.data(), "%lu", player->uSkillPoints);
1189 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v31, player->uSkillPoints ? ui_character_bonus_text_color : ui_character_default_text_color, pTmpBuf.data(), 84, 0);
1190 v32 = v45 + v31;
1191 v48 = player->GetMajorConditionIdx();
1192 if ( !v43 )
1193 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v32, 0, pGlobalTXT_LocalizationStrings[45], 60, 0);//Ñîñò.
1194 v33 = aCharacterConditionNames[v48];
1195 v34 = GetConditionDrawColor(v48);
1196 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v32, v34, v33, 84, 0);
1197 v35 = v45 + v32;
1198 if ( !v43 )
1199 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v35, 0, pGlobalTXT_LocalizationStrings[170], 60, 0);//Á.Ïðèì.
1200 if (player->uQuickSpell)
1201 v37 = pSpellStats->pInfos[player->uQuickSpell].pShortName;
1202 else
1203 v37 = pGlobalTXT_LocalizationStrings[153];//Íåò
1204 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v35, 0, v37, 84, 0);
1205 ++v43;
1206 }
1207 while ( v43 < 4 );
1208
1209 v38 = GetPartyReputation();
1210 if ( v38 >= 0 )
1211 {
1212 if ( v38 <= 5 )
1213 v39 = ui_character_default_text_color;
1214 else
1215 v39 = ui_character_bonus_text_color_neg;
1216 }
1217 else
1218 v39 = ui_character_bonus_text_color;
1219
1220 sprintf(pTmpBuf.data(), "%s: \f%05d%s\f00000", pGlobalTXT_LocalizationStrings[180], v39, GetReputationString(v38));//Reputation
1221 pGUIWindow_CurrentMenu->DrawText(pFontArrus, 22, 323, 0, pTmpBuf.data(), 0, 0, 0);
1222
1223 sprintf(pTmpBuf.data(), "\r261%s: %d", pGlobalTXT_LocalizationStrings[84], pParty->GetPartyFame());// Fame Ñëàâà
1224 pGUIWindow_CurrentMenu->DrawText(pFontArrus, 0, 323, 0, pTmpBuf.data(), 0, 0, 0);
1225 }
1226
1227
1228
1229 //----- (0041AD6E) --------------------------------------------------------
1230 void GameUI_DrawRightPanelItems()
1231 {
1232 if (GameUI_RightPanel_BookFlashTimer > pParty->uTimePlayed)
1233 GameUI_RightPanel_BookFlashTimer = 0;
1234
1235 if (pParty->uTimePlayed - GameUI_RightPanel_BookFlashTimer > 128)
1236 {
1237 GameUI_RightPanel_BookFlashTimer = pParty->uTimePlayed;
1238
1239 static bool byte_50697C = false; // 50697C
1240 byte_50697C = !byte_50697C;
1241 if ( byte_50697C && pCurrentScreen != SCREEN_REST )
1242 {
1243 if (bFlashQuestBook) pRenderer->DrawTextureTransparent(493, 355, pIcons_LOD->GetTexture(uTextureID_ib_td1_A));
1244 if (bFlashAutonotesBook) pRenderer->DrawTextureTransparent(527, 353, pIcons_LOD->GetTexture(uTextureID_ib_td2_A));
1245 if (bFlashHistoryBook) pRenderer->DrawTextureTransparent(600, 361, pIcons_LOD->GetTexture(uTextureID_ib_td5_A));
1246 }
1247 else
1248 {
1249 pRenderer->DrawTextureRGB(468, 0, pTexture_RightFrame);
1250 GameUI_DrawHiredNPCs();
1251 }
1252 }
1253 }
1254
1255 //----- (0041AEBB) --------------------------------------------------------
1256 void GameUI_DrawFoodAndGold()
1257 {
1258 int v2; // esi@2
1259
1260 if ( uGameState != GAME_STATE_FINAL_WINDOW )
1261 {
1262 v2 = sub_44100D() != 0 ? 381 : 322;
1263 sprintf(pTmpBuf.data(), "\r087%lu", pParty->uNumFoodRations);
1264 pPrimaryWindow->DrawText(pFontSmallnum, 0, v2, uGameUIFontMain, pTmpBuf.data(), 0, 0, uGameUIFontShadow);
1265 sprintf(pTmpBuf.data(), "\r028%lu", pParty->uNumGold);
1266 pPrimaryWindow->DrawText(pFontSmallnum, 0, v2, uGameUIFontMain, pTmpBuf.data(), 0, 0, uGameUIFontShadow);
1267 }
1268 }
1269
1270
1271 //----- (0041B0C9) --------------------------------------------------------
1272 void GameUI_DrawLifeManaBars()
1273 {
1274 double v3; // st7@3
1275 double v7; // st7@25
1276 Texture *v9; // [sp-4h] [bp-30h]@10
1277 Texture *v10; // [sp+Ch] [bp-20h]@1
1278
1279
1280 v10 = pIcons_LOD->GetTexture(uTextureID_BarBlue);
1281
1282 for (uint i = 0; i < 4; ++i)
1283 {
1284 auto player = pParty->pPlayers + i;
1285
1286 if (player->sHealth > 0)
1287 {
1288 int v17 = 0;
1289 if (i == 2 || i == 3)
1290 v17 = 2;
1291
1292 v3 = (double)player->sHealth / (double)player->GetMaxHealth();
1293 if( v3 > 0.5 )
1294 {
1295 if ( v3 > 1.0 )
1296 v3 = 1.0;
1297 v9 = pIcons_LOD->GetTexture(uTextureID_BarGreen);
1298 }
1299 else if ( v3 > 0.25 )
1300 v9 = pIcons_LOD->GetTexture(uTextureID_BarYellow);
1301 else if ( v3 > 0.0 )
1302 v9 = pIcons_LOD->GetTexture(uTextureID_BarRed);
1303
1304
1305 if( v3 > 0.0 )
1306 {
1307 pRenderer->SetTextureClipRect(v17 + pHealthBarPos[i],
1308 (signed __int64)((1.0 - v3) * v9->uTextureHeight) + 402,
1309 v17 + pHealthBarPos[i] + v9->uTextureWidth,
1310 v9->uTextureHeight + 402);
1311
1312 pRenderer->DrawTextureIndexed(v17 + pHealthBarPos[i], 402, v9);
1313 pRenderer->ResetTextureClipRect();
1314 }
1315 }
1316
1317
1318 if (player->sMana > 0)
1319 {
1320 v7 = player->sMana / (double)player->GetMaxMana();
1321 if ( v7 > 1.0 )
1322 v7 = 1.0;
1323
1324 int v17 = 0;
1325 if (i == 2)
1326 v17 = 1;
1327
1328 pRenderer->SetTextureClipRect(v17 + pManaBarPos[i],
1329 (signed __int64)((1.0 - v7) * v10->uTextureHeight) + 402,
1330 v17 + pManaBarPos[i] + v10->uTextureWidth,
1331 v10->uTextureHeight + 402);
1332 pRenderer->DrawTextureIndexed(v17 + pManaBarPos[i], 402, v10);
1333 pRenderer->ResetTextureClipRect();
1334 }
1335 }
1336 }
1337
1338 //----- (0041B3B6) --------------------------------------------------------
1339 void GameUI_DrawRightPanel()
1340 {
1341 pRenderer->DrawTextureTransparent(pViewport->uViewportBR_X, 0,
1342 pIcons_LOD->GetTexture(uTextureID_right_panel));
1343 }
1344
1345 //----- (0041B3E2) --------------------------------------------------------
1346 void GameUI_DrawRightPanelFrames()
1347 {
1348 pRenderer->DrawTextureRGB(0, 0, pTexture_TopFrame);
1349 pRenderer->DrawTextureRGB(0, 8, pTexture_LeftFrame);
1350 pRenderer->DrawTextureRGB(468, 0, pTexture_RightFrame);
1351 pRenderer->DrawTextureRGB(0, 352, pTexture_BottomFrame);
1352 GameUI_DrawFoodAndGold();
1353 GameUI_DrawRightPanelItems();
1354 }
1355
1356
1357 //----- (0041C047) --------------------------------------------------------
1358 void GameUI_Footer_2()
1359 {
1360 char *v1; // edx@2
1361 int v5; // eax@5
1362
1363 pRenderer->DrawTextureRGB(0, 352, pTexture_StatusBar);
1364 if (GameUI_Footer_TimeLeft)
1365 v1 = GameUI_Footer_TimedString.data();
1366 else
1367 {
1368 if (!pFooterString[0])
1369 return;
1370 v1 = pFooterString.data();
1371 }
1372
1373 v5 = pFontLucida->AlignText_Center(450, v1);
1374 pPrimaryWindow->DrawText(pFontLucida, v5 + 11, 357, uGameUIFontMain, v1, 0, 0, uGameUIFontShadow);
1375 }
1376
1377 //----- (0041C0B8) --------------------------------------------------------
1378 void GameUI_SetFooterString(const char *pStr)
1379 {
1380 const char *v1; // esi@1
1381 int i; // eax@7
1382 int j; // eax@11
1383
1384 v1 = pStr;
1385 if ( pStr && strcmp(pStr, "test") && !IsBadStringPtrA(v1, 1) && (*v1 || GameUI_Footer_TimeLeft) )
1386 {
1387 if ( GameUI_Footer_TimeLeft )
1388 {
1389 for ( i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data());
1390 i > 450;
1391 i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()) )
1392 byte_5C3427[strlen(GameUI_Footer_TimedString.data())] = 0;
1393 }
1394 else
1395 {
1396 strcpy(pFooterString.data(), v1);
1397 for ( j = pFontLucida->GetLineWidth(pFooterString.data());
1398 j > 450;
1399 j = pFontLucida->GetLineWidth(pFooterString.data()) )
1400 GameUI_Footer_TimedString[strlen(pFooterString.data()) + 199] = 0;
1401 }
1402 }
1403 }
1404
1405 //----- (0041C179) --------------------------------------------------------
1406 void GameUI_Footer()
1407 {
1408 //unsigned int v0; // ebp@1
1409 char *v1; // edi@5
1410 int v2; // eax@5
1411 unsigned int v3; // esi@5
1412 size_t v4; // eax@6
1413 GUIFont *v5; // ecx@6
1414 int v6; // eax@9
1415 size_t v7; // eax@10
1416 GUIFont *v8; // ecx@10
1417 char v9; // zf@12
1418 //unsigned int v10; // ST08_4@13
1419 int v11; // eax@13
1420
1421 if ( pFooterString[0] || GameUI_Footer_TimeLeft || bForceDrawFooter )
1422 {
1423 pRenderer->DrawTextureRGB(0, 352u, pTexture_StatusBar);
1424 if ( GameUI_Footer_TimeLeft )
1425 {
1426 v1 = GameUI_Footer_TimedString.data();
1427 v2 = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data());
1428 v3 = 450;
1429 while ( v2 > 450 )
1430 {
1431 v4 = strlen(GameUI_Footer_TimedString.data());
1432 v5 = pFontLucida;
1433 byte_5C3427[v4] = 0;
1434 v2 = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data());
1435 }
1436 }
1437 else
1438 {
1439 v1 = pFooterString.data();
1440 v6 = pFontLucida->GetLineWidth(pFooterString.data());
1441 v3 = 450;
1442 while ( v6 > 450 )
1443 {
1444 v7 = strlen(pFooterString.data());
1445 v8 = pFontLucida;
1446 GameUI_Footer_TimedString[v7 + 199] = 0;
1447 v6 = pFontLucida->GetLineWidth(pFooterString.data());
1448 }
1449 }
1450 v9 = *v1 == 0;
1451 bForceDrawFooter = 0;
1452 if ( !v9 )
1453 {
1454 v11 = pFontLucida->AlignText_Center(v3, v1);
1455 pPrimaryWindow->DrawText(pFontLucida, v11 + 11, 357, uGameUIFontMain, v1, 0, 0, uGameUIFontShadow);
1456 }
1457 }
1458 }
1459 // 5C35BC: using guessed type int bForceDrawFooter;
1460
1461
1462 //----- (00420EFF) --------------------------------------------------------
1463 void __cdecl GameUI_WritePointedObjectStatusString()
1464 {
1465 int v1; // ebx@6
1466 GUIWindow *pWindow; // edi@7
1467 GUIButton *pButton; // ecx@11
1468 Player *pPlayer; // eax@19
1469 char v5; // cl@19
1470 unsigned int v6; // eax@19
1471 int v7; // ecx@19
1472 __int16 v8; // fps@23
1473 unsigned __int8 v9; // c0@23
1474 unsigned __int8 v10; // c3@23
1475 enum UIMessageType pMessageType1; // esi@24
1476 //int v12; // edx@25
1477 char *v13; // ecx@28
1478 int v14; // eax@41
1479 ItemGen *pItemGen; // ecx@44
1480 int v16; // ecx@46
1481 const char *v17; // eax@49
1482 signed int v18; // eax@55
1483 signed int v18b;
1484 signed int v19; // ecx@63
1485 BLVFace *pFace; // eax@69
1486 __int16 v21; // ax@70
1487 const char *v22; // eax@72
1488 LevelDecoration *v23; // ecx@75
1489 LevelDecoration *v24; // esi@75
1490 __int16 v25; // ax@75
1491 const char *v26; // ecx@79
1492 Actor *pActor; // ecx@82
1493 char *v28; // esi@82
1494 int v29; // eax@82
1495 signed int v30; // ecx@88
1496 const char *v31; // eax@91
1497 __int16 v32; // fps@109
1498 //unsigned __int8 v33; // c0@109
1499 //unsigned __int8 v34; // c3@109
1500 enum UIMessageType pMessageType2; // esi@110
1501 //int v36; // edx@111
1502 enum UIMessageType pMessageType3; // edx@117
1503 //int v38; // ecx@118
1504 const char *v39; // [sp-8h] [bp-E8h]@20
1505 char *v40; // [sp-8h] [bp-E8h]@83
1506 int v41; // [sp-4h] [bp-E4h]@20
1507 char Str1[200]; // [sp+Ch] [bp-D4h]@129
1508 unsigned int pX; // [sp+D4h] [bp-Ch]@1
1509 unsigned int pY; // [sp+D8h] [bp-8h]@1
1510 unsigned int v45; // [sp+DCh] [bp-4h]@21
1511
1512 v13 = nullptr;
1513
1514 pMouse->uPointingObjectID = 0;
1515 pMouse->GetClickPos(&pX, &pY);
1516 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 )
1517 return;
1518 if (pCurrentScreen == SCREEN_GAME)
1519 {
1520 if ( (signed int)pX > 467 || (signed int)pY > 351 )
1521 goto _click_on_game_ui;
1522 if ( pRenderer->pRenderD3D ) // inlined mm8::4C1E01
1523 {
1524 v18 = pGame->pVisInstance->get_picked_object_zbuf_val();
1525 if ( (signed int)pX < (signed int)pViewport->uScreen_TL_X
1526 || (signed int)pX > (signed int)pViewport->uScreen_BR_X
1527 || (signed int)pY < (signed int)pViewport->uScreen_TL_Y
1528 || (signed int)pY > (signed int)pViewport->uScreen_BR_Y )
1529 v18 = -1;
1530 if ( v18 == -1 )
1531 //goto LABEL_61;
1532 {
1533 pMouse->uPointingObjectID = 0;
1534 if ( pMouse->uPointingObjectID == 0 )
1535 {
1536 if ( uLastPointedObjectID != 0 )
1537 {
1538 pFooterString[0] = 0;
1539 bForceDrawFooter = 1;
1540 }
1541 }
1542 uLastPointedObjectID = pMouse->uPointingObjectID;
1543 return;
1544 }
1545 }
1546 else
1547 {
1548 v18 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]];
1549 }
1550 pMouse->uPointingObjectID = (unsigned __int16)v18;
1551 v19 = (signed)PID_ID(v18);
1552 if (PID_TYPE(v18) == OBJECT_Item)
1553 {
1554 v30 = v19;
1555 if ( pObjectList->pObjects[pSpriteObjects[v30].uObjectDescID].uFlags & 0x10 )
1556 //goto LABEL_73;
1557 {
1558 pMouse->uPointingObjectID = 0;
1559 //goto LABEL_50;
1560 uLastPointedObjectID = 1;
1561 if ( pMouse->uPointingObjectID == 0 )
1562 {
1563 if ( uLastPointedObjectID != 0 )
1564 {
1565 pFooterString[0] = 0;
1566 bForceDrawFooter = 1;
1567 }
1568 }
1569 uLastPointedObjectID = pMouse->uPointingObjectID;
1570 return;
1571 }
1572 if ( v18 >= (signed int)0x2000000u || pParty->pPickedItem.uItemID )
1573 {
1574 v22 = pSpriteObjects[v30].stru_24.GetDisplayName();
1575 //LABEL_93:
1576 v26 = v22;
1577 //goto LABEL_87;
1578 GameUI_SetFooterString(v26);
1579 if ( pMouse->uPointingObjectID == 0 )
1580 {
1581 if ( uLastPointedObjectID != 0 )
1582 {
1583 pFooterString[0] = 0;
1584 bForceDrawFooter = 1;
1585 }
1586 }
1587 uLastPointedObjectID = pMouse->uPointingObjectID;
1588 return;
1589 }
1590 v31 = pSpriteObjects[v30].stru_24.GetDisplayName();
1591 v28 = pTmpBuf.data();
1592 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[470], v31);// "Get %s"
1593 }
1594 else
1595 {
1596 if (PID_TYPE(v18) != OBJECT_Actor)
1597 {
1598 if (PID_TYPE(v18) == OBJECT_Decoration)
1599 {
1600 v23 = &pLevelDecorations[v19];
1601 v24 = v23;
1602 v25 = v23->field_16_event_id;
1603 if ( !v25 )
1604 {
1605 if ( v23->IsInteractive() )
1606 v26 = pNPCTopics[stru_5E4C90._decor_events[v24->_idx_in_stru123 - 75] + 379].pTopic;
1607 else
1608 v26 = pDecorationList->pDecorations[v24->uDecorationDescID].field_20;
1609 //goto LABEL_87;
1610 GameUI_SetFooterString(v26);
1611 if ( pMouse->uPointingObjectID == 0 )
1612 {
1613 if ( uLastPointedObjectID != 0 )
1614 {
1615 pFooterString[0] = 0;
1616 bForceDrawFooter = 1;
1617 }
1618 }
1619 uLastPointedObjectID = pMouse->uPointingObjectID;
1620 return;
1621 }
1622 v22 = GetEventHintString(v25);
1623 if ( !v22 )
1624 //goto _return;
1625 {
1626 if ( pMouse->uPointingObjectID == 0 )
1627 {
1628 if ( uLastPointedObjectID != 0 )
1629 {
1630 pFooterString[0] = 0;
1631 bForceDrawFooter = 1;
1632 }
1633 }
1634 uLastPointedObjectID = pMouse->uPointingObjectID;
1635 return;
1636 }
1637 //goto LABEL_93;
1638 v26 = v22;
1639 //goto LABEL_87;
1640 GameUI_SetFooterString(v26);
1641 if ( pMouse->uPointingObjectID == 0 )
1642 {
1643 if ( uLastPointedObjectID != 0 )
1644 {
1645 pFooterString[0] = 0;
1646 bForceDrawFooter = 1;
1647 }
1648 }
1649 uLastPointedObjectID = pMouse->uPointingObjectID;
1650 return;
1651 }
1652 if (PID_TYPE(v18) == OBJECT_BModel)
1653 {
1654 if ( HIWORD(v18) < 512)
1655 {
1656 if ( uCurrentlyLoadedLevelType != LEVEL_Indoor)
1657 {
1658 v18b = (signed int)(unsigned __int16)v18 >> 9;
1659 v21 = pOutdoor->pBModels[v18b].pFaces[v19 & 0x3F].sCogTriggeredID;
1660 //goto LABEL_71;
1661 if ( !v21 || (v22 = GetEventHintString(v21)) == 0 )
1662 //goto LABEL_73;
1663 {
1664 pMouse->uPointingObjectID = 0;
1665 //goto LABEL_50;
1666 uLastPointedObjectID = 1;
1667 if ( pMouse->uPointingObjectID == 0 )
1668 {
1669 if ( uLastPointedObjectID != 0 )
1670 {
1671 pFooterString[0] = 0;
1672 bForceDrawFooter = 1;
1673 }
1674 }
1675 uLastPointedObjectID = pMouse->uPointingObjectID;
1676 return;
1677 }
1678 //goto LABEL_93;
1679 v26 = v22;
1680 //goto LABEL_87;
1681 GameUI_SetFooterString(v26);
1682 if ( pMouse->uPointingObjectID == 0 )
1683 {
1684 if ( uLastPointedObjectID != 0 )
1685 {
1686 pFooterString[0] = 0;
1687 bForceDrawFooter = 1;
1688 }
1689 }
1690 uLastPointedObjectID = pMouse->uPointingObjectID;
1691 return;
1692 }
1693 pFace = &pIndoor->pFaces[v19];
1694 if ( BYTE3(pFace->uAttributes) & 6 )
1695 {
1696 v21 = pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID;
1697 //LABEL_71:
1698 if ( !v21 || (v22 = GetEventHintString(v21)) == 0 )
1699 //goto LABEL_73;
1700 {
1701 pMouse->uPointingObjectID = 0;
1702 //goto LABEL_50;
1703 uLastPointedObjectID = 1;
1704 if ( pMouse->uPointingObjectID == 0 )
1705 {
1706 if ( uLastPointedObjectID != 0 )
1707 {
1708 pFooterString[0] = 0;
1709 bForceDrawFooter = 1;
1710 }
1711 }
1712 uLastPointedObjectID = pMouse->uPointingObjectID;
1713 return;
1714 }
1715 //goto LABEL_93;
1716 v26 = v22;
1717 //goto LABEL_87;
1718 GameUI_SetFooterString(v26);
1719 if ( pMouse->uPointingObjectID == 0 )
1720 {
1721 if ( uLastPointedObjectID != 0 )
1722 {
1723 pFooterString[0] = 0;
1724 bForceDrawFooter = 1;
1725 }
1726 }
1727 uLastPointedObjectID = pMouse->uPointingObjectID;
1728 return;
1729 }
1730 }
1731 //LABEL_73:
1732 pMouse->uPointingObjectID = 0;
1733 //goto LABEL_50;
1734 uLastPointedObjectID = 1;
1735 if ( pMouse->uPointingObjectID == 0 )
1736 {
1737 if ( uLastPointedObjectID != 0 )
1738 {
1739 pFooterString[0] = 0;
1740 bForceDrawFooter = 1;
1741 }
1742 }
1743 uLastPointedObjectID = pMouse->uPointingObjectID;
1744 return;
1745 }
1746 //LABEL_61:
1747 pMouse->uPointingObjectID = 0;
1748 //goto _return;
1749 if ( pMouse->uPointingObjectID == 0 )
1750 {
1751 if ( uLastPointedObjectID != 0 )
1752 {
1753 pFooterString[0] = 0;
1754 bForceDrawFooter = 1;
1755 }
1756 }
1757 uLastPointedObjectID = pMouse->uPointingObjectID;
1758 return;
1759 }
1760 if ( v18 >= 335544320 )
1761 //goto LABEL_61;
1762 {
1763 pMouse->uPointingObjectID = 0;
1764 if ( pMouse->uPointingObjectID == 0 )
1765 {
1766 if ( uLastPointedObjectID != 0 )
1767 {
1768 pFooterString[0] = 0;
1769 bForceDrawFooter = 1;
1770 }
1771 }
1772 uLastPointedObjectID = pMouse->uPointingObjectID;
1773 return;
1774 }
1775 pActor = &pActors[v19];
1776 v28 = pTmpBuf.data();
1777 v29 = pActor->dword_000334_unique_name;
1778 if ( v29 )
1779 v40 = pMonsterStats->pPlaceStrings[v29];
1780 else
1781 v40 = pMonsterStats->pInfos[pActor->pMonsterInfo.uID].pName;
1782 strncpy(pTmpBuf.data(), v40, 0x7D0u);
1783 }
1784 v26 = v28;
1785 //LABEL_87:
1786 GameUI_SetFooterString(v26);
1787 //goto _return;
1788 if ( pMouse->uPointingObjectID == 0 )
1789 {
1790 if ( uLastPointedObjectID != 0 )
1791 {
1792 pFooterString[0] = 0;
1793 bForceDrawFooter = 1;
1794 }
1795 }
1796 uLastPointedObjectID = pMouse->uPointingObjectID;
1797 return;
1798 }
1799 v1 = uNumVisibleWindows;
1800 if ( uNumVisibleWindows > 0 )
1801 {
1802 while ( 1 ) // some other fullscreen ui
1803 {
1804 pWindow = &pWindowList[pVisibleWindowsIdxs[v1] - 1];
1805 if ( (signed int)pX >= (signed int)pWindow->uFrameX
1806 && (signed int)pX <= (signed int)pWindow->uFrameZ
1807 && (signed int)pY >= (signed int)pWindow->uFrameY
1808 && (signed int)pY <= (signed int)pWindow->uFrameW )
1809 {
1810 for ( pButton = pWindow->pControlsHead; ; pButton = pButton->pNext )
1811 {
1812 if ( !pButton )
1813 break;
1814 if ( pButton->uButtonType == 1 )
1815 {
1816 if ( (signed int)pX >= (signed int)pButton->uX
1817 && (signed int)pX <= (signed int)pButton->uZ
1818 && (signed int)pY >= (signed int)pButton->uY
1819 && (signed int)pY <= (signed int)pButton->uW )
1820 {
1821 //LABEL_24:
1822 pMessageType1 = (UIMessageType)pButton->field_1C;
1823 if ( pMessageType1 )
1824 {
1825 pMessageQueue_50CBD0->AddMessage(pMessageType1, pButton->msg_param, 0);
1826 }
1827 //LABEL_28:
1828 v13 = pButton->pButtonName;
1829 //_set_status_and_ret:
1830 GameUI_SetFooterString(v13);
1831 //LABEL_131:
1832 uLastPointedObjectID = 1;
1833 return;
1834 }
1835 }
1836 else
1837 {
1838 if ( pButton->uButtonType == 2 )
1839 {
1840 v45 = pX - pButton->uX;
1841 v45 = pY - pButton->uY;
1842 if ( (double)(signed int)pButton->uWidth != 0.0 )
1843 {
1844 if ( (double)(signed int)pButton->uHeight != 0.0 )
1845 {
1846 pMessageType1 = (UIMessageType)pButton->field_1C;
1847 if ( pMessageType1 )
1848 {
1849 pMessageQueue_50CBD0->AddMessage(pMessageType1, pButton->msg_param, 0);
1850 }
1851 v13 = pButton->pButtonName;
1852 GameUI_SetFooterString(v13);
1853 uLastPointedObjectID = 1;
1854 return;
1855 //}
1856 }
1857 }
1858 }
1859 else // click on skill
1860 {
1861 if ( pButton->uButtonType == 3
1862 && (signed int)pX >= (signed int)pButton->uX
1863 && (signed int)pX <= (signed int)pButton->uZ
1864 && (signed int)pY >= (signed int)pButton->uY
1865 && (signed int)pY <= (signed int)pButton->uW )
1866 {
1867 //LABEL_19:
1868 pPlayer = pPlayers[uActiveCharacter];
1869 v5 = LOBYTE(pPlayer->pActiveSkills[pButton->msg_param]);
1870 v6 = pPlayer->uSkillPoints;
1871 v7 = (v5 & 0x3F) + 1;
1872 if ( v6 < v7 )
1873 {
1874 v41 = v7 - v6;
1875 v39 = pGlobalTXT_LocalizationStrings[469];// "You need %d more Skill Points to advance here"
1876 }
1877 else
1878 {
1879 v41 = v7;
1880 v39 = pGlobalTXT_LocalizationStrings[468];// "Clicking here will spend %d Skill Points"
1881 }
1882 sprintf(Str1, v39, v41);
1883 v13 = Str1;
1884 //goto _set_status_and_ret;
1885 GameUI_SetFooterString(v13);
1886 uLastPointedObjectID = 1;
1887 return;
1888 }
1889 }
1890 }
1891 }
1892 }
1893 if ( pWindow->uFrameHeight == 480 )
1894 break;
1895 --v1;
1896 if ( v1 <= 0 )
1897 {
1898 break;
1899 }
1900 }
1901 }
1902 if ( uNumVisibleWindows <= 0 || (uNumVisibleWindows > 0 && pWindow->uFrameHeight != 480 && v1 <= 0))
1903 {
1904 if ( pCurrentScreen == SCREEN_CHEST )
1905 {
1906 sub_42038D();
1907 //goto _return;
1908 if ( pMouse->uPointingObjectID == 0 )
1909 {
1910 if ( uLastPointedObjectID != 0 )
1911 {
1912 pFooterString[0] = 0;
1913 bForceDrawFooter = 1;
1914 }
1915 }
1916 uLastPointedObjectID = pMouse->uPointingObjectID;
1917 return;
1918 }
1919 if ( pCurrentScreen == SCREEN_HOUSE )
1920 {
1921 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD
1922 || (v16 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]], v16 == 0)
1923 || v16 == -65536 )
1924 //goto _return;
1925 {
1926 if ( pMouse->uPointingObjectID == 0 )
1927 {
1928 if ( uLastPointedObjectID != 0 )
1929 {
1930 pFooterString[0] = 0;
1931 bForceDrawFooter = 1;
1932 }
1933 }
1934 uLastPointedObjectID = pMouse->uPointingObjectID;
1935 return;
1936 }
1937 pItemGen = (ItemGen *)((char *)&pParty->pPickedItem + 36 * (v16 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 4);
1938 //LABEL_49:
1939 v17 = pItemGen->GetDisplayName();
1940 GameUI_SetFooterString(v17);
1941 //LABEL_50:
1942 uLastPointedObjectID = 1;
1943 //_return:
1944 if ( pMouse->uPointingObjectID == 0 )
1945 {
1946 if ( uLastPointedObjectID != 0 )
1947 {
1948 pFooterString[0] = 0;
1949 bForceDrawFooter = 1;
1950 }
1951 }
1952 uLastPointedObjectID = pMouse->uPointingObjectID;
1953 return;
1954 }
1955 if ( (signed int)pY < 350 )
1956 {
1957 v14 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]];
1958 if ( v14 == 0 || v14 == -65536 || (unsigned int)v14 >= 0x1388 )
1959 //goto _return;
1960 {
1961 if ( pMouse->uPointingObjectID == 0 )
1962 {
1963 if ( uLastPointedObjectID != 0 )
1964 {
1965 pFooterString[0] = 0;
1966 bForceDrawFooter = 1;
1967 }
1968 }
1969 uLastPointedObjectID = pMouse->uPointingObjectID;
1970 return;
1971 }
1972 pItemGen = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[v14-1];
1973 //goto LABEL_49;
1974 v17 = pItemGen->GetDisplayName();
1975 GameUI_SetFooterString(v17);
1976 uLastPointedObjectID = 1;
1977 if ( pMouse->uPointingObjectID == 0 )
1978 {
1979 if ( uLastPointedObjectID != 0 )
1980 {
1981 pFooterString[0] = 0;
1982 bForceDrawFooter = 1;
1983 }
1984 }
1985 uLastPointedObjectID = pMouse->uPointingObjectID;
1986 return;
1987 }
1988 _click_on_game_ui:
1989 if ( (signed int)pX >= (signed int)pWindowList[0].uFrameX
1990 && (signed int)pX <= (signed int)pWindowList[0].uFrameZ
1991 && (signed int)pY >= (signed int)pWindowList[0].uFrameY
1992 && (signed int)pY <= (signed int)pWindowList[0].uFrameW )
1993 {
1994 for ( pButton = pWindowList[0].pControlsHead; pButton != (GUIButton *)0; pButton = pButton->pNext )
1995 {
1996 if ( pButton->uButtonType == 1 )
1997 {
1998 if ( (signed int)pX >= (signed int)pButton->uX
1999 && (signed int)pX <= (signed int)pButton->uZ
2000 && (signed int)pY >= (signed int)pButton->uY
2001 && (signed int)pY <= (signed int)pButton->uW )
2002 {
2003 pMessageType3 = (UIMessageType)pButton->field_1C;
2004 if ( pMessageType3 == 0 ) // For books
2005 //goto LABEL_28;
2006 {
2007 v13 = pButton->pButtonName;
2008 GameUI_SetFooterString(v13);
2009 uLastPointedObjectID = 1;
2010 return;
2011 }
2012
2013 pMessageQueue_50CBD0->AddMessage(pMessageType3, pButton->msg_param, 0);
2014 //goto LABEL_131;
2015 uLastPointedObjectID = 1;
2016 return;
2017 }
2018 }
2019 else
2020 {
2021 if ( pButton->uButtonType == 2 )
2022 {
2023 v45 = pX - pButton->uX;
2024 v45 = pY - pButton->uY;
2025
2026 if (pX >= pButton->uX && pX <= pButton->uZ &&
2027 pY >= pButton->uY && pY <= pButton->uW)
2028 if ( (double)(signed int)pButton->uWidth != 0.0 )
2029 {
2030 if ( (double)(signed int)pButton->uHeight != 0.0 )
2031 {
2032 //UNDEF(v32);
2033 //if ( v33 | v34 )
2034 //{
2035 pMessageType2 = (UIMessageType)pButton->field_1C;
2036 if ( pMessageType2 != 0 )
2037 pMessageQueue_50CBD0->AddMessage(pMessageType2, pButton->msg_param, 0);
2038
2039 //goto LABEL_28;
2040 v13 = pButton->pButtonName;
2041 GameUI_SetFooterString(v13);
2042 uLastPointedObjectID = 1;
2043 return;
2044 //}
2045 }
2046 }
2047 }
2048 else
2049 {
2050 if ( pButton->uButtonType == 3
2051 && (signed int)pX >= (signed int)pButton->uX
2052 && (signed int)pX <= (signed int)pButton->uZ
2053 && (signed int)pY >= (signed int)pButton->uY
2054 && (signed int)pY <= (signed int)pButton->uW )
2055 //goto LABEL_19;
2056 {
2057 pPlayer = pPlayers[uActiveCharacter];
2058 v5 = LOBYTE(pPlayer->pActiveSkills[pButton->msg_param]);
2059 v6 = pPlayer->uSkillPoints;
2060 v7 = (v5 & 0x3F) + 1;
2061 if ( v6 < v7 )
2062 {
2063 v41 = v7 - v6;
2064 v39 = pGlobalTXT_LocalizationStrings[469];// "You need %d more Skill Points to advance here"
2065 }
2066 else
2067 {
2068 v41 = v7;
2069 v39 = pGlobalTXT_LocalizationStrings[468];// "Clicking here will spend %d Skill Points"
2070 }
2071 sprintf(Str1, v39, v41);
2072 v13 = Str1;
2073 //goto _set_status_and_ret;
2074 GameUI_SetFooterString(v13);
2075 uLastPointedObjectID = 1;
2076 return;
2077 }
2078 }
2079 }
2080 }
2081 }
2082 pMouse->uPointingObjectID = sub_46A99B();
2083 //goto _return;
2084 if ( pMouse->uPointingObjectID == 0 )
2085 {
2086 if ( uLastPointedObjectID != 0 )
2087 {
2088 pFooterString[0] = 0;
2089 bForceDrawFooter = 1;
2090 }
2091 }
2092 uLastPointedObjectID = pMouse->uPointingObjectID;
2093 return;
2094 }
2095 }
2096
2097
2098 //----- (0044158F) --------------------------------------------------------
2099 void GameUI_DrawCharacterSelectionFrame()
2100 {
2101 if ( uActiveCharacter )
2102 pRenderer->DrawTextureTransparent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[uActiveCharacter - 1] - 9, 380,
2103 pIcons_LOD->GetTexture(uTextureID_GameUI_CharSelectionFrame));
2104 }
2105
2106
2107
2108 //----- (0044162D) --------------------------------------------------------
2109 void GameUI_DrawPartySpells()
2110 {
2111 unsigned int v0; // ebp@1
2112 //signed int v1; // edi@1
2113 //int v2; // eax@2
2114 //int v3; // ecx@5
2115 //__int16 *v4; // ebx@25
2116 //Player *v5; // edi@26
2117 //unsigned int v6; // [sp-4h] [bp-1Ch]@11
2118 Texture *v7; // [sp-4h] [bp-1Ch]@12
2119 //unsigned int v8; // [sp-4h] [bp-1Ch]@20
2120 Texture *v9; // [sp-4h] [bp-1Ch]@21
2121 //Player **v10; // [sp+10h] [bp-8h]@25
2122
2123 v0 = (signed __int64)((double)GetTickCount() * 0.050000001);
2124 //v1 = 0;
2125 for (uint i = 0; i < 14; ++i)
2126 {
2127 //v2 = byte_4E5DD8[v1];
2128 if (pParty->pPartyBuffs[byte_4E5DD8[i]].uExpireTime)
2129 {
2130 auto tex = pIcons_LOD->GetTexture(pTextureIDs_PartyBuffIcons[i]);
2131 //v3 = pTextureIDs_PartyBuffIcons[i];
2132 pRenderer->_4A65CC(pPartySpellbuffsUI_XYs[i][0],
2133 pPartySpellbuffsUI_XYs[i][1], tex, tex,
2134 v0 + 20 * pPartySpellbuffsUI_smthns[i], 0, 63);
2135 }
2136 //++v1;
2137 }
2138 //while ( v1 < 14 );
2139
2140 if (pCurrentScreen == SCREEN_GAME || pCurrentScreen == SCREEN_NPC_DIALOGUE)
2141 {
2142 if (pParty->FlyActive())
2143 {
2144 if ( pParty->bFlying )
2145 v7 = pIcons_LOD->GetTexture(pIconsFrameTable->GetFrame(uIconIdx_FlySpell, v0)->uTextureID);
2146 else
2147 v7 = pIcons_LOD->GetTexture(pIconsFrameTable->GetFrame(uIconIdx_FlySpell, 0)->uTextureID);
2148 if ( pRenderer->pRenderD3D )
2149 pRenderer->DrawTextureIndexed(8, 8, v7);
2150 else
2151 pRenderer->DrawTextureTransparent(8, 8, v7);
2152 }
2153 if (pParty->WaterWalkActive())
2154 {
2155 if ( pParty->uFlags & PARTY_FLAGS_1_STANDING_ON_WATER)
2156 v9 = pIcons_LOD->GetTexture(pIconsFrameTable->GetFrame(uIconIdx_WaterWalk, v0)->uTextureID);
2157 else
2158 v9 = pIcons_LOD->GetTexture(pIconsFrameTable->GetFrame(uIconIdx_WaterWalk, 0)->uTextureID);
2159 if ( pRenderer->pRenderD3D )
2160 pRenderer->DrawTextureIndexed(396u, 8u, v9);
2161 else
2162 pRenderer->DrawTextureTransparent(396u, 8u, v9);
2163 }
2164 }
2165
2166 for (uint i = 0; i < 4; ++i)
2167 {
2168 auto player = pParty->pPlayers + i;
2169
2170 if (player->pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].uExpireTime)
2171 pRenderer->DrawTextureIndexed(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72, 427, pIcons_LOD->GetTexture(uTextureID_PlayerBuff_Hammerhands));
2172 if (player->pPlayerBuffs[PLAYER_BUFF_BLESS].uExpireTime)
2173 pRenderer->DrawTextureIndexed(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72, 393, pIcons_LOD->GetTexture(uTextureID_PlayerBuff_Bless));
2174 if (player->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime)
2175 pRenderer->DrawTextureIndexed(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72, 410, pIcons_LOD->GetTexture(uTextureID_PlayerBuff_Preservation));
2176 if (player->pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].uExpireTime)
2177 pRenderer->DrawTextureIndexed(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72, 444, pIcons_LOD->GetTexture(uTextureID_PlayerBuff_PainReflection));
2178 }
2179 }
2180
2181
2182
2183 //----- (004921C1) --------------------------------------------------------
2184 void GameUI_DrawPortraits(unsigned int _this)
2185 {
2186 Texture *pFace; // eax@10
2187 unsigned int v7; // eax@17
2188 PlayerFrame *pFrame; // eax@21
2189 unsigned int v9; // eax@27
2190 bool v10; // eax@33
2191 bool v11; // edi@40
2192 bool v12; // edx@43
2193 bool v13; // ecx@46
2194 int v16; // eax@57
2195 int v19; // eax@62
2196 Texture *pPortrait; // [sp-4h] [bp-1Ch]@27
2197 unsigned int v22; // [sp+14h] [bp-4h]@1
2198
2199 v22 = _this;
2200 if ( qword_A750D8 )
2201 {
2202 qword_A750D8 -= (signed int)pMiscTimer->uTimeElapsed;
2203 if ( qword_A750D8 <= 0 )
2204 {
2205 if ( pPlayers[word_A750E2]->CanAct() )
2206 pPlayers[word_A750E2]->PlaySound((PlayerSpeech)word_A750E0, 0);
2207 qword_A750D8 = 0i64;
2208 }
2209 }
2210
2211 for (uint i = 0; i < 4; ++i)
2212 {
2213 auto pPlayer = pParty->pPlayers + i;
2214
2215 if (pPlayer->Eradicated())
2216 {
2217 pFace = pTexture_PlayerFaceEradicated;
2218 pPortrait = pFace;
2219 v9 = pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i];
2220 if ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime )
2221 pRenderer->_4A6E7E(v9, 0x183u, pPortrait);
2222 else
2223 pRenderer->DrawTextureTransparent(v9 + 1, 0x184u, pPortrait);
2224 auto _v1 = 0;
2225 v10 = pPlayer->pPlayerBuffs[14].uExpireTime > 0;
2226 if (pPlayer->pPlayerBuffs[1].uExpireTime > 0)
2227 _v1 = 1;
2228 v11 = pPlayer->pPlayerBuffs[8].uExpireTime > 0;
2229 v12 = pPlayer->pPlayerBuffs[7].uExpireTime > 0;
2230 v13 = pPlayer->pPlayerBuffs[13].uExpireTime > 0;
2231 if ( v13 | v12 | v11 | _v1 | v10 )
2232 sub_441A4E(i);
2233 continue;
2234 }
2235 if (pPlayer->Dead())
2236 {
2237 pFace = pTexture_PlayerFaceDead;
2238 pPortrait = pFace;
2239 v9 = pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i];
2240 if ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime )
2241 pRenderer->_4A6E7E(v9, 0x183u, pPortrait);
2242 else
2243 pRenderer->DrawTextureTransparent(v9 + 1, 0x184u, pPortrait);
2244 auto _v1 = 0;
2245 v10 = pPlayer->pPlayerBuffs[14].uExpireTime > 0;
2246 if (pPlayer->pPlayerBuffs[1].uExpireTime > 0)
2247 _v1 = 1;
2248 v11 = pPlayer->pPlayerBuffs[8].uExpireTime > 0;
2249 v12 = pPlayer->pPlayerBuffs[7].uExpireTime > 0;
2250 v13 = pPlayer->pPlayerBuffs[13].uExpireTime > 0;
2251 if ( v13 | v12 | v11 | _v1 | v10 )
2252 sub_441A4E(i);
2253 continue;
2254 }
2255 v7 = 0;
2256 for (uint j = 0; j < pPlayerFrameTable->uNumFrames; ++j)
2257 if (pPlayerFrameTable->pFrames[j].expression == pPlayer->expression)
2258 {
2259 v7 = j;
2260 break;
2261 }
2262 if ( v7 == 0 )
2263 v7 = 1;
2264 if (pPlayer->expression == CHARACTER_EXPRESSION_21)
2265 pFrame = pPlayerFrameTable->GetFrameBy_y(&pPlayer->_expression21_frameset, &pPlayer->_expression21_animtime, pMiscTimer->uTimeElapsed);
2266 else
2267 pFrame = pPlayerFrameTable->GetFrameBy_x(v7, pPlayer->uExpressionTimePassed);
2268 if (pPlayer->field_1AA2 != pFrame->uTextureID - 1 || v22 )
2269 {
2270 pPlayer->field_1AA2 = pFrame->uTextureID - 1;
2271 pFace = (Texture *)pTextures_PlayerFaces[i][pPlayer->field_1AA2];//pFace = (Texture *)pTextures_PlayerFaces[i][pFrame->uTextureID];
2272 pPortrait = pFace;
2273 v9 = pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i];
2274 if ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime )
2275 pRenderer->_4A6E7E(v9, 0x183u, pPortrait);
2276 else
2277 pRenderer->DrawTextureTransparent(v9 + 1, 0x184u, pPortrait);
2278 auto _v1 = 0;
2279 v10 = pPlayer->pPlayerBuffs[14].uExpireTime > 0;
2280 if (pPlayer->pPlayerBuffs[1].uExpireTime > 0)
2281 _v1 = 1;
2282 v11 = pPlayer->pPlayerBuffs[8].uExpireTime > 0;
2283 v12 = pPlayer->pPlayerBuffs[7].uExpireTime > 0;
2284 v13 = pPlayer->pPlayerBuffs[13].uExpireTime > 0;
2285 if ( v13 | v12 | v11 | _v1 | v10 )
2286 sub_441A4E(i);
2287 continue;
2288 }
2289 }
2290 if ( pParty->bTurnBasedModeOn == 1 )
2291 {
2292 if ( pTurnEngine->field_4 != 1 )
2293 {
2294 if (PID_TYPE(pTurnEngine->pQueue[0].uPackedID) == OBJECT_Player)
2295 {
2296 //v14 = 0;
2297 if ( pTurnEngine->uActorQueueSize > 0 )
2298 {
2299 //v15 = (char *)pTurnEngine->pQueue;
2300 for (uint i = 0; i < pTurnEngine->uActorQueueSize; ++i)
2301 {
2302 auto pElem = pTurnEngine->pQueue + i;
2303
2304 if (PID_TYPE(pElem->uPackedID) != OBJECT_Player)
2305 break;
2306 v16 = dword_5079D0;
2307 if ( pParty->uFlags & 0x10 )
2308 {
2309 v16 = dword_5079CC;
2310 }
2311 else
2312 {
2313 if ( pParty->uFlags & 0x20 )
2314 v16 = dword_5079C8;
2315 }
2316 pRenderer->DrawTextureTransparent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[PID_ID(pElem->uPackedID)] - 4, 0x181u, pIcons_LOD->GetTexture(v16));
2317 }
2318 }
2319 }
2320 }
2321 }
2322 else
2323 {
2324 for (uint i = 0; i < 4; ++i)
2325 {
2326 auto pPlayer = pParty->pPlayers + i;
2327 if (pPlayer->CanAct() && !pPlayer->uTimeToRecovery)
2328 {
2329 v19 = dword_5079D0;
2330 if ( pParty->uFlags & 0x10 )
2331 {
2332 v19 = dword_5079CC;
2333 }
2334 else
2335 {
2336 if ( pParty->uFlags & 0x20 )
2337 v19 = dword_5079C8;
2338 }
2339 pRenderer->DrawTextureTransparent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] - 4, 0x181u, pIcons_LOD->GetTexture(v19));
2340 }
2341 }
2342 }
2343 }
2344
2345 //----- (00441D38) --------------------------------------------------------
2346 void GameUI_DrawMinimap(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW, unsigned int uZoom, unsigned int bRedrawOdmMinimap)
2347 {
2348 int uHeight; // ebx@6
2349 __int16 v11; // cx@11
2350 unsigned int v14; // ebx@23
2351 int v15; // eax@23
2352 __int16 v17; // di@30
2353 double v18; // st7@30
2354 float v19; // ST38_4@30
2355 double v20; // st7@30
2356 double v21; // st6@30
2357 double v22; // st5@33
2358 signed int v27; // eax@37
2359 unsigned __int16 *v28; // ecx@37
2360 signed int v29; // edi@40
2361 //signed int v33; // ebx@50
2362 //unsigned int v34; // eax@50
2363 //signed int v35; // ecx@50
2364 //unsigned __int16 v36; // di@66
2365 int v37; // edi@72
2366 int v38; // ebx@72
2367 __int16 v39; // ax@87
2368 int v40; // edi@91
2369 int v41; // ebx@91
2370 unsigned int v42; // eax@101
2371 unsigned int v43; // ebx@101
2372 unsigned int v44; // ST30_4@101
2373 char *v45; // ebx@106
2374 int v46; // edi@108
2375 int v47; // eax@108
2376 unsigned int v48; // ebx@114
2377 unsigned int v49; // ST64_4@114
2378 //unsigned int v51; // [sp-10h] [bp-64h]@79
2379 unsigned int v52; // [sp-10h] [bp-64h]@100
2380 //unsigned int v53; // [sp-Ch] [bp-60h]@79
2381 unsigned int v54; // [sp-Ch] [bp-60h]@100
2382 //unsigned int v55; // [sp-8h] [bp-5Ch]@77
2383 unsigned int v56; // [sp-8h] [bp-5Ch]@100
2384 //signed int v57; // [sp-4h] [bp-58h]@54
2385 //unsigned __int16 v58; // [sp-4h] [bp-58h]@77
2386 unsigned __int16 v59; // [sp-4h] [bp-58h]@100
2387 //unsigned __int16 v60; // [sp+10h] [bp-44h]@66
2388 //unsigned int v61; // [sp+10h] [bp-44h]@85
2389 //unsigned int v63; // [sp+14h] [bp-40h]@85
2390 //unsigned int v65; // [sp+18h] [bp-3Ch]@85
2391 unsigned int lPitch; // [sp+20h] [bp-34h]@1
2392 unsigned int lPitcha; // [sp+20h] [bp-34h]@23
2393 char *lPitchb; // [sp+20h] [bp-34h]@106
2394 unsigned int v69; // [sp+24h] [bp-30h]@23
2395 signed int v70; // [sp+24h] [bp-30h]@37
2396 //unsigned __int16 uBlue; // [sp+28h] [bp-2Ch]@1
2397 signed int uBluea; // [sp+28h] [bp-2Ch]@37
2398 int v73; // [sp+2Ch] [bp-28h]@30
2399 int v76; // [sp+34h] [bp-20h]@91
2400 int v77; // [sp+34h] [bp-20h]@108
2401 //int v79; // [sp+38h] [bp-1Ch]@72
2402 //char *a2c; // [sp+40h] [bp-14h]@68
2403 signed int uCenterY; // [sp+48h] [bp-Ch]@1
2404 signed int uCenterX; // [sp+4Ch] [bp-8h]@1
2405 signed int uWidth; // [sp+5Ch] [bp+8h]@30
2406 //signed int uZe; // [sp+5Ch] [bp+8h]@67
2407 signed int uZf; // [sp+5Ch] [bp+8h]@85
2408 signed int uZg; // [sp+5Ch] [bp+8h]@105
2409 unsigned int uWa; // [sp+60h] [bp+Ch]@23
2410 float uWb; // [sp+60h] [bp+Ch]@30
2411 unsigned int uWd; // [sp+60h] [bp+Ch]@95
2412 float uZooma; // [sp+64h] [bp+10h]@117
2413 //unsigned int flagsb; // [sp+68h] [bp+14h]@66
2414 Actor *flagsc; // [sp+68h] [bp+14h]@86
2415 //unsigned int flagsd; // [sp+68h] [bp+14h]@105
2416
2417 uCenterX = (uX + uZ) / 2;
2418 uCenterY = (uY + uW) / 2;
2419 lPitch = pRenderer->uTargetSurfacePitch;
2420 //TargetColor(0, 0, 0);
2421 //uBlue = TargetColor(0, 0, 0xFFu);
2422 auto bWizardEyeActive = pParty->WizardEyeActive();
2423 auto uWizardEyeSkillLevel = pParty->WizardEyeSkillLevel();
2424 if (CheckHiredNPCSpeciality(Cartographer))
2425 {
2426 bWizardEyeActive = true;
2427 uWizardEyeSkillLevel = 2;
2428 }
2429 bWizardEyeActive = true;
2430 uWizardEyeSkillLevel = 3;
2431 pRenderer->SetRasterClipRect(uX, uY, uZ - 1, uW - 1);
2432 uHeight = uW - uY;
2433 uWidth = uZ - uX;
2434
2435 if ( uCurrentlyLoadedLevelType != LEVEL_Indoor)
2436 {
2437 v17 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2;
2438 auto pMapLod0 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pLevelOfDetail0_prolly_alpha_mask;
2439 auto pPal = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pPalette16;
2440 v73 = (1 << (v17 + 16)) / (signed int)uZoom;
2441 v18 = (double)(1 << (16 - v17));
2442 v19 = v18;
2443 v20 = (double)(pParty->vPosition.x + 32768) / v18;
2444 v21 = (double)(32768 - pParty->vPosition.y) / v19;
2445 uWb = v21;
2446 switch (uZoom)
2447 {
2448 case 512:
2449 {
2450 v20 = v20 - (double)(uWidth / 2);
2451 v22 = (double)(uHeight / 2);
2452 uWb = v21 - v22;
2453 }
2454 break;
2455
2456 case 1024:
2457 {
2458 v20 = v20 - (double)(uWidth / 4);
2459 v22 = (double)(uHeight / 4);
2460 uWb = v21 - v22;
2461 }
2462 break;
2463
2464 case 2048:
2465 {
2466 v20 = v20 - (double)(uWidth / 8);
2467 v22 = (double)(uHeight / 8);
2468 uWb = v21 - v22;
2469 }
2470 break;
2471
2472 default: assert(false);
2473 }
2474 assert(sizeof(pOdmMinimap) == 137 * 117 * sizeof(short));
2475
2476 v70 = floorf(v20 * 65536.0 + 0.5f);//LODWORD(v24);
2477 uBluea = floorf(uWb * 65536.0 + 0.5f);//LODWORD(v25);
2478 v27 = uBluea >> 16;
2479 v28 = &pRenderer->pTargetSurface[uX + uY * lPitch];
2480 if (pMapLod0 && bRedrawOdmMinimap)
2481 {
2482 assert(uWidth == 137 && uHeight == 117);
2483 //auto pMinimap = (unsigned __int16 *)pOdmMinimap;
2484
2485 auto mapWidth = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uTextureWidth;
2486
2487 v29 = v70 >> 16;
2488
2489 for (int y = 0; y < uHeight; ++y)
2490 {
2491 auto pMapLod0Line = &pMapLod0[v27 * mapWidth];
2492 for (int x = 0; x < uWidth; ++x)
2493 {
2494 //*pMinimap++ = pPal[pMapLod0Line[v29]];
2495 pOdmMinimap[y][x] = pPal[pMapLod0Line[v29]];
2496 v29 = (v70 + x * v73) >> 16;
2497 }
2498
2499 v29 = v70 >> 16;
2500 v28 += 137 - uWidth;
2501 uBluea += v73;
2502 v27 = uBluea >> 16;
2503 }
2504 }
2505
2506 for (int y = 0; y < 117; ++y)
2507 {
2508 for (int x = 0; x < 137; ++x)
2509 {
2510 *v28++ = pOdmMinimap[y][x];
2511 }
2512 v28 += lPitch - 137;
2513 }
2514 uNumBlueFacesInBLVMinimap = 0;
2515 }
2516 else
2517 {
2518 pRenderer->FillRectFast(uX, uY, uZ - uX, uHeight, 0xF);
2519 uNumBlueFacesInBLVMinimap = 0;
2520
2521 for (uint i = 0; i < pIndoor->pMapOutlines->uNumOutlines; ++i)
2522 {
2523 auto pOutline = &pIndoor->pMapOutlines->pOutlines[i];
2524
2525 auto pFace1 = pIndoor->pFaces + pOutline->uFace1ID;
2526 auto pFace2 = pIndoor->pFaces + pOutline->uFace2ID;
2527 //v9 = pIndoor->pFaces[pMapVertex->uFace1ID].uAttributes;
2528 //v10 = pIndoor->pFaces[pMapVertex->uFace2ID].uAttributes;
2529 if (pFace1->Visible() && pFace2->Visible())
2530 {
2531 v11 = pOutline->uFlags;
2532 if ( v11 & 1 )
2533 goto LABEL_15;
2534 if (pFace1->uAttributes & 0x80 || pFace2->uAttributes & 0x80)
2535 goto LABEL_ABC;
2536
2537 }
2538 continue;
2539
2540 LABEL_ABC:
2541 pOutline->uFlags = v11 | 1;
2542 pIndoor->_visible_outlines[i >> 3] |= 1 << (7 - i % 8);
2543
2544 LABEL_15:
2545 //v12 = &pIndoor->pFaces[pOutline->uFace1ID];
2546 if (bWizardEyeActive && uWizardEyeSkillLevel >= 3 &&
2547 (pFace1->uAttributes & 0x2000 || pFace2->uAttributes & 0x2000) &&
2548 (pIndoor->pFaceExtras[pFace1->uFaceExtraID].uEventID || pIndoor->pFaceExtras[pFace2->uFaceExtraID].uEventID))
2549 {
2550 if (uNumBlueFacesInBLVMinimap < 49)
2551 pBlueFacesInBLVMinimapIDs[uNumBlueFacesInBLVMinimap++] = i;
2552 }
2553 else
2554 {
2555 auto _a = (uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].x);
2556 auto _b = ((unsigned int)((unsigned __int64)_a >> 16) << 16);
2557 auto _c = ((signed int)(_b - uZoom * pParty->vPosition.x) >> 16);
2558 v69 = uCenterX + _c;
2559 v69 = uCenterX + ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].x) >> 16) << 16) - uZoom * pParty->vPosition.x) >> 16);
2560 lPitcha = uCenterY - ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].y) >> 16) << 16) - uZoom * pParty->vPosition.y) >> 16);
2561 uWa = uCenterX + ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex2ID].x) >> 16) << 16) - uZoom * pParty->vPosition.x) >> 16);
2562 v14 = uCenterY - ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex2ID].y) >> 16) << 16) - uZoom * pParty->vPosition.y) >> 16);
2563 v15 = abs(pOutline->sZ - pParty->vPosition.z) / 8;
2564 if ( v15 > 100 )
2565 v15 = 100;
2566 pRenderer->RasterLine2D(v69, lPitcha, uWa, v14, viewparams->pPalette[-v15 + 200]);
2567 }
2568 }
2569
2570
2571 for (uint i = 0; i < uNumBlueFacesInBLVMinimap; ++i)
2572 {
2573 //v16 = (uint *)&pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[uZb]];
2574 auto pOutline = &pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[i]];
2575 pRenderer->RasterLine2D(uCenterX + ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom
2576 * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].x) >> 16) << 16)
2577 - uZoom * pParty->vPosition.x) >> 16),
2578 uCenterY
2579 - ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom
2580 * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].y) >> 16) << 16)
2581 - uZoom * pParty->vPosition.y) >> 16),
2582 uCenterX
2583 + ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom
2584 * (signed __int64)pIndoor->pVertices[pOutline->uVertex2ID].x) >> 16) << 16)
2585 - uZoom * pParty->vPosition.x) >> 16),
2586 uCenterY
2587 - ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom
2588 * (signed __int64)pIndoor->pVertices[pOutline->uVertex2ID].y) >> 16) << 16)
2589 - uZoom * pParty->vPosition.y) >> 16),
2590 ui_game_minimap_outline_color);
2591 }
2592 }
2593
2594
2595 assert(pParty->sRotationY >= 0);
2596 float angle = (pParty->sRotationY % 2048) / 2048.0f;
2597 const float two_pi = 2.0f * 3.14159f;
2598
2599 uint arrow_idx = floorf(0.5f + 7 * angle);
2600 pRenderer->DrawTextureTransparent(uCenterX - 3, uCenterY - 3, pIcons_LOD->GetTexture(pTextureIDs_pMapDirs[arrow_idx]));
2601
2602 //flagsb = TargetColor(0, 0, 255);
2603 //v60 = TargetColor(255, 0, 0);
2604 if (bWizardEyeActive)
2605 {
2606 //uZe = 0;
2607 if (uWizardEyeSkillLevel >= 2)
2608 for (uint i = 0; i < uNumSpriteObjects; ++i)
2609 //if (uNumSpriteObjects > 0)
2610 {
2611 auto object = &pSpriteObjects[i];
2612
2613 //a2c = (char *)&pSpriteObjects[0].uObjectDescID;
2614 //while ( 1 )
2615 //{
2616 if (!object->uType || !object->uObjectDescID)
2617 continue;
2618 //if (uWizardEyeSkillLevel == 1
2619 v37 = uCenterX + ((unsigned __int64)((object->vPosition.x - pParty->vPosition.x) * (signed __int64)uZoom) >> 16);
2620 //v79 = (unsigned __int64)((object->vPosition.y - pParty->vPosition.y) * (signed __int64)(signed int)uZoom) >> 16;
2621 //v38 = uCenterY - v79;
2622 v38 = uCenterY - ((signed __int64)((object->vPosition.y - pParty->vPosition.y) * (signed __int64)uZoom) >> 16);
2623 if (v37 < pRenderer->raster_clip_x || v37 > pRenderer->raster_clip_z ||
2624 v38 < pRenderer->raster_clip_y || v38 > pRenderer->raster_clip_w)
2625 continue;
2626
2627 assert(uZoom >= 512);
2628 if (pObjectList->pObjects[object->uObjectDescID].uFlags & OBJECT_DESC_UNPICKABLE)
2629 {
2630 pRenderer->RasterLine2D(v37, v38, v37, v38, ui_game_minimap_projectile_color);
2631 }
2632 else if (uZoom > 512)
2633 {
2634 pRenderer->RasterLine2D(v37 - 1, v38 - 1, v37 - 1, v38 + 1, ui_game_minimap_treasure_color);
2635 pRenderer->RasterLine2D(v37, v38 - 2, v37, v38 + 1, ui_game_minimap_treasure_color);
2636 pRenderer->RasterLine2D(v37 + 1, v38 - 1, v37 + 1, v38 + 1, ui_game_minimap_treasure_color);
2637 pRenderer->RasterLine2D(v37 - 2, v38, v37 - 2, v38 + 1, ui_game_minimap_treasure_color);
2638 pRenderer->RasterLine2D(v37 + 2, v38,
2639 v37 + 2, v38 + 1, ui_game_minimap_treasure_color);
2640 }
2641 else
2642 {
2643 pRenderer->RasterLine2D(v37 - 1, v38 - 1,
2644 v37 - 1, v38, ui_game_minimap_treasure_color);
2645 pRenderer->RasterLine2D(v37, v38 - 1,
2646 v37, v38, ui_game_minimap_treasure_color);
2647 }
2648 //LABEL_82:
2649 //LABEL_83:
2650 //++uZe;
2651 //a2c += 112;
2652 //if ( uZe >= (signed int)uNumSpriteObjects )
2653 //{
2654 //goto LABEL_85;
2655 //}
2656 //}
2657 }
2658
2659
2660 LABEL_85:
2661 //v63 = TargetColor(255, 0, 0);
2662 //v61 = TargetColor(0, 255, 0);
2663 //v65 = TargetColor(255, 255, 0);
2664 uZf = 0;
2665 if ( (signed int)uNumActors > 0 )
2666 {
2667 flagsc = pActors.data();//[0].uAIState;
2668 do
2669 {
2670 v39 = flagsc->uAIState;
2671 if ( flagsc->uAIState != 11 && v39 != 19 && (v39 == 5 || BYTE1(flagsc->uAttributes) & 0x80) )
2672 {
2673 v40 = ((unsigned __int64)(( flagsc->vPosition.x - pParty->vPosition.x)
2674 * (signed __int64)(signed int)uZoom) >> 16)
2675 + uCenterX;
2676 v76 = (unsigned __int64)(( flagsc->vPosition.y - pParty->vPosition.y)
2677 * (signed __int64)(signed int)uZoom) >> 16;
2678 v41 = uCenterY - v76;
2679 if ( v40 >= pRenderer->raster_clip_x )
2680 {
2681 if ( v40 <= pRenderer->raster_clip_z && v41 >= pRenderer->raster_clip_y && v41 <= pRenderer->raster_clip_w )
2682 {
2683 uWd = ui_game_minimap_actor_friendly_color;
2684 if ( BYTE3(flagsc->uAttributes) & 1 )
2685 uWd = ui_game_minimap_actor_hostile_color;
2686 if ( flagsc->uAIState == Dead)
2687 uWd = ui_game_minimap_actor_corpse_color;
2688 if ( (signed int)uZoom > 1024 )
2689 {
2690 pRenderer->RasterLine2D(v40 - 1, v41 - 2, v40 - 1, v41 + 2, uWd);
2691 pRenderer->RasterLine2D(v40, v41 - 2, v40, v41 + 2, uWd);
2692 pRenderer->RasterLine2D(v40 + 1, v41 - 2, v40 + 1, v41 + 2, uWd);
2693 v42 = v41 + 1;
2694 v43 = v41 - 1;
2695 v44 = v42;
2696 pRenderer->RasterLine2D(v40 - 2, v43, v40 - 2, v42, uWd);
2697 v40 += 2;
2698 v59 = uWd;
2699 v56 = v44;
2700 v54 = v40;
2701 v52 = v43;
2702 }
2703 else
2704 {
2705 pRenderer->RasterLine2D(v40 - 1, v41 - 1, v40 - 1, uCenterY - v76, uWd);
2706 v59 = uWd;
2707 v56 = uCenterY - v76;
2708 v54 = v40;
2709 v52 = v41 - 1;
2710 }
2711 pRenderer->RasterLine2D(v40, v52, v54, v56, v59);
2712 }
2713 }
2714 }
2715 ++uZf;
2716 ++flagsc;
2717 }
2718 while ( uZf < (signed int)uNumActors );
2719 }
2720 }
2721
2722
2723 //flagsd = TargetColor(255, 255, 255);
2724 uZg = 0;
2725 if ( (signed int)uNumLevelDecorations > 0 )
2726 {
2727 v45 = (char *)&pLevelDecorations[0].vPosition;
2728 lPitchb = (char *)&pLevelDecorations[0].vPosition;
2729 do
2730 {
2731 if ( *(v45 - 2) & 8 )
2732 {
2733 v46 = ((unsigned __int64)((*(int *)v45 - pParty->vPosition.x) * (signed __int64)(signed int)uZoom) >> 16)
2734 + uCenterX;
2735 v77 = (unsigned __int64)((*((int *)v45 + 1) - pParty->vPosition.y) * (signed __int64)(signed int)uZoom) >> 16;
2736 v47 = uCenterY - v77;
2737 if ( v46 >= pRenderer->raster_clip_x )
2738 {
2739 if ( v46 <= pRenderer->raster_clip_z && v47 >= pRenderer->raster_clip_y && v47 <= pRenderer->raster_clip_w )
2740 {
2741 if ( (signed int)uZoom > 512 )
2742 {
2743 v48 = v47 + 1;
2744 v49 = v47 - 1;
2745 pRenderer->RasterLine2D(v46 - 1, v47 - 1, v46 - 1, v47 + 1, ui_game_minimap_decoration_color_1);
2746 pRenderer->RasterLine2D(v46, v49, v46, v48, ui_game_minimap_decoration_color_1);
2747 pRenderer->RasterLine2D(v46 + 1, v49, v46 + 1, v48, ui_game_minimap_decoration_color_1);
2748 v45 = lPitchb;
2749 }
2750 else
2751 {
2752 pRenderer->RasterLine2D(v46, uCenterY - v77, v46, uCenterY - v77, ui_game_minimap_decoration_color_1);
2753 }
2754 }
2755 }
2756 }
2757 ++uZg;
2758 v45 += 32;
2759 lPitchb = v45;
2760 }
2761 while ( uZg < (signed int)uNumLevelDecorations );
2762 }
2763 pRenderer->DrawTextureTransparent(0x1D4u, 0, pIcons_LOD->GetTexture(dword_5079D8));
2764 uZooma = (double)pParty->sRotationY * 0.1171875;
2765 //v50 = uZooma + 6.7553994e15;
2766 pRenderer->SetTextureClipRect(541, 0, 567, 480);
2767 pRenderer->DrawTextureIndexed(floorf(uZooma + 0.5f) + 285, 136, pIcons_LOD->GetTexture(dword_5079B4));
2768 pRenderer->ResetTextureClipRect();
2769 }
2770
2771 //----- (00441498) --------------------------------------------------------
2772 void __cdecl GameUI_DrawTorchlightAndWizardEye()
2773 {
2774 if (pCurrentScreen == SCREEN_GAME
2775 || pCurrentScreen == SCREEN_MENU
2776 || pCurrentScreen == SCREEN_OPTIONS
2777 || pCurrentScreen == SCREEN_REST
2778 || pCurrentScreen == SCREEN_SPELL_BOOK
2779 || pCurrentScreen == SCREEN_CHEST
2780 || pCurrentScreen == SCREEN_SAVEGAME
2781 || pCurrentScreen == SCREEN_LOADGAME
2782 || pCurrentScreen == SCREEN_CHEST_INVENTORY
2783 || pCurrentScreen == SCREEN_BOOKS
2784 || pCurrentScreen == SCREEN_BRANCHLESS_NPC_DIALOG )
2785 {
2786 if (pParty->TorchlightActive())
2787 {
2788 auto icon = pIconsFrameTable->GetFrame((signed __int16)pUIAnum_Torchlight->uIconID, pEventTimer->Time());
2789 pRenderer->DrawTextureTransparent(pUIAnum_Torchlight->x, pUIAnum_Torchlight->y, pIcons_LOD->GetTexture(icon->uTextureID));
2790 }
2791 if (pParty->WizardEyeActive())
2792 {
2793 auto icon = pIconsFrameTable->GetFrame((signed __int16)pUIAnim_WizardEye->uIconID, pEventTimer->Time());
2794 pRenderer->DrawTextureTransparent(pUIAnim_WizardEye->x, pUIAnim_WizardEye->y, pIcons_LOD->GetTexture(icon->uTextureID));
2795 }
2796 }
2797 }
2798 // 4E28F8: using guessed type int pCurrentScreen;
2799
2800
2801 //----- (00491F87) --------------------------------------------------------
2802 void GameUI_DrawHiredNPCs()
2803 {
2804 //int v6; // eax@15
2805 char v7; // al@17
2806 unsigned int v8; // eax@18
2807 int v9; // esi@18
2808 int v10; // eax@18
2809 unsigned int v11; // eax@19
2810 unsigned int v12; // esi@19
2811 unsigned int v13; // eax@23
2812 IconFrame *v14; // eax@24
2813 unsigned int v15; // eax@26
2814 char pContainer[20]; // [sp+Ch] [bp-30h]@18
2815 unsigned int v17; // [sp+20h] [bp-1Ch]@19
2816 signed int uFrameID; // [sp+24h] [bp-18h]@19
2817 //int i; // [sp+28h] [bp-14h]@15
2818 unsigned int v20; // [sp+2Ch] [bp-10h]@20
2819 unsigned int v21; // [sp+30h] [bp-Ch]@19
2820 int v22; // [sp+34h] [bp-8h]@2
2821 unsigned __int8 v23; // [sp+3Bh] [bp-1h]@2
2822
2823 if ( bNoNPCHiring != 1 )
2824 {
2825 v23 = 0;
2826 v22 = 0;
2827 /*for (uint i = 0; i < 2; ++i)
2828 {
2829 if (pParty->pHirelings[i].pName)
2830 pTmpBuf[v22++] = i;
2831 }*/
2832 if (pParty->pHirelings[0].pName)
2833 pTmpBuf[v22++] = 0;
2834 if (pParty->pHirelings[1].pName)
2835 pTmpBuf[v22++] = 1;
2836
2837 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i)
2838 {
2839 if (pNPCStats->pNewNPCData[i].uFlags & 128)
2840 {
2841 if (!pParty->pHirelings[0].pName || strcmp(pNPCStats->pNewNPCData[i].pName, pParty->pHirelings[0].pName))
2842 {
2843 if (!pParty->pHirelings[1].pName || strcmp(pNPCStats->pNewNPCData[i].pName, pParty->pHirelings[1].pName))
2844 pTmpBuf[v22++] = i + 2;
2845 }
2846 }
2847 }
2848
2849 //v6 = (unsigned __int8)pParty->field_709;
2850 for ( int i = (unsigned __int8)pParty->field_709; i < v22 && v23 < 2; i++ )
2851 {
2852 v7 = pTmpBuf[i];
2853 if ( (unsigned __int8)v7 >= 2 )
2854 {
2855 sprintf(pContainer, "NPC%03d", pNPCStats->pNPCData[(unsigned __int8)v7 + 499].uPortraitID);
2856 v15 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
2857 pRenderer->DrawTextureIndexed(pHiredNPCsIconsOffsetsX[v23], pHiredNPCsIconsOffsetsY[v23], pIcons_LOD->GetTexture(v15));
2858 }
2859 else
2860 {
2861 sprintf(pContainer, "NPC%03d", pParty->pHirelings[(unsigned __int8)v7].uPortraitID);
2862 v8 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
2863 v9 = v23;
2864 pRenderer->DrawTextureIndexed(pHiredNPCsIconsOffsetsX[v9], pHiredNPCsIconsOffsetsY[v9], pIcons_LOD->GetTexture(v8));
2865 v10 = (unsigned __int8)pTmpBuf[i];
2866 if ( pParty->pHirelings[v10].evt_A == 1 )
2867 {
2868 uFrameID = pParty->pHirelings[v10].evt_B;
2869 v11 = pHiredNPCsIconsOffsetsX[v9];
2870 v12 = pHiredNPCsIconsOffsetsY[v9];
2871 v17 = v11;
2872 v21 = 0;
2873 if ( (signed int)pIconsFrameTable->uNumIcons <= 0 )
2874 {
2875 LABEL_23:
2876 v13 = 0;
2877 }
2878 else
2879 {
2880 v20 = 0;
2881 while ( _stricmp("spell96", pIconsFrameTable->pIcons[v20 / 0x20].pAnimationName) )
2882 {
2883 ++v21;
2884 v20 += 32;
2885 if ( (signed int)v21 >= (signed int)pIconsFrameTable->uNumIcons )
2886 goto LABEL_23;
2887 }
2888 v13 = v21;
2889 }
2890 v14 = pIconsFrameTable->GetFrame(v13, uFrameID);
2891 pRenderer->DrawTextureTransparent(v17, v12, &pIcons_LOD->pTextures[v14->uTextureID]);
2892 }
2893 }
2894 ++v23;
2895 }
2896 }
2897 }
2898 // 6BE3C5: using guessed type char bNoNPCHiring;
2899
2900 //----- (004178FE) --------------------------------------------------------
2901 unsigned int __fastcall UI_GetHealthManaStringColor(signed int a1, signed int a2)
2902 {
2903 unsigned __int16 v2; // dx@2
2904 unsigned __int16 v3; // cx@2
2905 int v5; // eax@5
2906 unsigned __int16 v6; // [sp-4h] [bp-8h]@2
2907
2908 if ( a1 <= a2 )
2909 {
2910 if ( a1 == a2 )
2911 return 0;
2912 v5 = 100 * a1 / a2;
2913 v3 = 255;
2914 if ( v5 >= 25 )
2915 {
2916 v6 = 100;
2917 v2 = 255;
2918 }
2919 else
2920 {
2921 v6 = 0;
2922 v2 = 0;
2923 }
2924 }
2925 else
2926 {
2927 v6 = 0;
2928 v2 = 255;
2929 v3 = 0;
2930 }
2931 return TargetColor(v3, v2, v6);
2932 }
2933
2934 //----- (00417939) --------------------------------------------------------
2935 signed int __thiscall GetConditionDrawColor(unsigned int uConditionIdx)
2936 {
2937 unsigned int v1; // ebx@1
2938 signed int v2; // edi@1
2939 unsigned int v3; // esi@1
2940 unsigned int v4; // eax@1
2941 unsigned int v6; // [sp+Ch] [bp-4h]@1
2942
2943 v1 = uConditionIdx;
2944 v2 = 65535;
2945 v3 = TargetColor(0xE1u, 0xCDu, 0x23u);
2946 v6 = TargetColor(0xFFu, 0x23u, 0);
2947 v4 = TargetColor(0, 0xFFu, 0);
2948 switch ( v1 )
2949 {
2950 case 0u:
2951 case 1u:
2952 case 3u:
2953 case 4u:
2954 case 5u:
2955 case 6u:
2956 case 7u:
2957 v2 = v4;
2958 break;
2959 case 2u:
2960 case 8u:
2961 case 9u:
2962 case 0xCu:
2963 case 0xDu:
2964 v2 = v3;
2965 break;
2966 case 0xAu:
2967 case 0xBu:
2968 case 0xEu:
2969 case 0xFu:
2970 case 0x10u:
2971 v2 = v6;
2972 break;
2973 default:
2974 return v2;
2975 }
2976 return v2;
2977 }