Mercurial > mm7
annotate UI/UiGame.cpp @ 1500:fd6c580a02b7
m
author | Ritor1 |
---|---|
date | Sun, 01 Sep 2013 17:36:29 +0600 |
parents | 878a5c69297a |
children | 5e601a07010d |
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 //----- (00420EFF) -------------------------------------------------------- | |
1458 | 1165 void GameUI_WritePointedObjectStatusString() |
1298 | 1166 { |
1167 int v1; // ebx@6 | |
1168 GUIWindow *pWindow; // edi@7 | |
1169 GUIButton *pButton; // ecx@11 | |
1170 Player *pPlayer; // eax@19 | |
1171 char v5; // cl@19 | |
1172 unsigned int v6; // eax@19 | |
1173 int v7; // ecx@19 | |
1174 __int16 v8; // fps@23 | |
1175 unsigned __int8 v9; // c0@23 | |
1176 unsigned __int8 v10; // c3@23 | |
1177 enum UIMessageType pMessageType1; // esi@24 | |
1178 char *v13; // ecx@28 | |
1179 int v14; // eax@41 | |
1180 ItemGen *pItemGen; // ecx@44 | |
1181 int v16; // ecx@46 | |
1182 const char *v17; // eax@49 | |
1183 signed int v18; // eax@55 | |
1184 signed int v18b; | |
1185 signed int v19; // ecx@63 | |
1186 BLVFace *pFace; // eax@69 | |
1187 __int16 v21; // ax@70 | |
1188 const char *v22; // eax@72 | |
1189 LevelDecoration *v23; // ecx@75 | |
1190 LevelDecoration *v24; // esi@75 | |
1191 __int16 v25; // ax@75 | |
1192 const char *v26; // ecx@79 | |
1193 Actor *pActor; // ecx@82 | |
1194 char *v28; // esi@82 | |
1195 int v29; // eax@82 | |
1196 signed int v30; // ecx@88 | |
1197 const char *v31; // eax@91 | |
1198 __int16 v32; // fps@109 | |
1199 enum UIMessageType pMessageType2; // esi@110 | |
1200 enum UIMessageType pMessageType3; // edx@117 | |
1201 const char *v39; // [sp-8h] [bp-E8h]@20 | |
1202 char *v40; // [sp-8h] [bp-E8h]@83 | |
1203 int v41; // [sp-4h] [bp-E4h]@20 | |
1204 char Str1[200]; // [sp+Ch] [bp-D4h]@129 | |
1205 unsigned int pX; // [sp+D4h] [bp-Ch]@1 | |
1206 unsigned int pY; // [sp+D8h] [bp-8h]@1 | |
1207 unsigned int v45; // [sp+DCh] [bp-4h]@21 | |
1208 | |
1209 v13 = nullptr; | |
1210 pMouse->uPointingObjectID = 0; | |
1211 pMouse->GetClickPos(&pX, &pY); | |
1212 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 ) | |
1213 return; | |
1214 if (pCurrentScreen == SCREEN_GAME) | |
1215 { | |
1216 if ( (signed int)pX > 467 || (signed int)pY > 351 ) | |
1217 goto _click_on_game_ui; | |
1218 if ( pRenderer->pRenderD3D ) // inlined mm8::4C1E01 | |
1219 { | |
1220 v18 = pGame->pVisInstance->get_picked_object_zbuf_val(); | |
1221 if ( (signed int)pX < (signed int)pViewport->uScreen_TL_X | |
1222 || (signed int)pX > (signed int)pViewport->uScreen_BR_X | |
1223 || (signed int)pY < (signed int)pViewport->uScreen_TL_Y | |
1224 || (signed int)pY > (signed int)pViewport->uScreen_BR_Y ) | |
1225 v18 = -1; | |
1226 if ( v18 == -1 ) | |
1227 { | |
1228 pMouse->uPointingObjectID = 0; | |
1229 if ( pMouse->uPointingObjectID == 0 ) | |
1230 { | |
1231 if ( uLastPointedObjectID != 0 ) | |
1232 { | |
1233 pFooterString[0] = 0; | |
1234 bForceDrawFooter = 1; | |
1235 } | |
1236 } | |
1237 uLastPointedObjectID = pMouse->uPointingObjectID; | |
1238 return; | |
1239 } | |
1240 } | |
1241 else | |
1242 v18 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]]; | |
1243 pMouse->uPointingObjectID = (unsigned __int16)v18; | |
1244 v19 = (signed)PID_ID(v18); | |
1245 if (PID_TYPE(v18) == OBJECT_Item) | |
1246 { | |
1247 v30 = v19; | |
1248 if ( pObjectList->pObjects[pSpriteObjects[v30].uObjectDescID].uFlags & 0x10 ) | |
1249 { | |
1250 pMouse->uPointingObjectID = 0; | |
1251 uLastPointedObjectID = 1; | |
1252 if ( pMouse->uPointingObjectID == 0 ) | |
1253 { | |
1254 if ( uLastPointedObjectID != 0 ) | |
1255 { | |
1256 pFooterString[0] = 0; | |
1257 bForceDrawFooter = 1; | |
1258 } | |
1259 } | |
1260 uLastPointedObjectID = pMouse->uPointingObjectID; | |
1261 return; | |
1262 } | |
1263 if ( v18 >= (signed int)0x2000000u || pParty->pPickedItem.uItemID ) | |
1264 { | |
1265 v22 = pSpriteObjects[v30].stru_24.GetDisplayName(); | |
1266 v26 = v22; | |
1267 GameUI_SetFooterString(v26); | |
1268 if ( pMouse->uPointingObjectID == 0 ) | |
1269 { | |
1270 if ( uLastPointedObjectID != 0 ) | |
1271 { | |
1272 pFooterString[0] = 0; | |
1273 bForceDrawFooter = 1; | |
1274 } | |
1275 } | |
1276 uLastPointedObjectID = pMouse->uPointingObjectID; | |
1277 return; | |
1278 } | |
1279 v31 = pSpriteObjects[v30].stru_24.GetDisplayName(); | |
1280 v28 = pTmpBuf.data(); | |
1281 sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[470], v31);// "Get %s" | |
1282 } | |
1283 else | |
1284 { | |
1285 if (PID_TYPE(v18) != OBJECT_Actor) | |
1286 { | |
1287 if (PID_TYPE(v18) == OBJECT_Decoration) | |
1288 { | |
1289 v23 = &pLevelDecorations[v19]; | |
1290 v24 = v23; | |
1291 v25 = v23->field_16_event_id; | |
1292 if ( !v25 ) | |
1293 { | |
1294 if ( v23->IsInteractive() ) | |
1295 v26 = pNPCTopics[stru_5E4C90._decor_events[v24->_idx_in_stru123 - 75] + 379].pTopic; | |
1296 else | |
1297 v26 = pDecorationList->pDecorations[v24->uDecorationDescID].field_20; | |
1298 GameUI_SetFooterString(v26); | |
1299 if ( pMouse->uPointingObjectID == 0 ) | |
1300 { | |
1301 if ( uLastPointedObjectID != 0 ) | |
1302 { | |
1303 pFooterString[0] = 0; | |
1304 bForceDrawFooter = 1; | |
1305 } | |
1306 } | |
1307 uLastPointedObjectID = pMouse->uPointingObjectID; | |
1308 return; | |
1309 } | |
1310 v22 = GetEventHintString(v25); | |
1311 if ( !v22 ) | |
1312 { | |
1313 if ( pMouse->uPointingObjectID == 0 ) | |
1314 { | |
1315 if ( uLastPointedObjectID != 0 ) | |
1316 { | |
1317 pFooterString[0] = 0; | |
1318 bForceDrawFooter = 1; | |
1319 } | |
1320 } | |
1321 uLastPointedObjectID = pMouse->uPointingObjectID; | |
1322 return; | |
1323 } | |
1324 v26 = v22; | |
1325 GameUI_SetFooterString(v26); | |
1326 if ( pMouse->uPointingObjectID == 0 ) | |
1327 { | |
1328 if ( uLastPointedObjectID != 0 ) | |
1329 { | |
1330 pFooterString[0] = 0; | |
1331 bForceDrawFooter = 1; | |
1332 } | |
1333 } | |
1334 uLastPointedObjectID = pMouse->uPointingObjectID; | |
1335 return; | |
1336 } | |
1337 if (PID_TYPE(v18) == OBJECT_BModel) | |
1338 { | |
1339 if ( HIWORD(v18) < 512) | |
1340 { | |
1341 if ( uCurrentlyLoadedLevelType != LEVEL_Indoor) | |
1342 { | |
1343 v18b = (signed int)(unsigned __int16)v18 >> 9; | |
1344 v21 = pOutdoor->pBModels[v18b].pFaces[v19 & 0x3F].sCogTriggeredID; | |
1345 if ( !v21 || (v22 = GetEventHintString(v21)) == 0 ) | |
1346 { | |
1347 pMouse->uPointingObjectID = 0; | |
1348 uLastPointedObjectID = 1; | |
1349 if ( pMouse->uPointingObjectID == 0 ) | |
1350 { | |
1351 if ( uLastPointedObjectID != 0 ) | |
1352 { | |
1353 pFooterString[0] = 0; | |
1354 bForceDrawFooter = 1; | |
1355 } | |
1356 } | |
1357 uLastPointedObjectID = pMouse->uPointingObjectID; | |
1358 return; | |
1359 } | |
1360 v26 = v22; | |
1361 GameUI_SetFooterString(v26); | |
1362 if ( pMouse->uPointingObjectID == 0 ) | |
1363 { | |
1364 if ( uLastPointedObjectID != 0 ) | |
1365 { | |
1366 pFooterString[0] = 0; | |
1367 bForceDrawFooter = 1; | |
1368 } | |
1369 } | |
1370 uLastPointedObjectID = pMouse->uPointingObjectID; | |
1371 return; | |
1372 } | |
1373 pFace = &pIndoor->pFaces[v19]; | |
1374 if ( BYTE3(pFace->uAttributes) & 6 ) | |
1375 { | |
1376 v21 = pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID; | |
1377 if ( !v21 || (v22 = GetEventHintString(v21)) == 0 ) | |
1378 { | |
1379 pMouse->uPointingObjectID = 0; | |
1380 uLastPointedObjectID = 1; | |
1381 if ( pMouse->uPointingObjectID == 0 ) | |
1382 { | |
1383 if ( uLastPointedObjectID != 0 ) | |
1384 { | |
1385 pFooterString[0] = 0; | |
1386 bForceDrawFooter = 1; | |
1387 } | |
1388 } | |
1389 uLastPointedObjectID = pMouse->uPointingObjectID; | |
1390 return; | |
1391 } | |
1392 v26 = v22; | |
1393 GameUI_SetFooterString(v26); | |
1394 if ( pMouse->uPointingObjectID == 0 ) | |
1395 { | |
1396 if ( uLastPointedObjectID != 0 ) | |
1397 { | |
1398 pFooterString[0] = 0; | |
1399 bForceDrawFooter = 1; | |
1400 } | |
1401 } | |
1402 uLastPointedObjectID = pMouse->uPointingObjectID; | |
1403 return; | |
1404 } | |
1405 } | |
1406 pMouse->uPointingObjectID = 0; | |
1407 uLastPointedObjectID = 1; | |
1408 if ( pMouse->uPointingObjectID == 0 ) | |
1409 { | |
1410 if ( uLastPointedObjectID != 0 ) | |
1411 { | |
1412 pFooterString[0] = 0; | |
1413 bForceDrawFooter = 1; | |
1414 } | |
1415 } | |
1416 uLastPointedObjectID = pMouse->uPointingObjectID; | |
1417 return; | |
1418 } | |
1419 pMouse->uPointingObjectID = 0; | |
1420 if ( pMouse->uPointingObjectID == 0 ) | |
1421 { | |
1422 if ( uLastPointedObjectID != 0 ) | |
1423 { | |
1424 pFooterString[0] = 0; | |
1425 bForceDrawFooter = 1; | |
1426 } | |
1427 } | |
1428 uLastPointedObjectID = pMouse->uPointingObjectID; | |
1429 return; | |
1430 } | |
1431 if ( v18 >= 335544320 ) | |
1432 { | |
1433 pMouse->uPointingObjectID = 0; | |
1434 if ( pMouse->uPointingObjectID == 0 ) | |
1435 { | |
1436 if ( uLastPointedObjectID != 0 ) | |
1437 { | |
1438 pFooterString[0] = 0; | |
1439 bForceDrawFooter = 1; | |
1440 } | |
1441 } | |
1442 uLastPointedObjectID = pMouse->uPointingObjectID; | |
1443 return; | |
1444 } | |
1445 pActor = &pActors[v19]; | |
1446 v28 = pTmpBuf.data(); | |
1447 v29 = pActor->dword_000334_unique_name; | |
1448 if ( v29 ) | |
1449 v40 = pMonsterStats->pPlaceStrings[v29]; | |
1450 else | |
1451 v40 = pMonsterStats->pInfos[pActor->pMonsterInfo.uID].pName; | |
1452 strncpy(pTmpBuf.data(), v40, 0x7D0u); | |
1453 } | |
1454 v26 = v28; | |
1455 GameUI_SetFooterString(v26); | |
1456 if ( pMouse->uPointingObjectID == 0 ) | |
1457 { | |
1458 if ( uLastPointedObjectID != 0 ) | |
1459 { | |
1460 pFooterString[0] = 0; | |
1461 bForceDrawFooter = 1; | |
1462 } | |
1463 } | |
1464 uLastPointedObjectID = pMouse->uPointingObjectID; | |
1465 return; | |
1466 } | |
1467 v1 = uNumVisibleWindows; | |
1468 if ( uNumVisibleWindows > 0 ) | |
1469 { | |
1470 while ( 1 ) // some other fullscreen ui | |
1471 { | |
1472 pWindow = &pWindowList[pVisibleWindowsIdxs[v1] - 1]; | |
1473 if ( (signed int)pX >= (signed int)pWindow->uFrameX | |
1474 && (signed int)pX <= (signed int)pWindow->uFrameZ | |
1475 && (signed int)pY >= (signed int)pWindow->uFrameY | |
1476 && (signed int)pY <= (signed int)pWindow->uFrameW ) | |
1477 { | |
1478 for ( pButton = pWindow->pControlsHead; ; pButton = pButton->pNext ) | |
1479 { | |
1480 if ( !pButton ) | |
1481 break; | |
1482 if ( pButton->uButtonType == 1 ) | |
1483 { | |
1484 if ( (signed int)pX >= (signed int)pButton->uX | |
1485 && (signed int)pX <= (signed int)pButton->uZ | |
1486 && (signed int)pY >= (signed int)pButton->uY | |
1487 && (signed int)pY <= (signed int)pButton->uW ) | |
1488 { | |
1489 pMessageType1 = (UIMessageType)pButton->field_1C; | |
1490 if ( pMessageType1 ) | |
1491 { | |
1492 pMessageQueue_50CBD0->AddMessage(pMessageType1, pButton->msg_param, 0); | |
1493 } | |
1494 v13 = pButton->pButtonName; | |
1495 GameUI_SetFooterString(v13); | |
1496 uLastPointedObjectID = 1; | |
1497 return; | |
1498 } | |
1499 } | |
1500 else | |
1501 { | |
1502 if ( pButton->uButtonType == 2 ) | |
1503 { | |
1504 v45 = pX - pButton->uX; | |
1505 v45 = pY - pButton->uY; | |
1506 if ( (double)(signed int)pButton->uWidth != 0.0 ) | |
1507 { | |
1508 if ( (double)(signed int)pButton->uHeight != 0.0 ) | |
1509 { | |
1510 pMessageType1 = (UIMessageType)pButton->field_1C; | |
1511 if ( pMessageType1 ) | |
1512 { | |
1513 pMessageQueue_50CBD0->AddMessage(pMessageType1, pButton->msg_param, 0); | |
1514 } | |
1515 v13 = pButton->pButtonName; | |
1516 GameUI_SetFooterString(v13); | |
1517 uLastPointedObjectID = 1; | |
1518 return; | |
1519 //} | |
1520 } | |
1521 } | |
1522 } | |
1523 else // click on skill | |
1524 { | |
1525 if ( pButton->uButtonType == 3 | |
1526 && (signed int)pX >= (signed int)pButton->uX | |
1527 && (signed int)pX <= (signed int)pButton->uZ | |
1528 && (signed int)pY >= (signed int)pButton->uY | |
1529 && (signed int)pY <= (signed int)pButton->uW ) | |
1530 { | |
1531 pPlayer = pPlayers[uActiveCharacter]; | |
1532 v5 = LOBYTE(pPlayer->pActiveSkills[pButton->msg_param]); | |
1533 v6 = pPlayer->uSkillPoints; | |
1534 v7 = (v5 & 0x3F) + 1; | |
1535 if ( v6 < v7 ) | |
1536 { | |
1537 v41 = v7 - v6; | |
1538 v39 = pGlobalTXT_LocalizationStrings[469];// "You need %d more Skill Points to advance here" | |
1539 } | |
1540 else | |
1541 { | |
1542 v41 = v7; | |
1543 v39 = pGlobalTXT_LocalizationStrings[468];// "Clicking here will spend %d Skill Points" | |
1544 } | |
1545 sprintf(Str1, v39, v41); | |
1546 v13 = Str1; | |
1547 GameUI_SetFooterString(v13); | |
1548 uLastPointedObjectID = 1; | |
1549 return; | |
1550 } | |
1551 } | |
1552 } | |
1553 } | |
1554 } | |
1555 if ( pWindow->uFrameHeight == 480 ) | |
1556 break; | |
1557 --v1; | |
1558 if ( v1 <= 0 ) | |
1559 { | |
1560 break; | |
1561 } | |
1562 } | |
1563 } | |
1564 if ( uNumVisibleWindows <= 0 || (uNumVisibleWindows > 0 && pWindow->uFrameHeight != 480 && v1 <= 0)) | |
1565 { | |
1566 if ( pCurrentScreen == SCREEN_CHEST ) | |
1567 { | |
1414 | 1568 ChestUI_WritePointedObjectStatusString(); |
1298 | 1569 if ( pMouse->uPointingObjectID == 0 ) |
1570 { | |
1571 if ( uLastPointedObjectID != 0 ) | |
1572 { | |
1573 pFooterString[0] = 0; | |
1574 bForceDrawFooter = 1; | |
1575 } | |
1576 } | |
1577 uLastPointedObjectID = pMouse->uPointingObjectID; | |
1578 return; | |
1579 } | |
1580 if ( pCurrentScreen == SCREEN_HOUSE ) | |
1581 { | |
1582 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD | |
1583 || (v16 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]], v16 == 0) | |
1584 || v16 == -65536 ) | |
1585 { | |
1586 if ( pMouse->uPointingObjectID == 0 ) | |
1587 { | |
1588 if ( uLastPointedObjectID != 0 ) | |
1589 { | |
1590 pFooterString[0] = 0; | |
1591 bForceDrawFooter = 1; | |
1592 } | |
1593 } | |
1594 uLastPointedObjectID = pMouse->uPointingObjectID; | |
1595 return; | |
1596 } | |
1597 pItemGen = (ItemGen *)((char *)&pParty->pPickedItem + 36 * (v16 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 4); | |
1598 v17 = pItemGen->GetDisplayName(); | |
1599 GameUI_SetFooterString(v17); | |
1600 uLastPointedObjectID = 1; | |
1601 if ( pMouse->uPointingObjectID == 0 ) | |
1602 { | |
1603 if ( uLastPointedObjectID != 0 ) | |
1604 { | |
1605 pFooterString[0] = 0; | |
1606 bForceDrawFooter = 1; | |
1607 } | |
1608 } | |
1609 uLastPointedObjectID = pMouse->uPointingObjectID; | |
1610 return; | |
1611 } | |
1612 if ( (signed int)pY < 350 ) | |
1613 { | |
1614 v14 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]]; | |
1615 if ( v14 == 0 || v14 == -65536 || (unsigned int)v14 >= 0x1388 ) | |
1616 { | |
1617 if ( pMouse->uPointingObjectID == 0 ) | |
1618 { | |
1619 if ( uLastPointedObjectID != 0 ) | |
1620 { | |
1621 pFooterString[0] = 0; | |
1622 bForceDrawFooter = 1; | |
1623 } | |
1624 } | |
1625 uLastPointedObjectID = pMouse->uPointingObjectID; | |
1626 return; | |
1627 } | |
1384
b51332ab228f
changed a few member variables in Player to slightly less confusing names
Grumpy7
parents:
1362
diff
changeset
|
1628 pItemGen = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItemList[v14-1]; |
1298 | 1629 v17 = pItemGen->GetDisplayName(); |
1630 GameUI_SetFooterString(v17); | |
1631 uLastPointedObjectID = 1; | |
1632 if ( pMouse->uPointingObjectID == 0 ) | |
1633 { | |
1634 if ( uLastPointedObjectID != 0 ) | |
1635 { | |
1636 pFooterString[0] = 0; | |
1637 bForceDrawFooter = 1; | |
1638 } | |
1639 } | |
1640 uLastPointedObjectID = pMouse->uPointingObjectID; | |
1641 return; | |
1642 } | |
1643 _click_on_game_ui: | |
1644 if ( (signed int)pX >= (signed int)pWindowList[0].uFrameX | |
1645 && (signed int)pX <= (signed int)pWindowList[0].uFrameZ | |
1646 && (signed int)pY >= (signed int)pWindowList[0].uFrameY | |
1647 && (signed int)pY <= (signed int)pWindowList[0].uFrameW ) | |
1648 { | |
1649 for ( pButton = pWindowList[0].pControlsHead; pButton != (GUIButton *)0; pButton = pButton->pNext ) | |
1650 { | |
1651 if ( pButton->uButtonType == 1 ) | |
1652 { | |
1653 if ( (signed int)pX >= (signed int)pButton->uX | |
1654 && (signed int)pX <= (signed int)pButton->uZ | |
1655 && (signed int)pY >= (signed int)pButton->uY | |
1656 && (signed int)pY <= (signed int)pButton->uW ) | |
1657 { | |
1658 pMessageType3 = (UIMessageType)pButton->field_1C; | |
1659 if ( pMessageType3 == 0 ) // For books | |
1660 { | |
1661 v13 = pButton->pButtonName; | |
1662 GameUI_SetFooterString(v13); | |
1663 uLastPointedObjectID = 1; | |
1664 return; | |
1665 } | |
1666 | |
1667 pMessageQueue_50CBD0->AddMessage(pMessageType3, pButton->msg_param, 0); | |
1668 uLastPointedObjectID = 1; | |
1669 return; | |
1670 } | |
1671 } | |
1672 else | |
1673 { | |
1674 if ( pButton->uButtonType == 2 ) | |
1675 { | |
1676 v45 = pX - pButton->uX; | |
1677 v45 = pY - pButton->uY; | |
1678 | |
1679 if (pX >= pButton->uX && pX <= pButton->uZ && | |
1680 pY >= pButton->uY && pY <= pButton->uW) | |
1681 if ( (double)(signed int)pButton->uWidth != 0.0 ) | |
1682 { | |
1683 if ( (double)(signed int)pButton->uHeight != 0.0 ) | |
1684 { | |
1685 //UNDEF(v32); | |
1686 //if ( v33 | v34 ) | |
1687 //{ | |
1688 pMessageType2 = (UIMessageType)pButton->field_1C; | |
1689 if ( pMessageType2 != 0 ) | |
1690 pMessageQueue_50CBD0->AddMessage(pMessageType2, pButton->msg_param, 0); | |
1691 | |
1692 v13 = pButton->pButtonName; | |
1693 GameUI_SetFooterString(v13); | |
1694 uLastPointedObjectID = 1; | |
1695 return; | |
1696 //} | |
1697 } | |
1698 } | |
1699 } | |
1700 else | |
1701 { | |
1702 if ( pButton->uButtonType == 3 | |
1703 && (signed int)pX >= (signed int)pButton->uX | |
1704 && (signed int)pX <= (signed int)pButton->uZ | |
1705 && (signed int)pY >= (signed int)pButton->uY | |
1706 && (signed int)pY <= (signed int)pButton->uW ) | |
1707 { | |
1708 pPlayer = pPlayers[uActiveCharacter]; | |
1709 v5 = LOBYTE(pPlayer->pActiveSkills[pButton->msg_param]); | |
1710 v6 = pPlayer->uSkillPoints; | |
1711 v7 = (v5 & 0x3F) + 1; | |
1712 if ( v6 < v7 ) | |
1713 { | |
1714 v41 = v7 - v6; | |
1715 v39 = pGlobalTXT_LocalizationStrings[469];// "You need %d more Skill Points to advance here" | |
1716 } | |
1717 else | |
1718 { | |
1719 v41 = v7; | |
1720 v39 = pGlobalTXT_LocalizationStrings[468];// "Clicking here will spend %d Skill Points" | |
1721 } | |
1722 sprintf(Str1, v39, v41); | |
1723 v13 = Str1; | |
1724 GameUI_SetFooterString(v13); | |
1725 uLastPointedObjectID = 1; | |
1726 return; | |
1727 } | |
1728 } | |
1729 } | |
1730 } | |
1731 } | |
1732 pMouse->uPointingObjectID = sub_46A99B(); | |
1733 if ( pMouse->uPointingObjectID == 0 ) | |
1734 { | |
1735 if ( uLastPointedObjectID != 0 ) | |
1736 { | |
1737 pFooterString[0] = 0; | |
1738 bForceDrawFooter = 1; | |
1739 } | |
1740 } | |
1741 uLastPointedObjectID = pMouse->uPointingObjectID; | |
1742 return; | |
1743 } | |
1744 } | |
1745 | |
1746 //----- (0044158F) -------------------------------------------------------- | |
1747 void GameUI_DrawCharacterSelectionFrame() | |
1748 { | |
1749 if ( uActiveCharacter ) | |
1750 pRenderer->DrawTextureTransparent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[uActiveCharacter - 1] - 9, 380, | |
1751 pIcons_LOD->GetTexture(uTextureID_GameUI_CharSelectionFrame)); | |
1752 } | |
1753 | |
1754 //----- (0044162D) -------------------------------------------------------- | |
1755 void GameUI_DrawPartySpells() | |
1756 { | |
1757 unsigned int v0; // ebp@1 | |
1758 Texture *v7; // [sp-4h] [bp-1Ch]@12 | |
1759 Texture *v9; // [sp-4h] [bp-1Ch]@21 | |
1760 | |
1761 v0 = (signed __int64)((double)GetTickCount() * 0.050000001); | |
1762 //v1 = 0; | |
1763 for (uint i = 0; i < 14; ++i) | |
1764 { | |
1765 //v2 = byte_4E5DD8[v1]; | |
1766 if (pParty->pPartyBuffs[byte_4E5DD8[i]].uExpireTime) | |
1767 { | |
1768 auto tex = pIcons_LOD->GetTexture(pTextureIDs_PartyBuffIcons[i]); | |
1769 //v3 = pTextureIDs_PartyBuffIcons[i]; | |
1770 pRenderer->_4A65CC(pPartySpellbuffsUI_XYs[i][0], | |
1771 pPartySpellbuffsUI_XYs[i][1], tex, tex, | |
1772 v0 + 20 * pPartySpellbuffsUI_smthns[i], 0, 63); | |
1773 } | |
1774 //++v1; | |
1775 } | |
1776 //while ( v1 < 14 ); | |
1777 | |
1778 if (pCurrentScreen == SCREEN_GAME || pCurrentScreen == SCREEN_NPC_DIALOGUE) | |
1779 { | |
1780 if (pParty->FlyActive()) | |
1781 { | |
1782 if ( pParty->bFlying ) | |
1783 v7 = pIcons_LOD->GetTexture(pIconsFrameTable->GetFrame(uIconIdx_FlySpell, v0)->uTextureID); | |
1784 else | |
1785 v7 = pIcons_LOD->GetTexture(pIconsFrameTable->GetFrame(uIconIdx_FlySpell, 0)->uTextureID); | |
1786 if ( pRenderer->pRenderD3D ) | |
1787 pRenderer->DrawTextureIndexed(8, 8, v7); | |
1788 else | |
1789 pRenderer->DrawTextureTransparent(8, 8, v7); | |
1790 } | |
1791 if (pParty->WaterWalkActive()) | |
1792 { | |
1793 if ( pParty->uFlags & PARTY_FLAGS_1_STANDING_ON_WATER) | |
1794 v9 = pIcons_LOD->GetTexture(pIconsFrameTable->GetFrame(uIconIdx_WaterWalk, v0)->uTextureID); | |
1795 else | |
1796 v9 = pIcons_LOD->GetTexture(pIconsFrameTable->GetFrame(uIconIdx_WaterWalk, 0)->uTextureID); | |
1797 if ( pRenderer->pRenderD3D ) | |
1798 pRenderer->DrawTextureIndexed(396u, 8u, v9); | |
1799 else | |
1800 pRenderer->DrawTextureTransparent(396u, 8u, v9); | |
1801 } | |
1802 } | |
1803 | |
1804 for (uint i = 0; i < 4; ++i) | |
1805 { | |
1806 auto player = pParty->pPlayers + i; | |
1807 | |
1808 if (player->pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].uExpireTime) | |
1809 pRenderer->DrawTextureIndexed(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72, 427, pIcons_LOD->GetTexture(uTextureID_PlayerBuff_Hammerhands)); | |
1810 if (player->pPlayerBuffs[PLAYER_BUFF_BLESS].uExpireTime) | |
1811 pRenderer->DrawTextureIndexed(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72, 393, pIcons_LOD->GetTexture(uTextureID_PlayerBuff_Bless)); | |
1812 if (player->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime) | |
1813 pRenderer->DrawTextureIndexed(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72, 410, pIcons_LOD->GetTexture(uTextureID_PlayerBuff_Preservation)); | |
1814 if (player->pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].uExpireTime) | |
1815 pRenderer->DrawTextureIndexed(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72, 444, pIcons_LOD->GetTexture(uTextureID_PlayerBuff_PainReflection)); | |
1816 } | |
1817 } | |
1818 | |
1819 //----- (004921C1) -------------------------------------------------------- | |
1820 void GameUI_DrawPortraits(unsigned int _this) | |
1821 { | |
1822 Texture *pFace; // eax@10 | |
1823 unsigned int v7; // eax@17 | |
1824 PlayerFrame *pFrame; // eax@21 | |
1825 unsigned int v9; // eax@27 | |
1826 bool v10; // eax@33 | |
1827 bool v11; // edi@40 | |
1828 bool v12; // edx@43 | |
1829 bool v13; // ecx@46 | |
1830 int v16; // eax@57 | |
1831 int v19; // eax@62 | |
1832 Texture *pPortrait; // [sp-4h] [bp-1Ch]@27 | |
1407 | 1833 //unsigned int v22; // [sp+14h] [bp-4h]@1 |
1298 | 1834 |
1407 | 1835 //v22 = _this; |
1298 | 1836 if ( qword_A750D8 ) |
1837 { | |
1838 qword_A750D8 -= (signed int)pMiscTimer->uTimeElapsed; | |
1839 if ( qword_A750D8 <= 0 ) | |
1840 { | |
1407 | 1841 if ( pPlayers[uSpeakingCharacter]->CanAct() ) |
1842 pPlayers[uSpeakingCharacter]->PlaySound(PlayerSpeechID, 0); | |
1298 | 1843 qword_A750D8 = 0i64; |
1844 } | |
1845 } | |
1846 | |
1847 for (uint i = 0; i < 4; ++i) | |
1848 { | |
1407 | 1849 Player* pPlayer = &pParty->pPlayers[i]; |
1298 | 1850 |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1340
diff
changeset
|
1851 if (pPlayer->IsEradicated()) |
1298 | 1852 { |
1853 pFace = pTexture_PlayerFaceEradicated; | |
1854 pPortrait = pFace; | |
1855 v9 = pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i]; | |
1856 if ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime ) | |
1857 pRenderer->_4A6E7E(v9, 0x183u, pPortrait); | |
1858 else | |
1859 pRenderer->DrawTextureTransparent(v9 + 1, 0x184u, pPortrait); | |
1860 auto _v1 = 0; | |
1861 v10 = pPlayer->pPlayerBuffs[14].uExpireTime > 0; | |
1862 if (pPlayer->pPlayerBuffs[1].uExpireTime > 0) | |
1863 _v1 = 1; | |
1864 v11 = pPlayer->pPlayerBuffs[8].uExpireTime > 0; | |
1865 v12 = pPlayer->pPlayerBuffs[7].uExpireTime > 0; | |
1866 v13 = pPlayer->pPlayerBuffs[13].uExpireTime > 0; | |
1867 if ( v13 | v12 | v11 | _v1 | v10 ) | |
1868 sub_441A4E(i); | |
1869 continue; | |
1870 } | |
1362
d6cf8ead9242
Condition checking functions slightly renamed, some final changes in Player::SetCondition
Grumpy7
parents:
1340
diff
changeset
|
1871 if (pPlayer->IsDead()) |
1298 | 1872 { |
1873 pFace = pTexture_PlayerFaceDead; | |
1874 pPortrait = pFace; | |
1875 v9 = pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i]; | |
1876 if ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime ) | |
1877 pRenderer->_4A6E7E(v9, 0x183u, pPortrait); | |
1878 else | |
1879 pRenderer->DrawTextureTransparent(v9 + 1, 0x184u, pPortrait); | |
1880 auto _v1 = 0; | |
1881 v10 = pPlayer->pPlayerBuffs[14].uExpireTime > 0; | |
1882 if (pPlayer->pPlayerBuffs[1].uExpireTime > 0) | |
1883 _v1 = 1; | |
1884 v11 = pPlayer->pPlayerBuffs[8].uExpireTime > 0; | |
1885 v12 = pPlayer->pPlayerBuffs[7].uExpireTime > 0; | |
1886 v13 = pPlayer->pPlayerBuffs[13].uExpireTime > 0; | |
1887 if ( v13 | v12 | v11 | _v1 | v10 ) | |
1888 sub_441A4E(i); | |
1889 continue; | |
1890 } | |
1891 v7 = 0; | |
1892 for (uint j = 0; j < pPlayerFrameTable->uNumFrames; ++j) | |
1893 if (pPlayerFrameTable->pFrames[j].expression == pPlayer->expression) | |
1894 { | |
1895 v7 = j; | |
1896 break; | |
1897 } | |
1898 if ( v7 == 0 ) | |
1899 v7 = 1; | |
1900 if (pPlayer->expression == CHARACTER_EXPRESSION_21) | |
1901 pFrame = pPlayerFrameTable->GetFrameBy_y(&pPlayer->_expression21_frameset, &pPlayer->_expression21_animtime, pMiscTimer->uTimeElapsed); | |
1902 else | |
1903 pFrame = pPlayerFrameTable->GetFrameBy_x(v7, pPlayer->uExpressionTimePassed); | |
1407 | 1904 if (pPlayer->field_1AA2 != pFrame->uTextureID - 1 || _this ) |
1298 | 1905 { |
1906 pPlayer->field_1AA2 = pFrame->uTextureID - 1; | |
1907 pFace = (Texture *)pTextures_PlayerFaces[i][pPlayer->field_1AA2];//pFace = (Texture *)pTextures_PlayerFaces[i][pFrame->uTextureID]; | |
1908 pPortrait = pFace; | |
1909 v9 = pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i]; | |
1910 if ( pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime ) | |
1911 pRenderer->_4A6E7E(v9, 0x183u, pPortrait); | |
1912 else | |
1913 pRenderer->DrawTextureTransparent(v9 + 1, 0x184u, pPortrait); | |
1914 auto _v1 = 0; | |
1915 v10 = pPlayer->pPlayerBuffs[14].uExpireTime > 0; | |
1916 if (pPlayer->pPlayerBuffs[1].uExpireTime > 0) | |
1917 _v1 = 1; | |
1918 v11 = pPlayer->pPlayerBuffs[8].uExpireTime > 0; | |
1919 v12 = pPlayer->pPlayerBuffs[7].uExpireTime > 0; | |
1920 v13 = pPlayer->pPlayerBuffs[13].uExpireTime > 0; | |
1921 if ( v13 | v12 | v11 | _v1 | v10 ) | |
1922 sub_441A4E(i); | |
1923 continue; | |
1924 } | |
1925 } | |
1926 if ( pParty->bTurnBasedModeOn == 1 ) | |
1927 { | |
1340 | 1928 if ( pTurnEngine->turn_stage != 1 ) |
1298 | 1929 { |
1930 if (PID_TYPE(pTurnEngine->pQueue[0].uPackedID) == OBJECT_Player) | |
1931 { | |
1932 //v14 = 0; | |
1933 if ( pTurnEngine->uActorQueueSize > 0 ) | |
1934 { | |
1935 //v15 = (char *)pTurnEngine->pQueue; | |
1936 for (uint i = 0; i < pTurnEngine->uActorQueueSize; ++i) | |
1937 { | |
1938 auto pElem = pTurnEngine->pQueue + i; | |
1939 | |
1940 if (PID_TYPE(pElem->uPackedID) != OBJECT_Player) | |
1941 break; | |
1942 v16 = dword_5079D0; | |
1943 if ( pParty->uFlags & 0x10 ) | |
1944 { | |
1945 v16 = dword_5079CC; | |
1946 } | |
1947 else | |
1948 { | |
1949 if ( pParty->uFlags & 0x20 ) | |
1950 v16 = dword_5079C8; | |
1951 } | |
1952 pRenderer->DrawTextureTransparent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[PID_ID(pElem->uPackedID)] - 4, 0x181u, pIcons_LOD->GetTexture(v16)); | |
1953 } | |
1954 } | |
1955 } | |
1956 } | |
1957 } | |
1958 else | |
1959 { | |
1960 for (uint i = 0; i < 4; ++i) | |
1961 { | |
1962 auto pPlayer = pParty->pPlayers + i; | |
1963 if (pPlayer->CanAct() && !pPlayer->uTimeToRecovery) | |
1964 { | |
1965 v19 = dword_5079D0; | |
1966 if ( pParty->uFlags & 0x10 ) | |
1967 { | |
1968 v19 = dword_5079CC; | |
1969 } | |
1970 else | |
1971 { | |
1972 if ( pParty->uFlags & 0x20 ) | |
1973 v19 = dword_5079C8; | |
1974 } | |
1975 pRenderer->DrawTextureTransparent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] - 4, 0x181u, pIcons_LOD->GetTexture(v19)); | |
1976 } | |
1977 } | |
1978 } | |
1979 } | |
1980 | |
1981 //----- (00441D38) -------------------------------------------------------- | |
1982 void GameUI_DrawMinimap(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW, unsigned int uZoom, unsigned int bRedrawOdmMinimap) | |
1983 { | |
1984 int uHeight; // ebx@6 | |
1985 __int16 v11; // cx@11 | |
1986 unsigned int v14; // ebx@23 | |
1987 int v15; // eax@23 | |
1988 __int16 v17; // di@30 | |
1989 double v18; // st7@30 | |
1990 float v19; // ST38_4@30 | |
1991 double v20; // st7@30 | |
1992 double v21; // st6@30 | |
1993 double v22; // st5@33 | |
1994 signed int v27; // eax@37 | |
1995 unsigned __int16 *v28; // ecx@37 | |
1996 signed int v29; // edi@40 | |
1997 //signed int v33; // ebx@50 | |
1998 //unsigned int v34; // eax@50 | |
1999 //signed int v35; // ecx@50 | |
2000 //unsigned __int16 v36; // di@66 | |
2001 int v37; // edi@72 | |
2002 int v38; // ebx@72 | |
2003 __int16 v39; // ax@87 | |
2004 int v40; // edi@91 | |
2005 int v41; // ebx@91 | |
2006 unsigned int v42; // eax@101 | |
2007 unsigned int v43; // ebx@101 | |
2008 unsigned int v44; // ST30_4@101 | |
2009 char *v45; // ebx@106 | |
2010 int v46; // edi@108 | |
2011 int v47; // eax@108 | |
2012 unsigned int v48; // ebx@114 | |
2013 unsigned int v49; // ST64_4@114 | |
2014 //unsigned int v51; // [sp-10h] [bp-64h]@79 | |
2015 unsigned int v52; // [sp-10h] [bp-64h]@100 | |
2016 //unsigned int v53; // [sp-Ch] [bp-60h]@79 | |
2017 unsigned int v54; // [sp-Ch] [bp-60h]@100 | |
2018 //unsigned int v55; // [sp-8h] [bp-5Ch]@77 | |
2019 unsigned int v56; // [sp-8h] [bp-5Ch]@100 | |
2020 //signed int v57; // [sp-4h] [bp-58h]@54 | |
2021 //unsigned __int16 v58; // [sp-4h] [bp-58h]@77 | |
2022 unsigned __int16 v59; // [sp-4h] [bp-58h]@100 | |
2023 //unsigned __int16 v60; // [sp+10h] [bp-44h]@66 | |
2024 //unsigned int v61; // [sp+10h] [bp-44h]@85 | |
2025 //unsigned int v63; // [sp+14h] [bp-40h]@85 | |
2026 //unsigned int v65; // [sp+18h] [bp-3Ch]@85 | |
2027 unsigned int lPitch; // [sp+20h] [bp-34h]@1 | |
2028 unsigned int lPitcha; // [sp+20h] [bp-34h]@23 | |
2029 char *lPitchb; // [sp+20h] [bp-34h]@106 | |
2030 unsigned int v69; // [sp+24h] [bp-30h]@23 | |
2031 signed int v70; // [sp+24h] [bp-30h]@37 | |
2032 //unsigned __int16 uBlue; // [sp+28h] [bp-2Ch]@1 | |
2033 signed int uBluea; // [sp+28h] [bp-2Ch]@37 | |
2034 int v73; // [sp+2Ch] [bp-28h]@30 | |
2035 int v76; // [sp+34h] [bp-20h]@91 | |
2036 int v77; // [sp+34h] [bp-20h]@108 | |
2037 //int v79; // [sp+38h] [bp-1Ch]@72 | |
2038 //char *a2c; // [sp+40h] [bp-14h]@68 | |
2039 signed int uCenterY; // [sp+48h] [bp-Ch]@1 | |
2040 signed int uCenterX; // [sp+4Ch] [bp-8h]@1 | |
2041 signed int uWidth; // [sp+5Ch] [bp+8h]@30 | |
2042 //signed int uZe; // [sp+5Ch] [bp+8h]@67 | |
2043 signed int uZf; // [sp+5Ch] [bp+8h]@85 | |
2044 signed int uZg; // [sp+5Ch] [bp+8h]@105 | |
2045 unsigned int uWa; // [sp+60h] [bp+Ch]@23 | |
2046 float uWb; // [sp+60h] [bp+Ch]@30 | |
2047 unsigned int uWd; // [sp+60h] [bp+Ch]@95 | |
2048 float uZooma; // [sp+64h] [bp+10h]@117 | |
2049 //unsigned int flagsb; // [sp+68h] [bp+14h]@66 | |
2050 Actor *flagsc; // [sp+68h] [bp+14h]@86 | |
2051 //unsigned int flagsd; // [sp+68h] [bp+14h]@105 | |
2052 | |
2053 uCenterX = (uX + uZ) / 2; | |
2054 uCenterY = (uY + uW) / 2; | |
2055 lPitch = pRenderer->uTargetSurfacePitch; | |
2056 //TargetColor(0, 0, 0); | |
2057 //uBlue = TargetColor(0, 0, 0xFFu); | |
2058 auto bWizardEyeActive = pParty->WizardEyeActive(); | |
2059 auto uWizardEyeSkillLevel = pParty->WizardEyeSkillLevel(); | |
2060 if (CheckHiredNPCSpeciality(Cartographer)) | |
2061 { | |
2062 bWizardEyeActive = true; | |
2063 uWizardEyeSkillLevel = 2; | |
2064 } | |
2065 bWizardEyeActive = true; | |
2066 uWizardEyeSkillLevel = 3; | |
2067 pRenderer->SetRasterClipRect(uX, uY, uZ - 1, uW - 1); | |
2068 uHeight = uW - uY; | |
2069 uWidth = uZ - uX; | |
2070 | |
2071 if ( uCurrentlyLoadedLevelType != LEVEL_Indoor) | |
2072 { | |
2073 v17 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2; | |
2074 auto pMapLod0 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pLevelOfDetail0_prolly_alpha_mask; | |
2075 auto pPal = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pPalette16; | |
2076 v73 = (1 << (v17 + 16)) / (signed int)uZoom; | |
2077 v18 = (double)(1 << (16 - v17)); | |
2078 v19 = v18; | |
2079 v20 = (double)(pParty->vPosition.x + 32768) / v18; | |
2080 v21 = (double)(32768 - pParty->vPosition.y) / v19; | |
2081 uWb = v21; | |
2082 switch (uZoom) | |
2083 { | |
2084 case 512: | |
2085 { | |
2086 v20 = v20 - (double)(uWidth / 2); | |
2087 v22 = (double)(uHeight / 2); | |
2088 uWb = v21 - v22; | |
2089 } | |
2090 break; | |
2091 | |
2092 case 1024: | |
2093 { | |
2094 v20 = v20 - (double)(uWidth / 4); | |
2095 v22 = (double)(uHeight / 4); | |
2096 uWb = v21 - v22; | |
2097 } | |
2098 break; | |
2099 | |
2100 case 2048: | |
2101 { | |
2102 v20 = v20 - (double)(uWidth / 8); | |
2103 v22 = (double)(uHeight / 8); | |
2104 uWb = v21 - v22; | |
2105 } | |
2106 break; | |
2107 | |
2108 default: assert(false); | |
2109 } | |
2110 assert(sizeof(pOdmMinimap) == 137 * 117 * sizeof(short)); | |
2111 | |
2112 v70 = floorf(v20 * 65536.0 + 0.5f);//LODWORD(v24); | |
2113 uBluea = floorf(uWb * 65536.0 + 0.5f);//LODWORD(v25); | |
2114 v27 = uBluea >> 16; | |
2115 v28 = &pRenderer->pTargetSurface[uX + uY * lPitch]; | |
2116 if (pMapLod0 && bRedrawOdmMinimap) | |
2117 { | |
2118 assert(uWidth == 137 && uHeight == 117); | |
2119 //auto pMinimap = (unsigned __int16 *)pOdmMinimap; | |
2120 | |
2121 auto mapWidth = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uTextureWidth; | |
2122 | |
2123 v29 = v70 >> 16; | |
2124 | |
2125 for (int y = 0; y < uHeight; ++y) | |
2126 { | |
2127 auto pMapLod0Line = &pMapLod0[v27 * mapWidth]; | |
2128 for (int x = 0; x < uWidth; ++x) | |
2129 { | |
2130 //*pMinimap++ = pPal[pMapLod0Line[v29]]; | |
2131 pOdmMinimap[y][x] = pPal[pMapLod0Line[v29]]; | |
2132 v29 = (v70 + x * v73) >> 16; | |
2133 } | |
2134 | |
2135 v29 = v70 >> 16; | |
2136 v28 += 137 - uWidth; | |
2137 uBluea += v73; | |
2138 v27 = uBluea >> 16; | |
2139 } | |
2140 } | |
2141 | |
2142 for (int y = 0; y < 117; ++y) | |
2143 { | |
2144 for (int x = 0; x < 137; ++x) | |
2145 { | |
2146 *v28++ = pOdmMinimap[y][x]; | |
2147 } | |
2148 v28 += lPitch - 137; | |
2149 } | |
2150 uNumBlueFacesInBLVMinimap = 0; | |
2151 } | |
2152 else | |
2153 { | |
2154 pRenderer->FillRectFast(uX, uY, uZ - uX, uHeight, 0xF); | |
2155 uNumBlueFacesInBLVMinimap = 0; | |
2156 | |
2157 for (uint i = 0; i < pIndoor->pMapOutlines->uNumOutlines; ++i) | |
2158 { | |
2159 auto pOutline = &pIndoor->pMapOutlines->pOutlines[i]; | |
2160 | |
2161 auto pFace1 = pIndoor->pFaces + pOutline->uFace1ID; | |
2162 auto pFace2 = pIndoor->pFaces + pOutline->uFace2ID; | |
2163 //v9 = pIndoor->pFaces[pMapVertex->uFace1ID].uAttributes; | |
2164 //v10 = pIndoor->pFaces[pMapVertex->uFace2ID].uAttributes; | |
2165 if (pFace1->Visible() && pFace2->Visible()) | |
2166 { | |
2167 v11 = pOutline->uFlags; | |
2168 if ( v11 & 1 ) | |
2169 goto LABEL_15; | |
2170 if (pFace1->uAttributes & 0x80 || pFace2->uAttributes & 0x80) | |
2171 goto LABEL_ABC; | |
2172 | |
2173 } | |
2174 continue; | |
2175 | |
2176 LABEL_ABC: | |
2177 pOutline->uFlags = v11 | 1; | |
2178 pIndoor->_visible_outlines[i >> 3] |= 1 << (7 - i % 8); | |
2179 | |
2180 LABEL_15: | |
2181 //v12 = &pIndoor->pFaces[pOutline->uFace1ID]; | |
2182 if (bWizardEyeActive && uWizardEyeSkillLevel >= 3 && | |
2183 (pFace1->uAttributes & 0x2000 || pFace2->uAttributes & 0x2000) && | |
2184 (pIndoor->pFaceExtras[pFace1->uFaceExtraID].uEventID || pIndoor->pFaceExtras[pFace2->uFaceExtraID].uEventID)) | |
2185 { | |
2186 if (uNumBlueFacesInBLVMinimap < 49) | |
2187 pBlueFacesInBLVMinimapIDs[uNumBlueFacesInBLVMinimap++] = i; | |
2188 } | |
2189 else | |
2190 { | |
2191 auto _a = (uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].x); | |
2192 auto _b = ((unsigned int)((unsigned __int64)_a >> 16) << 16); | |
2193 auto _c = ((signed int)(_b - uZoom * pParty->vPosition.x) >> 16); | |
2194 v69 = uCenterX + _c; | |
2195 v69 = uCenterX + ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].x) >> 16) << 16) - uZoom * pParty->vPosition.x) >> 16); | |
2196 lPitcha = uCenterY - ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].y) >> 16) << 16) - uZoom * pParty->vPosition.y) >> 16); | |
2197 uWa = uCenterX + ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex2ID].x) >> 16) << 16) - uZoom * pParty->vPosition.x) >> 16); | |
2198 v14 = uCenterY - ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex2ID].y) >> 16) << 16) - uZoom * pParty->vPosition.y) >> 16); | |
2199 v15 = abs(pOutline->sZ - pParty->vPosition.z) / 8; | |
2200 if ( v15 > 100 ) | |
2201 v15 = 100; | |
2202 pRenderer->RasterLine2D(v69, lPitcha, uWa, v14, viewparams->pPalette[-v15 + 200]); | |
2203 } | |
2204 } | |
2205 | |
2206 | |
2207 for (uint i = 0; i < uNumBlueFacesInBLVMinimap; ++i) | |
2208 { | |
2209 //v16 = (uint *)&pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[uZb]]; | |
2210 auto pOutline = &pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[i]]; | |
2211 pRenderer->RasterLine2D(uCenterX + ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom | |
2212 * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].x) >> 16) << 16) | |
2213 - uZoom * pParty->vPosition.x) >> 16), | |
2214 uCenterY | |
2215 - ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom | |
2216 * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].y) >> 16) << 16) | |
2217 - uZoom * pParty->vPosition.y) >> 16), | |
2218 uCenterX | |
2219 + ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom | |
2220 * (signed __int64)pIndoor->pVertices[pOutline->uVertex2ID].x) >> 16) << 16) | |
2221 - uZoom * pParty->vPosition.x) >> 16), | |
2222 uCenterY | |
2223 - ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom | |
2224 * (signed __int64)pIndoor->pVertices[pOutline->uVertex2ID].y) >> 16) << 16) | |
2225 - uZoom * pParty->vPosition.y) >> 16), | |
2226 ui_game_minimap_outline_color); | |
2227 } | |
2228 } | |
2229 | |
2230 | |
2231 assert(pParty->sRotationY >= 0); | |
2232 float angle = (pParty->sRotationY % 2048) / 2048.0f; | |
2233 const float two_pi = 2.0f * 3.14159f; | |
2234 | |
2235 uint arrow_idx = floorf(0.5f + 7 * angle); | |
2236 pRenderer->DrawTextureTransparent(uCenterX - 3, uCenterY - 3, pIcons_LOD->GetTexture(pTextureIDs_pMapDirs[arrow_idx])); | |
2237 | |
2238 //flagsb = TargetColor(0, 0, 255); | |
2239 //v60 = TargetColor(255, 0, 0); | |
2240 if (bWizardEyeActive) | |
2241 { | |
2242 //uZe = 0; | |
2243 if (uWizardEyeSkillLevel >= 2) | |
2244 for (uint i = 0; i < uNumSpriteObjects; ++i) | |
2245 //if (uNumSpriteObjects > 0) | |
2246 { | |
2247 auto object = &pSpriteObjects[i]; | |
2248 | |
2249 //a2c = (char *)&pSpriteObjects[0].uObjectDescID; | |
2250 //while ( 1 ) | |
2251 //{ | |
2252 if (!object->uType || !object->uObjectDescID) | |
2253 continue; | |
2254 //if (uWizardEyeSkillLevel == 1 | |
2255 v37 = uCenterX + ((unsigned __int64)((object->vPosition.x - pParty->vPosition.x) * (signed __int64)uZoom) >> 16); | |
2256 //v79 = (unsigned __int64)((object->vPosition.y - pParty->vPosition.y) * (signed __int64)(signed int)uZoom) >> 16; | |
2257 //v38 = uCenterY - v79; | |
2258 v38 = uCenterY - ((signed __int64)((object->vPosition.y - pParty->vPosition.y) * (signed __int64)uZoom) >> 16); | |
2259 if (v37 < pRenderer->raster_clip_x || v37 > pRenderer->raster_clip_z || | |
2260 v38 < pRenderer->raster_clip_y || v38 > pRenderer->raster_clip_w) | |
2261 continue; | |
2262 | |
2263 assert(uZoom >= 512); | |
2264 if (pObjectList->pObjects[object->uObjectDescID].uFlags & OBJECT_DESC_UNPICKABLE) | |
2265 { | |
2266 pRenderer->RasterLine2D(v37, v38, v37, v38, ui_game_minimap_projectile_color); | |
2267 } | |
2268 else if (uZoom > 512) | |
2269 { | |
2270 pRenderer->RasterLine2D(v37 - 1, v38 - 1, v37 - 1, v38 + 1, ui_game_minimap_treasure_color); | |
2271 pRenderer->RasterLine2D(v37, v38 - 2, v37, v38 + 1, ui_game_minimap_treasure_color); | |
2272 pRenderer->RasterLine2D(v37 + 1, v38 - 1, v37 + 1, v38 + 1, ui_game_minimap_treasure_color); | |
2273 pRenderer->RasterLine2D(v37 - 2, v38, v37 - 2, v38 + 1, ui_game_minimap_treasure_color); | |
2274 pRenderer->RasterLine2D(v37 + 2, v38, | |
2275 v37 + 2, v38 + 1, ui_game_minimap_treasure_color); | |
2276 } | |
2277 else | |
2278 { | |
2279 pRenderer->RasterLine2D(v37 - 1, v38 - 1, | |
2280 v37 - 1, v38, ui_game_minimap_treasure_color); | |
2281 pRenderer->RasterLine2D(v37, v38 - 1, | |
2282 v37, v38, ui_game_minimap_treasure_color); | |
2283 } | |
2284 //LABEL_82: | |
2285 //LABEL_83: | |
2286 //++uZe; | |
2287 //a2c += 112; | |
2288 //if ( uZe >= (signed int)uNumSpriteObjects ) | |
2289 //{ | |
2290 //goto LABEL_85; | |
2291 //} | |
2292 //} | |
2293 } | |
2294 | |
2295 | |
2296 LABEL_85: | |
2297 //v63 = TargetColor(255, 0, 0); | |
2298 //v61 = TargetColor(0, 255, 0); | |
2299 //v65 = TargetColor(255, 255, 0); | |
2300 uZf = 0; | |
2301 if ( (signed int)uNumActors > 0 ) | |
2302 { | |
2303 flagsc = pActors.data();//[0].uAIState; | |
2304 do | |
2305 { | |
2306 v39 = flagsc->uAIState; | |
2307 if ( flagsc->uAIState != 11 && v39 != 19 && (v39 == 5 || BYTE1(flagsc->uAttributes) & 0x80) ) | |
2308 { | |
2309 v40 = ((unsigned __int64)(( flagsc->vPosition.x - pParty->vPosition.x) | |
2310 * (signed __int64)(signed int)uZoom) >> 16) | |
2311 + uCenterX; | |
2312 v76 = (unsigned __int64)(( flagsc->vPosition.y - pParty->vPosition.y) | |
2313 * (signed __int64)(signed int)uZoom) >> 16; | |
2314 v41 = uCenterY - v76; | |
2315 if ( v40 >= pRenderer->raster_clip_x ) | |
2316 { | |
2317 if ( v40 <= pRenderer->raster_clip_z && v41 >= pRenderer->raster_clip_y && v41 <= pRenderer->raster_clip_w ) | |
2318 { | |
2319 uWd = ui_game_minimap_actor_friendly_color; | |
2320 if ( BYTE3(flagsc->uAttributes) & 1 ) | |
2321 uWd = ui_game_minimap_actor_hostile_color; | |
2322 if ( flagsc->uAIState == Dead) | |
2323 uWd = ui_game_minimap_actor_corpse_color; | |
2324 if ( (signed int)uZoom > 1024 ) | |
2325 { | |
2326 pRenderer->RasterLine2D(v40 - 1, v41 - 2, v40 - 1, v41 + 2, uWd); | |
2327 pRenderer->RasterLine2D(v40, v41 - 2, v40, v41 + 2, uWd); | |
2328 pRenderer->RasterLine2D(v40 + 1, v41 - 2, v40 + 1, v41 + 2, uWd); | |
2329 v42 = v41 + 1; | |
2330 v43 = v41 - 1; | |
2331 v44 = v42; | |
2332 pRenderer->RasterLine2D(v40 - 2, v43, v40 - 2, v42, uWd); | |
2333 v40 += 2; | |
2334 v59 = uWd; | |
2335 v56 = v44; | |
2336 v54 = v40; | |
2337 v52 = v43; | |
2338 } | |
2339 else | |
2340 { | |
2341 pRenderer->RasterLine2D(v40 - 1, v41 - 1, v40 - 1, uCenterY - v76, uWd); | |
2342 v59 = uWd; | |
2343 v56 = uCenterY - v76; | |
2344 v54 = v40; | |
2345 v52 = v41 - 1; | |
2346 } | |
2347 pRenderer->RasterLine2D(v40, v52, v54, v56, v59); | |
2348 } | |
2349 } | |
2350 } | |
2351 ++uZf; | |
2352 ++flagsc; | |
2353 } | |
2354 while ( uZf < (signed int)uNumActors ); | |
2355 } | |
2356 } | |
2357 | |
2358 | |
2359 //flagsd = TargetColor(255, 255, 255); | |
2360 uZg = 0; | |
2361 if ( (signed int)uNumLevelDecorations > 0 ) | |
2362 { | |
2363 v45 = (char *)&pLevelDecorations[0].vPosition; | |
2364 lPitchb = (char *)&pLevelDecorations[0].vPosition; | |
2365 do | |
2366 { | |
2367 if ( *(v45 - 2) & 8 ) | |
2368 { | |
2369 v46 = ((unsigned __int64)((*(int *)v45 - pParty->vPosition.x) * (signed __int64)(signed int)uZoom) >> 16) | |
2370 + uCenterX; | |
2371 v77 = (unsigned __int64)((*((int *)v45 + 1) - pParty->vPosition.y) * (signed __int64)(signed int)uZoom) >> 16; | |
2372 v47 = uCenterY - v77; | |
2373 if ( v46 >= pRenderer->raster_clip_x ) | |
2374 { | |
2375 if ( v46 <= pRenderer->raster_clip_z && v47 >= pRenderer->raster_clip_y && v47 <= pRenderer->raster_clip_w ) | |
2376 { | |
2377 if ( (signed int)uZoom > 512 ) | |
2378 { | |
2379 v48 = v47 + 1; | |
2380 v49 = v47 - 1; | |
2381 pRenderer->RasterLine2D(v46 - 1, v47 - 1, v46 - 1, v47 + 1, ui_game_minimap_decoration_color_1); | |
2382 pRenderer->RasterLine2D(v46, v49, v46, v48, ui_game_minimap_decoration_color_1); | |
2383 pRenderer->RasterLine2D(v46 + 1, v49, v46 + 1, v48, ui_game_minimap_decoration_color_1); | |
2384 v45 = lPitchb; | |
2385 } | |
2386 else | |
2387 { | |
2388 pRenderer->RasterLine2D(v46, uCenterY - v77, v46, uCenterY - v77, ui_game_minimap_decoration_color_1); | |
2389 } | |
2390 } | |
2391 } | |
2392 } | |
2393 ++uZg; | |
2394 v45 += 32; | |
2395 lPitchb = v45; | |
2396 } | |
2397 while ( uZg < (signed int)uNumLevelDecorations ); | |
2398 } | |
2399 pRenderer->DrawTextureTransparent(0x1D4u, 0, pIcons_LOD->GetTexture(dword_5079D8)); | |
2400 uZooma = (double)pParty->sRotationY * 0.1171875; | |
2401 //v50 = uZooma + 6.7553994e15; | |
2402 pRenderer->SetTextureClipRect(541, 0, 567, 480); | |
2403 pRenderer->DrawTextureIndexed(floorf(uZooma + 0.5f) + 285, 136, pIcons_LOD->GetTexture(dword_5079B4)); | |
2404 pRenderer->ResetTextureClipRect(); | |
2405 } | |
2406 | |
2407 //----- (00441498) -------------------------------------------------------- | |
1458 | 2408 void GameUI_DrawTorchlightAndWizardEye() |
1298 | 2409 { |
2410 if (pCurrentScreen == SCREEN_GAME | |
2411 || pCurrentScreen == SCREEN_MENU | |
2412 || pCurrentScreen == SCREEN_OPTIONS | |
2413 || pCurrentScreen == SCREEN_REST | |
2414 || pCurrentScreen == SCREEN_SPELL_BOOK | |
2415 || pCurrentScreen == SCREEN_CHEST | |
2416 || pCurrentScreen == SCREEN_SAVEGAME | |
2417 || pCurrentScreen == SCREEN_LOADGAME | |
2418 || pCurrentScreen == SCREEN_CHEST_INVENTORY | |
2419 || pCurrentScreen == SCREEN_BOOKS | |
2420 || pCurrentScreen == SCREEN_BRANCHLESS_NPC_DIALOG ) | |
2421 { | |
2422 if (pParty->TorchlightActive()) | |
2423 { | |
2424 auto icon = pIconsFrameTable->GetFrame((signed __int16)pUIAnum_Torchlight->uIconID, pEventTimer->Time()); | |
2425 pRenderer->DrawTextureTransparent(pUIAnum_Torchlight->x, pUIAnum_Torchlight->y, pIcons_LOD->GetTexture(icon->uTextureID)); | |
2426 } | |
2427 if (pParty->WizardEyeActive()) | |
2428 { | |
2429 auto icon = pIconsFrameTable->GetFrame((signed __int16)pUIAnim_WizardEye->uIconID, pEventTimer->Time()); | |
2430 pRenderer->DrawTextureTransparent(pUIAnim_WizardEye->x, pUIAnim_WizardEye->y, pIcons_LOD->GetTexture(icon->uTextureID)); | |
2431 } | |
2432 } | |
2433 } | |
2434 // 4E28F8: using guessed type int pCurrentScreen; | |
2435 | |
2436 | |
2437 //----- (00491F87) -------------------------------------------------------- | |
2438 void GameUI_DrawHiredNPCs() | |
2439 { | |
2440 //int v6; // eax@15 | |
2441 char v7; // al@17 | |
2442 unsigned int v8; // eax@18 | |
2443 int v9; // esi@18 | |
2444 int v10; // eax@18 | |
2445 unsigned int v11; // eax@19 | |
2446 unsigned int v12; // esi@19 | |
2447 unsigned int v13; // eax@23 | |
2448 IconFrame *v14; // eax@24 | |
2449 unsigned int v15; // eax@26 | |
2450 char pContainer[20]; // [sp+Ch] [bp-30h]@18 | |
2451 unsigned int v17; // [sp+20h] [bp-1Ch]@19 | |
2452 signed int uFrameID; // [sp+24h] [bp-18h]@19 | |
2453 //int i; // [sp+28h] [bp-14h]@15 | |
2454 unsigned int v20; // [sp+2Ch] [bp-10h]@20 | |
2455 unsigned int v21; // [sp+30h] [bp-Ch]@19 | |
2456 int v22; // [sp+34h] [bp-8h]@2 | |
2457 unsigned __int8 v23; // [sp+3Bh] [bp-1h]@2 | |
2458 | |
2459 if ( bNoNPCHiring != 1 ) | |
2460 { | |
2461 v23 = 0; | |
2462 v22 = 0; | |
2463 /*for (uint i = 0; i < 2; ++i) | |
2464 { | |
2465 if (pParty->pHirelings[i].pName) | |
2466 pTmpBuf[v22++] = i; | |
2467 }*/ | |
2468 if (pParty->pHirelings[0].pName) | |
2469 pTmpBuf[v22++] = 0; | |
2470 if (pParty->pHirelings[1].pName) | |
2471 pTmpBuf[v22++] = 1; | |
2472 | |
2473 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i) | |
2474 { | |
2475 if (pNPCStats->pNewNPCData[i].uFlags & 128) | |
2476 { | |
2477 if (!pParty->pHirelings[0].pName || strcmp(pNPCStats->pNewNPCData[i].pName, pParty->pHirelings[0].pName)) | |
2478 { | |
2479 if (!pParty->pHirelings[1].pName || strcmp(pNPCStats->pNewNPCData[i].pName, pParty->pHirelings[1].pName)) | |
2480 pTmpBuf[v22++] = i + 2; | |
2481 } | |
2482 } | |
2483 } | |
2484 | |
2485 //v6 = (unsigned __int8)pParty->field_709; | |
2486 for ( int i = (unsigned __int8)pParty->field_709; i < v22 && v23 < 2; i++ ) | |
2487 { | |
2488 v7 = pTmpBuf[i]; | |
2489 if ( (unsigned __int8)v7 >= 2 ) | |
2490 { | |
2491 sprintf(pContainer, "NPC%03d", pNPCStats->pNPCData[(unsigned __int8)v7 + 499].uPortraitID); | |
2492 v15 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); | |
2493 pRenderer->DrawTextureIndexed(pHiredNPCsIconsOffsetsX[v23], pHiredNPCsIconsOffsetsY[v23], pIcons_LOD->GetTexture(v15)); | |
2494 } | |
2495 else | |
2496 { | |
2497 sprintf(pContainer, "NPC%03d", pParty->pHirelings[(unsigned __int8)v7].uPortraitID); | |
2498 v8 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); | |
2499 v9 = v23; | |
2500 pRenderer->DrawTextureIndexed(pHiredNPCsIconsOffsetsX[v9], pHiredNPCsIconsOffsetsY[v9], pIcons_LOD->GetTexture(v8)); | |
2501 v10 = (unsigned __int8)pTmpBuf[i]; | |
2502 if ( pParty->pHirelings[v10].evt_A == 1 ) | |
2503 { | |
2504 uFrameID = pParty->pHirelings[v10].evt_B; | |
2505 v11 = pHiredNPCsIconsOffsetsX[v9]; | |
2506 v12 = pHiredNPCsIconsOffsetsY[v9]; | |
2507 v17 = v11; | |
2508 v21 = 0; | |
2509 if ( (signed int)pIconsFrameTable->uNumIcons <= 0 ) | |
2510 { | |
2511 LABEL_23: | |
2512 v13 = 0; | |
2513 } | |
2514 else | |
2515 { | |
2516 v20 = 0; | |
2517 while ( _stricmp("spell96", pIconsFrameTable->pIcons[v20 / 0x20].pAnimationName) ) | |
2518 { | |
2519 ++v21; | |
2520 v20 += 32; | |
2521 if ( (signed int)v21 >= (signed int)pIconsFrameTable->uNumIcons ) | |
2522 goto LABEL_23; | |
2523 } | |
2524 v13 = v21; | |
2525 } | |
2526 v14 = pIconsFrameTable->GetFrame(v13, uFrameID); | |
2527 pRenderer->DrawTextureTransparent(v17, v12, &pIcons_LOD->pTextures[v14->uTextureID]); | |
2528 } | |
2529 } | |
2530 ++v23; | |
2531 } | |
2532 } | |
2533 } | |
2534 // 6BE3C5: using guessed type char bNoNPCHiring; | |
2535 | |
2536 //----- (004178FE) -------------------------------------------------------- | |
2537 unsigned int __fastcall UI_GetHealthManaStringColor(signed int a1, signed int a2) | |
2538 { | |
2539 unsigned __int16 v2; // dx@2 | |
2540 unsigned __int16 v3; // cx@2 | |
2541 int v5; // eax@5 | |
2542 unsigned __int16 v6; // [sp-4h] [bp-8h]@2 | |
2543 | |
2544 if ( a1 <= a2 ) | |
2545 { | |
2546 if ( a1 == a2 ) | |
2547 return 0; | |
2548 v5 = 100 * a1 / a2; | |
2549 v3 = 255; | |
2550 if ( v5 >= 25 ) | |
2551 { | |
2552 v6 = 100; | |
2553 v2 = 255; | |
2554 } | |
2555 else | |
2556 { | |
2557 v6 = 0; | |
2558 v2 = 0; | |
2559 } | |
2560 } | |
2561 else | |
2562 { | |
2563 v6 = 0; | |
2564 v2 = 255; | |
2565 v3 = 0; | |
2566 } | |
2567 return TargetColor(v3, v2, v6); | |
2568 } | |
2569 | |
2570 //----- (00417939) -------------------------------------------------------- | |
1458 | 2571 int GetConditionDrawColor(unsigned int uConditionIdx) |
1298 | 2572 { |
1458 | 2573 switch (uConditionIdx) |
1298 | 2574 { |
1458 | 2575 case Condition_Zombie: |
2576 case Condition_Good: | |
2577 return ui_character_condition_normal_color; | |
2578 | |
2579 case Condition_Cursed: | |
2580 case Condition_Weak: | |
2581 case Condition_Fear: | |
2582 case Condition_Drunk: | |
2583 case Condition_Insane: | |
2584 case Condition_Poison1: | |
2585 case Condition_Disease1: | |
2586 return ui_character_condition_light_color; | |
2587 | |
2588 case Condition_Sleep: | |
2589 case Condition_Poison2: | |
2590 case Condition_Disease2: | |
2591 case Condition_Paralyzed: | |
2592 case Condition_Unconcious: | |
2593 return ui_character_condition_moderate_color; | |
2594 | |
2595 case Condition_Poison3: | |
2596 case Condition_Disease3: | |
2597 case Condition_Dead: | |
2598 case Condition_Pertified: | |
2599 case Condition_Eradicated: | |
2600 return ui_character_condition_severe_color; | |
1298 | 2601 } |
1458 | 2602 assert(false && "Invalid condition"); |
1298 | 2603 } |