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