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