Mercurial > mm7
annotate UiGame.cpp @ 937:ae747684f644
stru279 removed.
author | Nomad |
---|---|
date | Wed, 01 May 2013 12:45:02 +0200 |
parents | b462b598b97a |
children | 9be9afdbeac3 |
rev | line source |
---|---|
706 | 1 #include <assert.h> |
2 | |
3 #include "MM7.h" | |
4 | |
5 #include "MapInfo.h" | |
6 #include "Game.h" | |
7 #include "GUIWindow.h" | |
8 #include "GUIFont.h" | |
9 #include "GUIProgressBar.h" | |
10 #include "Party.h" | |
11 #include "AudioPlayer.h" | |
12 #include "Outdoor.h" | |
13 #include "IndoorCamera.h" | |
14 #include "Overlays.h" | |
15 #include "Monsters.h" | |
16 #include "Arcomage.h" | |
17 #include "LOD.h" | |
18 #include "Actor.h" | |
19 #include "Allocator.h" | |
20 #include "Events.h" | |
21 #include "Viewport.h" | |
22 #include "FrameTableInc.h" | |
23 #include "Math.h" | |
24 #include "SpriteObject.h" | |
25 #include "ObjectList.h" | |
26 #include "Chest.h" | |
27 #include "PaletteManager.h" | |
28 #include "DecorationList.h" | |
29 #include "PlayerFrameTable.h" | |
30 #include "SaveLoad.h" | |
31 #include "stru123.h" | |
32 #include "Time.h" | |
33 #include "IconFrameTable.h" | |
34 #include "Awards.h" | |
35 #include "Autonotes.h" | |
36 #include "stru160.h" | |
37 #include "TurnEngine.h" | |
924 | 38 #include "CastSpellInfo.h" |
706 | 39 #include "Weather.h" |
40 #include "stru298.h" | |
41 #include "StorylineTextTable.h" | |
42 #include "Events2D.h" | |
43 #include "texts.h" | |
44 #include "stru351.h" | |
747 | 45 #include "UIHouses.h" |
706 | 46 |
47 #include "mm7_data.h" | |
48 | |
49 | |
50 | |
51 | |
52 //----- (0041AD6E) -------------------------------------------------------- | |
53 void __cdecl GameUI_DrawRightPanelItems() | |
54 { | |
55 if (GameUI_RightPanel_BookFlashTimer > pParty->uTimePlayed) | |
56 GameUI_RightPanel_BookFlashTimer = 0; | |
57 | |
58 if (pParty->uTimePlayed - GameUI_RightPanel_BookFlashTimer > 128) | |
59 { | |
60 GameUI_RightPanel_BookFlashTimer = pParty->uTimePlayed; | |
61 byte_50697C = byte_50697C == 0; | |
62 if ( byte_50697C && pCurrentScreen != SCREEN_REST ) | |
63 { | |
64 if ( bFlashQuestBook ) | |
65 pRenderer->DrawTextureTransparent(493, 355, pIcons_LOD->GetTexture(uTextureID_ib_td1_A)); | |
66 if ( bFlashAutonotesBook ) | |
67 pRenderer->DrawTextureTransparent(527, 353, pIcons_LOD->GetTexture(uTextureID_ib_td2_A)); | |
68 if ( bFlashHistoryBook ) | |
69 pRenderer->DrawTextureTransparent(600, 361, pIcons_LOD->GetTexture(uTextureID_ib_td5_A)); | |
70 } | |
71 else | |
72 { | |
73 pRenderer->DrawTextureRGB(468u, 0, pTexture_RightFrame); | |
74 DrawHiredNPCs(); | |
75 } | |
76 } | |
77 } | |
78 | |
79 //----- (0041AEBB) -------------------------------------------------------- | |
80 void __cdecl GameUI_DrawFoodAndGold() | |
81 { | |
82 int v2; // esi@2 | |
83 | |
84 if ( uGameState != GAME_STATE_FINAL_WINDOW ) | |
85 { | |
86 v2 = sub_44100D() != 0 ? 381 : 322; | |
87 sprintf(pTmpBuf, "\r087%lu", pParty->uNumFoodRations); | |
88 pPrimaryWindow->DrawText(pFontSmallnum, 0, v2, uGameUIFontMain, pTmpBuf, 0, 0, uGameUIFontShadow); | |
89 sprintf(pTmpBuf, "\r028%lu", pParty->uNumGold); | |
90 pPrimaryWindow->DrawText(pFontSmallnum, 0, v2, uGameUIFontMain, pTmpBuf, 0, 0, uGameUIFontShadow); | |
91 } | |
92 } | |
93 | |
94 //----- (0041AF52) -------------------------------------------------------- | |
95 void Actor::DrawHealthBar(Actor *a1, GUIWindow *a2) | |
96 { | |
97 unsigned int v2; // eax@1 | |
98 GUIWindow *v3; // edi@1 | |
99 unsigned int v4; // esi@1 | |
100 signed int v5; // ebx@4 | |
101 double v6; // st7@5 | |
102 unsigned int v7; // eax@6 | |
103 unsigned int v8; // ebx@10 | |
104 unsigned int v9; // [sp+14h] [bp-Ch]@4 | |
105 unsigned int v10; // [sp+1Ch] [bp-4h]@4 | |
106 | |
107 v2 = a1->pMonsterInfo.uHP; | |
108 v3 = a2; | |
109 v4 = 25; | |
110 if ( (signed int)v2 > 25 ) | |
111 { | |
112 v4 = 200; | |
113 if ( (signed int)v2 < 200 ) | |
114 v4 = a1->pMonsterInfo.uHP; | |
115 } | |
116 v5 = a1->sCurrentHP; | |
117 v10 = v4; | |
118 v9 = uTextureID_mhp_grn; | |
119 if ( v5 < (signed int)v2 ) | |
120 { | |
121 v6 = (double)(signed int)v2; | |
122 v10 = (signed __int64)((double)(signed int)v4 / (double)(signed int)v2 * (double)a1->sCurrentHP); | |
123 if ( v5 <= (signed int)(signed __int64)(0.34 * v6) ) | |
124 { | |
125 v7 = uTextureID_mhp_red; | |
126 v9 = v7; | |
127 } | |
128 else if ( v5 <= (signed int)(signed __int64)(v6 * 0.67) ) | |
129 { | |
130 v7 = uTextureID_mhp_yel; | |
131 v9 = v7; | |
132 } | |
133 } | |
134 v8 = a2->uFrameX + (signed int)(a2->uFrameWidth - v4) / 2; | |
727 | 135 pRenderer->SetTextureClipRect(v8, a2->uFrameY + 32, v8 + v4, a2->uFrameY + 52); |
706 | 136 pRenderer->DrawTextureIndexed( |
137 v8, | |
138 v3->uFrameY + 32, | |
139 (Texture *)(uTextureID_mhp_bd != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_mhp_bd] : 0)); | |
727 | 140 pRenderer->SetTextureClipRect(v8, v3->uFrameY + 32, v8 + v10, v3->uFrameY + 52); |
706 | 141 pRenderer->DrawTextureIndexed( |
142 v8, | |
143 v3->uFrameY + 34, | |
144 (Texture *)(v9 != -1 ? (int)&pIcons_LOD->pTextures[v9] : 0)); | |
727 | 145 pRenderer->ResetTextureClipRect(); |
146 | |
706 | 147 pRenderer->DrawTextureIndexed( |
148 v8 - 5, | |
149 v3->uFrameY + 32, | |
150 (Texture *)(uTextureID_mhp_capl != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_mhp_capl] : 0)); | |
151 pRenderer->DrawTextureIndexed( | |
152 v8 + v4, | |
153 v3->uFrameY + 32, | |
154 (Texture *)(uTextureID_mhp_capr != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_mhp_capr] : 0)); | |
155 } | |
156 | |
157 //----- (0041B0C9) -------------------------------------------------------- | |
158 void __cdecl GameUI_DrawLifeManaBars() | |
159 { | |
160 Texture *v0; // ebx@1 | |
161 Player *v1; // ecx@2 | |
162 float v2; // ST38_4@3 | |
163 double v3; // st7@3 | |
164 signed __int64 v4; // qax@6 | |
165 Player *v5; // ecx@24 | |
166 float v6; // ST30_4@25 | |
167 double v7; // st7@25 | |
168 bool v8; // ST38_4@27 | |
169 Texture *v9; // [sp-4h] [bp-30h]@10 | |
170 Texture *v10; // [sp+Ch] [bp-20h]@1 | |
171 Player *v11; // [sp+10h] [bp-1Ch]@2 | |
172 int v12; // [sp+10h] [bp-1Ch]@24 | |
173 Texture *v13; // [sp+14h] [bp-18h]@1 | |
174 Texture *v14; // [sp+18h] [bp-14h]@1 | |
175 float v15; // [sp+1Ch] [bp-10h]@1 | |
176 signed int v16; // [sp+24h] [bp-8h]@1 | |
177 signed int v17; // [sp+28h] [bp-4h]@8 | |
178 | |
179 v0 = (Texture *)(uTextureID_BarGreen != -1 ? &pIcons_LOD->pTextures[uTextureID_BarGreen] : 0); | |
180 v14 = (Texture *)(uTextureID_BarYellow != -1 ? &pIcons_LOD->pTextures[uTextureID_BarYellow] : 0); | |
181 v13 = (Texture *)(uTextureID_BarRed != -1 ? &pIcons_LOD->pTextures[uTextureID_BarRed] : 0); | |
182 v16 = 0; | |
183 v10 = (Texture *)(uTextureID_BarBlue != -1 ? &pIcons_LOD->pTextures[uTextureID_BarBlue] : 0); | |
184 v15 = (double)(uTextureID_BarGreen != -1 ? pIcons_LOD->pTextures[uTextureID_BarGreen].uTextureHeight : 26); | |
185 do | |
186 { | |
187 v1 = &pParty->pPlayers[v16]; | |
188 v11 = v1; | |
189 if ( v1->sHealth > 0 ) | |
190 { | |
191 v11 = &pParty->pPlayers[v16]; | |
192 v2 = (double)v1->sHealth; | |
193 v3 = v2 / (double)v1->GetMaxHealth(); | |
194 if( v3 > 0.5 ) | |
195 { | |
196 if ( v3 > 1.0 ) | |
197 v3 = 1.0; | |
198 v4 = (signed __int64)((1.0 - v3) * v15); | |
199 if ( v16 == 2 || v16 == 3 ) | |
200 v17 = 2; | |
201 else | |
202 v17 = 0; | |
727 | 203 pRenderer->SetTextureClipRect( |
706 | 204 v17 + pHealthBarPos[v16], |
205 v4 + 402, | |
206 v17 + pHealthBarPos[v16] + v0->uTextureWidth, | |
207 v0->uTextureHeight + 402); | |
208 v9 = v0; | |
209 } | |
210 else if ( v3 > 0.25 ) | |
211 { | |
212 if ( v16 == 2 || v16 == 3 ) | |
213 v17 = 2; | |
214 else | |
215 v17 = 0; | |
727 | 216 pRenderer->SetTextureClipRect( |
706 | 217 v17 + pHealthBarPos[v16], |
218 (unsigned __int64)(signed __int64)((1.0 - v3) * v15) + 402, | |
219 v17 + pHealthBarPos[v16] + v14->uTextureWidth, | |
220 v14->uTextureHeight + 402); | |
221 v9 = v14; | |
222 } | |
223 else if ( v3 > 0.0 ) | |
224 { | |
225 if ( v16 == 2 || v16 == 3 ) | |
226 v17 = 2; | |
227 else | |
228 v17 = 0; | |
727 | 229 pRenderer->SetTextureClipRect( |
706 | 230 v17 + pHealthBarPos[v16], |
231 (unsigned __int64)(signed __int64)((1.0 - v3) * v15) + 402, | |
232 v17 + pHealthBarPos[v16] + v13->uTextureWidth, | |
233 v13->uTextureHeight + 402); | |
234 v9 = v13; | |
235 } | |
236 if( v3 > 0.0 ) | |
237 { | |
238 pRenderer->DrawTextureIndexed(v17 + pHealthBarPos[v16], 0x192u, v9); | |
727 | 239 pRenderer->ResetTextureClipRect(); |
706 | 240 } |
241 } | |
242 v5 = v11; | |
243 v12 = v11->sMana; | |
244 if ( v12 > 0 ) | |
245 { | |
246 v6 = (double)v12; | |
247 v7 = v6 / (double)v5->GetMaxMana(); | |
248 if ( v7 > 1.0 ) | |
249 v7 = 1.0; | |
250 v8 = v16 == 2; | |
727 | 251 pRenderer->SetTextureClipRect( |
706 | 252 (v16 == 2) + pManaBarPos[v16], |
253 (unsigned __int64)(signed __int64)((1.0 - v7) * v15) + 402, | |
254 v8 + pManaBarPos[v16] + v10->uTextureWidth, | |
255 v10->uTextureHeight + 402); | |
256 pRenderer->DrawTextureIndexed(v8 + pManaBarPos[v16], 0x192u, v10); | |
727 | 257 pRenderer->ResetTextureClipRect(); |
706 | 258 } |
259 ++v16; | |
260 } | |
261 while ( v16 < 4 ); | |
262 } | |
263 | |
264 //----- (0041B3B6) -------------------------------------------------------- | |
265 void __cdecl draw_right_panel() | |
266 { | |
920 | 267 pRenderer->DrawTextureTransparent(pViewport->uViewportBR_X, 0, |
706 | 268 (Texture *)(uTextureID_right_panel != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_right_panel] : 0)); |
269 } | |
270 | |
271 //----- (0041B3E2) -------------------------------------------------------- | |
272 void __cdecl GameUI_DrawRightPanelFrames() | |
273 { | |
274 pRenderer->DrawTextureRGB(0, 0, pTexture_TopFrame); | |
275 pRenderer->DrawTextureRGB(0, 8u, pTexture_LeftFrame); | |
276 pRenderer->DrawTextureRGB(468u, 0, pTexture_RightFrame); | |
277 pRenderer->DrawTextureRGB(0, 352u, pTexture_BottomFrame); | |
278 GameUI_DrawFoodAndGold(); | |
279 GameUI_DrawRightPanelItems(); | |
280 } | |
281 | |
282 //----- (0041B438) -------------------------------------------------------- | |
283 GUIButton *__fastcall GUI_HandleHotkey(unsigned __int8 uHotkey) | |
284 { | |
285 char v1; // al@1 | |
286 int v2; // esi@1 | |
287 char v3; // dl@1 | |
288 GUIWindow *v4; // ecx@2 | |
289 GUIButton *result; // eax@2 | |
832 | 290 //int v6; // edx@12 |
706 | 291 |
292 v1 = toupper(uHotkey); | |
293 v2 = uNumVisibleWindows; | |
294 v3 = v1; | |
295 if ( uNumVisibleWindows >= 0 ) | |
296 { | |
297 while ( 2 ) | |
298 { | |
299 v4 = &pWindowList[pVisibleWindowsIdxs[v2] - 1]; | |
300 for ( result = v4->pControlsHead; result; result = result->pNext ) | |
301 { | |
302 if ( result->uHotkey == v3 ) | |
303 { | |
832 | 304 pMessageQueue_50CBD0->AddMessage(result->msg, result->msg_param, 0); |
706 | 305 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
306 { | |
307 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)result->uControlID; | |
308 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v6; | |
309 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
310 ++pMessageQueue_50CBD0->uNumMessages; | |
311 }*/ | |
312 return result; | |
313 } | |
314 } | |
315 if ( v4->uFrameX || v4->uFrameY || !(v4->uFrameWidth == 640 & v4->uFrameHeight == 480) ) | |
316 { | |
317 --v2; | |
318 if ( v2 >= 0 ) | |
319 continue; | |
320 } | |
321 break; | |
322 } | |
323 } | |
324 return 0; | |
325 } | |
326 // 5075E0: using guessed type int pVisibleWindowsIdxs[20]; | |
327 | |
328 //----- (0041B4E1) -------------------------------------------------------- | |
329 int __fastcall GUI_ReplaceHotkey(unsigned __int8 uOldHotkey, unsigned __int8 uNewHotkey, char bFirstCall) | |
330 { | |
331 unsigned __int8 v3; // bl@1 | |
332 int result; // eax@1 | |
333 int i; // edx@2 | |
334 GUIButton *j; // ecx@3 | |
335 int k; // edx@7 | |
336 GUIButton *l; // ecx@8 | |
337 unsigned __int8 v9; // [sp+4h] [bp-8h]@1 | |
338 char v10; // [sp+8h] [bp-4h]@1 | |
339 | |
340 v3 = uNewHotkey; | |
341 v10 = toupper(uOldHotkey); | |
342 result = toupper(v3); | |
343 v9 = result; | |
344 if ( bFirstCall ) | |
345 { | |
346 for ( i = uNumVisibleWindows; i >= 0; --i ) | |
347 { | |
348 result = 84 * pVisibleWindowsIdxs[i]; | |
349 //for ( j = *(GUIButton **)((char *)pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_ + result); j; j = j->pNext ) | |
350 for ( j = pWindowList[pVisibleWindowsIdxs[i] - 1].pControlsHead; j; j = j->pNext ) | |
351 j->field_28 = 0; | |
352 } | |
353 } | |
354 for ( k = uNumVisibleWindows; k >= 0; --k ) | |
355 { | |
356 result = 84 * pVisibleWindowsIdxs[k]; | |
357 //for ( l = *(GUIButton **)((char *)pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_ + result); l; l = l->pNext ) | |
358 for ( l = pWindowList[pVisibleWindowsIdxs[k] - 1].pControlsHead; l; l = l->pNext ) | |
359 { | |
360 LOBYTE(result) = v10; | |
361 if ( l->uHotkey == v10 ) | |
362 { | |
363 if ( !l->field_28 ) | |
364 { | |
365 LOBYTE(result) = v9; | |
366 l->field_28 = 1; | |
367 l->uHotkey = v9; | |
368 } | |
369 } | |
370 } | |
371 } | |
372 return result; | |
373 } | |
374 | |
375 | |
376 | |
377 //----- (0041C047) -------------------------------------------------------- | |
783 | 378 void __cdecl GameUI_Footer_2() |
706 | 379 { |
380 unsigned int v0; // eax@1 | |
381 char *v1; // edx@2 | |
382 unsigned int v2; // ST18_4@5 | |
383 const char *v3; // ST0C_4@5 | |
384 unsigned int v4; // ST08_4@5 | |
385 int v5; // eax@5 | |
386 | |
387 pRenderer->DrawTextureRGB(0, 352u, pTexture_StatusBar); | |
783 | 388 if ( GameUI_Footer_TimeLeft ) |
706 | 389 { |
783 | 390 v1 = GameUI_Footer_TimedString; |
706 | 391 } |
392 else | |
393 { | |
783 | 394 if ( !pFooterString[0] ) |
706 | 395 return; |
783 | 396 v1 = pFooterString; |
706 | 397 } |
398 LOWORD(v0) = uGameUIFontShadow; | |
399 v2 = v0; | |
400 LOWORD(v0) = uGameUIFontMain; | |
401 v3 = v1; | |
402 v4 = v0; | |
403 v5 = pFontLucida->AlignText_Center(0x1C2u, v1); | |
404 pPrimaryWindow->DrawText(pFontLucida, v5 + 11, 357, v4, v3, 0, 0, v2); | |
405 } | |
406 | |
407 //----- (0041C0B8) -------------------------------------------------------- | |
408 void __thiscall sub_41C0B8_set_status_string(const char *pStr) | |
409 { | |
410 const char *v1; // esi@1 | |
411 int i; // eax@7 | |
412 int j; // eax@11 | |
413 | |
414 v1 = pStr; | |
783 | 415 if ( pStr && strcmp(pStr, "test") && !IsBadStringPtrA(v1, 1u) && (*v1 || GameUI_Footer_TimeLeft) ) |
706 | 416 { |
783 | 417 if ( GameUI_Footer_TimeLeft ) |
706 | 418 { |
783 | 419 for ( i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString); |
706 | 420 i > 450; |
783 | 421 i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString) ) |
422 byte_5C3427[strlen(GameUI_Footer_TimedString)] = 0; | |
706 | 423 } |
424 else | |
425 { | |
783 | 426 strcpy(pFooterString, v1); |
427 for ( j = pFontLucida->GetLineWidth(pFooterString); | |
706 | 428 j > 450; |
783 | 429 j = pFontLucida->GetLineWidth(pFooterString) ) |
430 GameUI_Footer_TimedString[strlen(pFooterString) + 199] = 0; | |
706 | 431 } |
432 } | |
433 } | |
434 | |
435 //----- (0041C179) -------------------------------------------------------- | |
783 | 436 void GameUI_Footer() |
437 { | |
706 | 438 unsigned int v0; // ebp@1 |
439 char *v1; // edi@5 | |
440 int v2; // eax@5 | |
441 unsigned int v3; // esi@5 | |
442 size_t v4; // eax@6 | |
443 GUIFont *v5; // ecx@6 | |
444 int v6; // eax@9 | |
445 size_t v7; // eax@10 | |
446 GUIFont *v8; // ecx@10 | |
447 char v9; // zf@12 | |
448 unsigned int v10; // ST08_4@13 | |
449 int v11; // eax@13 | |
450 | |
451 v0 = uGameUIFontShadow; | |
783 | 452 if ( pFooterString[0] || GameUI_Footer_TimeLeft || bForceDrawFooter ) |
706 | 453 { |
454 pRenderer->DrawTextureRGB(0, 352u, pTexture_StatusBar); | |
783 | 455 if ( GameUI_Footer_TimeLeft ) |
706 | 456 { |
783 | 457 v1 = GameUI_Footer_TimedString; |
458 v2 = pFontLucida->GetLineWidth(GameUI_Footer_TimedString); | |
706 | 459 v3 = 450; |
460 while ( v2 > 450 ) | |
461 { | |
783 | 462 v4 = strlen(GameUI_Footer_TimedString); |
706 | 463 v5 = pFontLucida; |
464 byte_5C3427[v4] = 0; | |
783 | 465 v2 = pFontLucida->GetLineWidth(GameUI_Footer_TimedString); |
706 | 466 } |
467 } | |
468 else | |
469 { | |
783 | 470 v1 = pFooterString; |
471 v6 = pFontLucida->GetLineWidth(pFooterString); | |
706 | 472 v3 = 450; |
473 while ( v6 > 450 ) | |
474 { | |
783 | 475 v7 = strlen(pFooterString); |
706 | 476 v8 = pFontLucida; |
783 | 477 GameUI_Footer_TimedString[v7 + 199] = 0; |
478 v6 = pFontLucida->GetLineWidth(pFooterString); | |
706 | 479 } |
480 } | |
481 v9 = *v1 == 0; | |
783 | 482 bForceDrawFooter = 0; |
706 | 483 if ( !v9 ) |
484 { | |
485 v10 = uGameUIFontMain; | |
486 v11 = pFontLucida->AlignText_Center(v3, v1); | |
487 pPrimaryWindow->DrawText(pFontLucida, v11 + 11, 357, v10, v1, 0, 0, v0); | |
488 } | |
489 } | |
490 } | |
783 | 491 // 5C35BC: using guessed type int bForceDrawFooter; |
706 | 492 |
493 | |
494 //----- (00420EFF) -------------------------------------------------------- | |
495 void __cdecl GameUI_WritePointedObjectStatusString() | |
496 { | |
497 int v1; // ebx@6 | |
498 GUIWindow *pWindow; // edi@7 | |
499 GUIButton *pButton; // ecx@11 | |
500 Player *pPlayer; // eax@19 | |
501 char v5; // cl@19 | |
502 unsigned int v6; // eax@19 | |
503 int v7; // ecx@19 | |
504 __int16 v8; // fps@23 | |
505 unsigned __int8 v9; // c0@23 | |
506 unsigned __int8 v10; // c3@23 | |
507 enum UIMessageType pMessageType1; // esi@24 | |
832 | 508 //int v12; // edx@25 |
706 | 509 char *v13; // ecx@28 |
510 int v14; // eax@41 | |
511 ItemGen *pItemGen; // ecx@44 | |
512 int v16; // ecx@46 | |
513 const char *v17; // eax@49 | |
514 signed int v18; // eax@55 | |
867 | 515 signed int v18b; |
706 | 516 signed int v19; // ecx@63 |
517 BLVFace *pFace; // eax@69 | |
518 __int16 v21; // ax@70 | |
519 const char *v22; // eax@72 | |
520 LevelDecoration *v23; // ecx@75 | |
521 LevelDecoration *v24; // esi@75 | |
522 __int16 v25; // ax@75 | |
523 const char *v26; // ecx@79 | |
524 Actor *pActor; // ecx@82 | |
525 char *v28; // esi@82 | |
526 int v29; // eax@82 | |
527 signed int v30; // ecx@88 | |
528 const char *v31; // eax@91 | |
529 __int16 v32; // fps@109 | |
530 //unsigned __int8 v33; // c0@109 | |
531 //unsigned __int8 v34; // c3@109 | |
532 enum UIMessageType pMessageType2; // esi@110 | |
832 | 533 //int v36; // edx@111 |
706 | 534 enum UIMessageType pMessageType3; // edx@117 |
832 | 535 //int v38; // ecx@118 |
706 | 536 const char *v39; // [sp-8h] [bp-E8h]@20 |
537 char *v40; // [sp-8h] [bp-E8h]@83 | |
538 int v41; // [sp-4h] [bp-E4h]@20 | |
539 char Str1[200]; // [sp+Ch] [bp-D4h]@129 | |
540 unsigned int pX; // [sp+D4h] [bp-Ch]@1 | |
541 unsigned int pY; // [sp+D8h] [bp-8h]@1 | |
542 unsigned int v45; // [sp+DCh] [bp-4h]@21 | |
543 | |
544 v13 = nullptr; | |
545 | |
546 pMouse->uPointingObjectID = 0; | |
547 pMouse->GetClickPos(&pX, &pY); | |
548 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 ) | |
549 return; | |
550 if (pCurrentScreen == SCREEN_GAME) | |
551 { | |
552 if ( (signed int)pX > 467 || (signed int)pY > 351 ) | |
553 goto _click_on_game_ui; | |
871 | 554 if ( pRenderer->pRenderD3D ) // inlined mm8::4C1E01 |
706 | 555 { |
556 v18 = pGame->pVisInstance->get_picked_object_zbuf_val(); | |
557 if ( (signed int)pX < (signed int)pViewport->uScreen_TL_X | |
558 || (signed int)pX > (signed int)pViewport->uScreen_BR_X | |
559 || (signed int)pY < (signed int)pViewport->uScreen_TL_Y | |
560 || (signed int)pY > (signed int)pViewport->uScreen_BR_Y ) | |
561 v18 = -1; | |
562 if ( v18 == -1 ) | |
563 //goto LABEL_61; | |
564 { | |
565 pMouse->uPointingObjectID = 0; | |
566 if ( pMouse->uPointingObjectID == 0 ) | |
567 { | |
568 if ( uLastPointedObjectID != 0 ) | |
569 { | |
783 | 570 pFooterString[0] = 0; |
571 bForceDrawFooter = 1; | |
706 | 572 } |
573 } | |
574 uLastPointedObjectID = pMouse->uPointingObjectID; | |
575 return; | |
576 } | |
577 } | |
578 else | |
579 { | |
580 v18 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]]; | |
581 } | |
582 pMouse->uPointingObjectID = (unsigned __int16)v18; | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
809
diff
changeset
|
583 v19 = (signed)PID_ID(v18); |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
809
diff
changeset
|
584 if (PID_TYPE(v18) == OBJECT_Item) |
706 | 585 { |
586 v30 = v19; | |
587 if ( pObjectList->pObjects[pSpriteObjects[v30].uObjectDescID].uFlags & 0x10 ) | |
588 //goto LABEL_73; | |
589 { | |
590 pMouse->uPointingObjectID = 0; | |
591 //goto LABEL_50; | |
592 uLastPointedObjectID = 1; | |
593 if ( pMouse->uPointingObjectID == 0 ) | |
594 { | |
595 if ( uLastPointedObjectID != 0 ) | |
596 { | |
783 | 597 pFooterString[0] = 0; |
598 bForceDrawFooter = 1; | |
706 | 599 } |
600 } | |
601 uLastPointedObjectID = pMouse->uPointingObjectID; | |
602 return; | |
603 } | |
604 if ( v18 >= (signed int)0x2000000u || pParty->pPickedItem.uItemID ) | |
605 { | |
606 v22 = pSpriteObjects[v30].stru_24.GetDisplayName(); | |
607 //LABEL_93: | |
608 v26 = v22; | |
609 //goto LABEL_87; | |
610 sub_41C0B8_set_status_string(v26); | |
611 if ( pMouse->uPointingObjectID == 0 ) | |
612 { | |
613 if ( uLastPointedObjectID != 0 ) | |
614 { | |
783 | 615 pFooterString[0] = 0; |
616 bForceDrawFooter = 1; | |
706 | 617 } |
618 } | |
619 uLastPointedObjectID = pMouse->uPointingObjectID; | |
620 return; | |
621 } | |
622 v31 = pSpriteObjects[v30].stru_24.GetDisplayName(); | |
623 v28 = pTmpBuf; | |
809 | 624 sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[470], v31);// "Get %s" |
706 | 625 } |
626 else | |
627 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
809
diff
changeset
|
628 if (PID_TYPE(v18) != OBJECT_Actor) |
706 | 629 { |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
809
diff
changeset
|
630 if (PID_TYPE(v18) == OBJECT_Decoration) |
706 | 631 { |
632 v23 = &pLevelDecorations[v19]; | |
633 v24 = v23; | |
634 v25 = v23->field_16_event_id; | |
635 if ( !v25 ) | |
636 { | |
637 if ( v23->IsInteractive() ) | |
638 v26 = pNPCTopics[stru_5E4C90._decor_events[v24->_idx_in_stru123 - 75] + 379].pTopic; | |
639 else | |
640 v26 = pDecorationList->pDecorations[v24->uDecorationDescID].field_20; | |
641 //goto LABEL_87; | |
642 sub_41C0B8_set_status_string(v26); | |
643 if ( pMouse->uPointingObjectID == 0 ) | |
644 { | |
645 if ( uLastPointedObjectID != 0 ) | |
646 { | |
783 | 647 pFooterString[0] = 0; |
648 bForceDrawFooter = 1; | |
706 | 649 } |
650 } | |
651 uLastPointedObjectID = pMouse->uPointingObjectID; | |
652 return; | |
653 } | |
654 v22 = GetEventHintString(v25); | |
655 if ( !v22 ) | |
656 //goto _return; | |
657 { | |
658 if ( pMouse->uPointingObjectID == 0 ) | |
659 { | |
660 if ( uLastPointedObjectID != 0 ) | |
661 { | |
783 | 662 pFooterString[0] = 0; |
663 bForceDrawFooter = 1; | |
706 | 664 } |
665 } | |
666 uLastPointedObjectID = pMouse->uPointingObjectID; | |
667 return; | |
668 } | |
669 //goto LABEL_93; | |
670 v26 = v22; | |
671 //goto LABEL_87; | |
672 sub_41C0B8_set_status_string(v26); | |
673 if ( pMouse->uPointingObjectID == 0 ) | |
674 { | |
675 if ( uLastPointedObjectID != 0 ) | |
676 { | |
783 | 677 pFooterString[0] = 0; |
678 bForceDrawFooter = 1; | |
706 | 679 } |
680 } | |
681 uLastPointedObjectID = pMouse->uPointingObjectID; | |
682 return; | |
683 } | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
809
diff
changeset
|
684 if (PID_TYPE(v18) == OBJECT_BModel) |
706 | 685 { |
686 if ( v18 < (signed int)0x2000000u ) | |
687 { | |
688 if ( uCurrentlyLoadedLevelType != LEVEL_Indoor) | |
689 { | |
867 | 690 v18b = (signed int)(unsigned __int16)v18 >> 9; |
691 v21 = pOutdoor->pBModels[v18b].pFaces[v19 & 0x3F].sCogTriggeredID; | |
706 | 692 //goto LABEL_71; |
693 if ( !v21 || (v22 = GetEventHintString(v21)) == 0 ) | |
694 //goto LABEL_73; | |
695 { | |
696 pMouse->uPointingObjectID = 0; | |
697 //goto LABEL_50; | |
698 uLastPointedObjectID = 1; | |
699 if ( pMouse->uPointingObjectID == 0 ) | |
700 { | |
701 if ( uLastPointedObjectID != 0 ) | |
702 { | |
783 | 703 pFooterString[0] = 0; |
704 bForceDrawFooter = 1; | |
706 | 705 } |
706 } | |
707 uLastPointedObjectID = pMouse->uPointingObjectID; | |
708 return; | |
709 } | |
710 //goto LABEL_93; | |
711 v26 = v22; | |
712 //goto LABEL_87; | |
713 sub_41C0B8_set_status_string(v26); | |
714 if ( pMouse->uPointingObjectID == 0 ) | |
715 { | |
716 if ( uLastPointedObjectID != 0 ) | |
717 { | |
783 | 718 pFooterString[0] = 0; |
719 bForceDrawFooter = 1; | |
706 | 720 } |
721 } | |
722 uLastPointedObjectID = pMouse->uPointingObjectID; | |
723 return; | |
724 } | |
725 pFace = &pIndoor->pFaces[v19]; | |
726 if ( BYTE3(pFace->uAttributes) & 6 ) | |
727 { | |
728 v21 = pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID; | |
729 //LABEL_71: | |
730 if ( !v21 || (v22 = GetEventHintString(v21)) == 0 ) | |
731 //goto LABEL_73; | |
732 { | |
733 pMouse->uPointingObjectID = 0; | |
734 //goto LABEL_50; | |
735 uLastPointedObjectID = 1; | |
736 if ( pMouse->uPointingObjectID == 0 ) | |
737 { | |
738 if ( uLastPointedObjectID != 0 ) | |
739 { | |
783 | 740 pFooterString[0] = 0; |
741 bForceDrawFooter = 1; | |
706 | 742 } |
743 } | |
744 uLastPointedObjectID = pMouse->uPointingObjectID; | |
745 return; | |
746 } | |
747 //goto LABEL_93; | |
748 v26 = v22; | |
749 //goto LABEL_87; | |
750 sub_41C0B8_set_status_string(v26); | |
751 if ( pMouse->uPointingObjectID == 0 ) | |
752 { | |
753 if ( uLastPointedObjectID != 0 ) | |
754 { | |
783 | 755 pFooterString[0] = 0; |
756 bForceDrawFooter = 1; | |
706 | 757 } |
758 } | |
759 uLastPointedObjectID = pMouse->uPointingObjectID; | |
760 return; | |
761 } | |
762 } | |
763 //LABEL_73: | |
764 pMouse->uPointingObjectID = 0; | |
765 //goto LABEL_50; | |
766 uLastPointedObjectID = 1; | |
767 if ( pMouse->uPointingObjectID == 0 ) | |
768 { | |
769 if ( uLastPointedObjectID != 0 ) | |
770 { | |
783 | 771 pFooterString[0] = 0; |
772 bForceDrawFooter = 1; | |
706 | 773 } |
774 } | |
775 uLastPointedObjectID = pMouse->uPointingObjectID; | |
776 return; | |
777 } | |
778 //LABEL_61: | |
779 pMouse->uPointingObjectID = 0; | |
780 //goto _return; | |
781 if ( pMouse->uPointingObjectID == 0 ) | |
782 { | |
783 if ( uLastPointedObjectID != 0 ) | |
784 { | |
783 | 785 pFooterString[0] = 0; |
786 bForceDrawFooter = 1; | |
706 | 787 } |
788 } | |
789 uLastPointedObjectID = pMouse->uPointingObjectID; | |
790 return; | |
791 } | |
792 if ( v18 >= 335544320 ) | |
793 //goto LABEL_61; | |
794 { | |
795 pMouse->uPointingObjectID = 0; | |
796 if ( pMouse->uPointingObjectID == 0 ) | |
797 { | |
798 if ( uLastPointedObjectID != 0 ) | |
799 { | |
783 | 800 pFooterString[0] = 0; |
801 bForceDrawFooter = 1; | |
706 | 802 } |
803 } | |
804 uLastPointedObjectID = pMouse->uPointingObjectID; | |
805 return; | |
806 } | |
807 pActor = &pActors[v19]; | |
808 v28 = pTmpBuf; | |
809 v29 = pActor->dword_000334_unique_name; | |
810 if ( v29 ) | |
811 v40 = pMonsterStats->pPlaceStrings[v29]; | |
812 else | |
813 v40 = pMonsterStats->pInfos[pActor->pMonsterInfo.uID].pName; | |
814 strncpy(pTmpBuf, v40, 0x7D0u); | |
815 } | |
816 v26 = v28; | |
817 //LABEL_87: | |
818 sub_41C0B8_set_status_string(v26); | |
819 //goto _return; | |
820 if ( pMouse->uPointingObjectID == 0 ) | |
821 { | |
822 if ( uLastPointedObjectID != 0 ) | |
823 { | |
783 | 824 pFooterString[0] = 0; |
825 bForceDrawFooter = 1; | |
706 | 826 } |
827 } | |
828 uLastPointedObjectID = pMouse->uPointingObjectID; | |
829 return; | |
830 } | |
831 v1 = uNumVisibleWindows; | |
832 if ( uNumVisibleWindows > 0 ) | |
833 { | |
834 while ( 1 ) // some other fullscreen ui | |
835 { | |
836 pWindow = &pWindowList[pVisibleWindowsIdxs[v1] - 1]; | |
837 if ( (signed int)pX >= (signed int)pWindow->uFrameX | |
838 && (signed int)pX <= (signed int)pWindow->uFrameZ | |
839 && (signed int)pY >= (signed int)pWindow->uFrameY | |
840 && (signed int)pY <= (signed int)pWindow->uFrameW ) | |
841 { | |
842 for ( pButton = pWindow->pControlsHead; ; pButton = pButton->pNext ) | |
843 { | |
844 if ( !pButton ) | |
845 break; | |
846 if ( pButton->uButtonType == 1 ) | |
847 { | |
848 if ( (signed int)pX >= (signed int)pButton->uX | |
849 && (signed int)pX <= (signed int)pButton->uZ | |
850 && (signed int)pY >= (signed int)pButton->uY | |
851 && (signed int)pY <= (signed int)pButton->uW ) | |
852 { | |
853 //LABEL_24: | |
854 pMessageType1 = (UIMessageType)pButton->field_1C; | |
855 if ( pMessageType1 ) | |
856 { | |
832 | 857 pMessageQueue_50CBD0->AddMessage(pMessageType1, pButton->msg_param, 0); |
706 | 858 } |
859 //LABEL_28: | |
860 v13 = pButton->pButtonName; | |
861 //_set_status_and_ret: | |
862 sub_41C0B8_set_status_string(v13); | |
863 //LABEL_131: | |
864 uLastPointedObjectID = 1; | |
865 return; | |
866 } | |
867 } | |
868 else | |
869 { | |
870 if ( pButton->uButtonType == 2 ) | |
871 { | |
872 v45 = pX - pButton->uX; | |
873 v45 = pY - pButton->uY; | |
874 if ( (double)(signed int)pButton->uWidth != 0.0 ) | |
875 { | |
876 if ( (double)(signed int)pButton->uHeight != 0.0 ) | |
877 { | |
878 pMessageType1 = (UIMessageType)pButton->field_1C; | |
879 if ( pMessageType1 ) | |
880 { | |
832 | 881 pMessageQueue_50CBD0->AddMessage(pMessageType1, pButton->msg_param, 0); |
706 | 882 } |
883 v13 = pButton->pButtonName; | |
884 sub_41C0B8_set_status_string(v13); | |
885 uLastPointedObjectID = 1; | |
886 return; | |
887 //} | |
888 } | |
889 } | |
890 } | |
891 else // click on skill | |
892 { | |
893 if ( pButton->uButtonType == 3 | |
894 && (signed int)pX >= (signed int)pButton->uX | |
895 && (signed int)pX <= (signed int)pButton->uZ | |
896 && (signed int)pY >= (signed int)pButton->uY | |
897 && (signed int)pY <= (signed int)pButton->uW ) | |
898 { | |
899 //LABEL_19: | |
900 pPlayer = pPlayers[uActiveCharacter]; | |
832 | 901 v5 = LOBYTE(pPlayer->pActiveSkills[pButton->msg_param]); |
706 | 902 v6 = pPlayer->uSkillPoints; |
903 v7 = (v5 & 0x3F) + 1; | |
904 if ( v6 < v7 ) | |
905 { | |
906 v41 = v7 - v6; | |
907 v39 = pGlobalTXT_LocalizationStrings[469];// "You need %d more Skill Points to advance here" | |
908 } | |
909 else | |
910 { | |
911 v41 = v7; | |
912 v39 = pGlobalTXT_LocalizationStrings[468];// "Clicking here will spend %d Skill Points" | |
913 } | |
914 sprintf(Str1, v39, v41); | |
915 v13 = Str1; | |
916 //goto _set_status_and_ret; | |
917 sub_41C0B8_set_status_string(v13); | |
918 uLastPointedObjectID = 1; | |
919 return; | |
920 } | |
921 } | |
922 } | |
923 } | |
924 } | |
925 if ( pWindow->uFrameHeight == 480 ) | |
926 break; | |
927 --v1; | |
928 if ( v1 <= 0 ) | |
929 { | |
930 break; | |
931 } | |
932 } | |
933 } | |
934 if ( uNumVisibleWindows <= 0 || (uNumVisibleWindows > 0 && pWindow->uFrameHeight != 480 && v1 <= 0)) | |
935 { | |
936 if ( pCurrentScreen == SCREEN_CHEST ) | |
937 { | |
938 sub_42038D(); | |
939 //goto _return; | |
940 if ( pMouse->uPointingObjectID == 0 ) | |
941 { | |
942 if ( uLastPointedObjectID != 0 ) | |
943 { | |
783 | 944 pFooterString[0] = 0; |
945 bForceDrawFooter = 1; | |
706 | 946 } |
947 } | |
948 uLastPointedObjectID = pMouse->uPointingObjectID; | |
949 return; | |
950 } | |
951 if ( pCurrentScreen == SCREEN_HOUSE ) | |
952 { | |
747 | 953 if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD |
706 | 954 || (v16 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]], v16 == 0) |
955 || v16 == -65536 ) | |
956 //goto _return; | |
957 { | |
958 if ( pMouse->uPointingObjectID == 0 ) | |
959 { | |
960 if ( uLastPointedObjectID != 0 ) | |
961 { | |
783 | 962 pFooterString[0] = 0; |
963 bForceDrawFooter = 1; | |
706 | 964 } |
965 } | |
966 uLastPointedObjectID = pMouse->uPointingObjectID; | |
967 return; | |
968 } | |
969 pItemGen = (ItemGen *)((char *)&pParty->pPickedItem + 36 * (v16 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 4); | |
970 //LABEL_49: | |
971 v17 = pItemGen->GetDisplayName(); | |
972 sub_41C0B8_set_status_string(v17); | |
973 //LABEL_50: | |
974 uLastPointedObjectID = 1; | |
975 //_return: | |
976 if ( pMouse->uPointingObjectID == 0 ) | |
977 { | |
978 if ( uLastPointedObjectID != 0 ) | |
979 { | |
783 | 980 pFooterString[0] = 0; |
981 bForceDrawFooter = 1; | |
706 | 982 } |
983 } | |
984 uLastPointedObjectID = pMouse->uPointingObjectID; | |
985 return; | |
986 } | |
987 if ( (signed int)pY < 350 ) | |
988 { | |
989 v14 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]]; | |
990 if ( v14 == 0 || v14 == -65536 || (unsigned int)v14 >= 0x1388 ) | |
991 //goto _return; | |
992 { | |
993 if ( pMouse->uPointingObjectID == 0 ) | |
994 { | |
995 if ( uLastPointedObjectID != 0 ) | |
996 { | |
783 | 997 pFooterString[0] = 0; |
998 bForceDrawFooter = 1; | |
706 | 999 } |
1000 } | |
1001 uLastPointedObjectID = pMouse->uPointingObjectID; | |
1002 return; | |
1003 } | |
1004 pItemGen = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[v14-1]; | |
1005 //goto LABEL_49; | |
1006 v17 = pItemGen->GetDisplayName(); | |
1007 sub_41C0B8_set_status_string(v17); | |
1008 uLastPointedObjectID = 1; | |
1009 if ( pMouse->uPointingObjectID == 0 ) | |
1010 { | |
1011 if ( uLastPointedObjectID != 0 ) | |
1012 { | |
783 | 1013 pFooterString[0] = 0; |
1014 bForceDrawFooter = 1; | |
706 | 1015 } |
1016 } | |
1017 uLastPointedObjectID = pMouse->uPointingObjectID; | |
1018 return; | |
1019 } | |
1020 _click_on_game_ui: | |
1021 if ( (signed int)pX >= (signed int)pWindowList[0].uFrameX | |
1022 && (signed int)pX <= (signed int)pWindowList[0].uFrameZ | |
1023 && (signed int)pY >= (signed int)pWindowList[0].uFrameY | |
1024 && (signed int)pY <= (signed int)pWindowList[0].uFrameW ) | |
1025 { | |
1026 for ( pButton = pWindowList[0].pControlsHead; pButton != (GUIButton *)0; pButton = pButton->pNext ) | |
1027 { | |
1028 if ( pButton->uButtonType == 1 ) | |
1029 { | |
1030 if ( (signed int)pX >= (signed int)pButton->uX | |
1031 && (signed int)pX <= (signed int)pButton->uZ | |
1032 && (signed int)pY >= (signed int)pButton->uY | |
1033 && (signed int)pY <= (signed int)pButton->uW ) | |
1034 { | |
1035 pMessageType3 = (UIMessageType)pButton->field_1C; | |
1036 if ( pMessageType3 == 0 ) // For books | |
1037 //goto LABEL_28; | |
1038 { | |
1039 v13 = pButton->pButtonName; | |
1040 sub_41C0B8_set_status_string(v13); | |
1041 uLastPointedObjectID = 1; | |
1042 return; | |
1043 } | |
832 | 1044 |
1045 pMessageQueue_50CBD0->AddMessage(pMessageType3, pButton->msg_param, 0); | |
706 | 1046 //goto LABEL_131; |
1047 uLastPointedObjectID = 1; | |
1048 return; | |
1049 } | |
1050 } | |
1051 else | |
1052 { | |
1053 if ( pButton->uButtonType == 2 ) | |
1054 { | |
1055 v45 = pX - pButton->uX; | |
1056 v45 = pY - pButton->uY; | |
1057 | |
1058 if (pX >= pButton->uX && pX <= pButton->uZ && | |
1059 pY >= pButton->uY && pY <= pButton->uW) | |
1060 if ( (double)(signed int)pButton->uWidth != 0.0 ) | |
1061 { | |
1062 if ( (double)(signed int)pButton->uHeight != 0.0 ) | |
1063 { | |
1064 //UNDEF(v32); | |
1065 //if ( v33 | v34 ) | |
1066 //{ | |
1067 pMessageType2 = (UIMessageType)pButton->field_1C; | |
1068 if ( pMessageType2 != 0 ) | |
832 | 1069 pMessageQueue_50CBD0->AddMessage(pMessageType2, pButton->msg_param, 0); |
1070 | |
706 | 1071 //goto LABEL_28; |
1072 v13 = pButton->pButtonName; | |
1073 sub_41C0B8_set_status_string(v13); | |
1074 uLastPointedObjectID = 1; | |
1075 return; | |
1076 //} | |
1077 } | |
1078 } | |
1079 } | |
1080 else | |
1081 { | |
1082 if ( pButton->uButtonType == 3 | |
1083 && (signed int)pX >= (signed int)pButton->uX | |
1084 && (signed int)pX <= (signed int)pButton->uZ | |
1085 && (signed int)pY >= (signed int)pButton->uY | |
1086 && (signed int)pY <= (signed int)pButton->uW ) | |
1087 //goto LABEL_19; | |
1088 { | |
1089 pPlayer = pPlayers[uActiveCharacter]; | |
832 | 1090 v5 = LOBYTE(pPlayer->pActiveSkills[pButton->msg_param]); |
706 | 1091 v6 = pPlayer->uSkillPoints; |
1092 v7 = (v5 & 0x3F) + 1; | |
1093 if ( v6 < v7 ) | |
1094 { | |
1095 v41 = v7 - v6; | |
1096 v39 = pGlobalTXT_LocalizationStrings[469];// "You need %d more Skill Points to advance here" | |
1097 } | |
1098 else | |
1099 { | |
1100 v41 = v7; | |
1101 v39 = pGlobalTXT_LocalizationStrings[468];// "Clicking here will spend %d Skill Points" | |
1102 } | |
1103 sprintf(Str1, v39, v41); | |
1104 v13 = Str1; | |
1105 //goto _set_status_and_ret; | |
1106 sub_41C0B8_set_status_string(v13); | |
1107 uLastPointedObjectID = 1; | |
1108 return; | |
1109 } | |
1110 } | |
1111 } | |
1112 } | |
1113 } | |
1114 pMouse->uPointingObjectID = sub_46A99B(); | |
1115 //goto _return; | |
1116 if ( pMouse->uPointingObjectID == 0 ) | |
1117 { | |
1118 if ( uLastPointedObjectID != 0 ) | |
1119 { | |
783 | 1120 pFooterString[0] = 0; |
1121 bForceDrawFooter = 1; | |
706 | 1122 } |
1123 } | |
1124 uLastPointedObjectID = pMouse->uPointingObjectID; | |
1125 return; | |
1126 } | |
1127 } | |
1128 | |
1129 | |
1130 //----- (0044158F) -------------------------------------------------------- | |
1131 void __cdecl GameUI_DrawCharacterSelectionFrame() | |
920 | 1132 { |
1133 if ( uActiveCharacter ) | |
1134 pRenderer->DrawTextureTransparent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[uActiveCharacter - 1] - 9, | |
1135 380, &pIcons_LOD->pTextures[dword_50C98C]); | |
1136 } | |
706 | 1137 |
1138 //----- (004415C5) -------------------------------------------------------- | |
1139 void LoadPartyBuffIcons() | |
1140 { | |
1141 for (uint i = 0; i < 14; ++i) | |
1142 { | |
1143 char filename[200]; | |
1144 sprintf(filename, "isn-%02d", i + 1); | |
1145 pTextureIDs_PartyBuffIcons[i] = pIcons_LOD->LoadTexture(filename, TEXTURE_16BIT_PALETTE); | |
1146 } | |
1147 | |
1148 uIconIdx_FlySpell = pIconsFrameTable->FindIcon("spell21"); | |
1149 uIconIdx_WaterWalk = pIconsFrameTable->FindIcon("spell27"); | |
1150 } | |
1151 | |
1152 //----- (0044162D) -------------------------------------------------------- | |
1153 void __cdecl GameUI_DrawPartySpells() | |
1154 { | |
1155 unsigned int v0; // ebp@1 | |
1156 //signed int v1; // edi@1 | |
1157 //int v2; // eax@2 | |
1158 //int v3; // ecx@5 | |
1159 //__int16 *v4; // ebx@25 | |
1160 //Player *v5; // edi@26 | |
1161 //unsigned int v6; // [sp-4h] [bp-1Ch]@11 | |
1162 Texture *v7; // [sp-4h] [bp-1Ch]@12 | |
1163 //unsigned int v8; // [sp-4h] [bp-1Ch]@20 | |
1164 Texture *v9; // [sp-4h] [bp-1Ch]@21 | |
1165 //Player **v10; // [sp+10h] [bp-8h]@25 | |
1166 | |
1167 v0 = (signed __int64)((double)GetTickCount() * 0.050000001); | |
1168 //v1 = 0; | |
1169 for (uint i = 0; i < 14; ++i) | |
1170 { | |
1171 //v2 = byte_4E5DD8[v1]; | |
1172 if (pParty->pPartyBuffs[byte_4E5DD8[i]].uExpireTime) | |
1173 { | |
1174 auto tex = pIcons_LOD->GetTexture(pTextureIDs_PartyBuffIcons[i]); | |
1175 //v3 = pTextureIDs_PartyBuffIcons[i]; | |
1176 if (tex) | |
1177 pRenderer->_4A65CC(pPartySpellbuffsUI_XYs[i][0], | |
1178 pPartySpellbuffsUI_XYs[i][1], tex, tex, | |
1179 v0 + 20 * pPartySpellbuffsUI_smthns[i], 0, 63); | |
1180 } | |
1181 //++v1; | |
1182 } | |
1183 //while ( v1 < 14 ); | |
1184 | |
1185 if (pCurrentScreen == SCREEN_GAME || pCurrentScreen == SCREEN_NPC_DIALOGUE) | |
1186 { | |
1187 if (pParty->FlyActive()) | |
1188 { | |
1189 if ( pParty->bFlying ) | |
1190 v7 = &pIcons_LOD->pTextures[pIconsFrameTable->GetFrame(uIconIdx_FlySpell, v0)->uTextureID]; | |
1191 else | |
1192 v7 = &pIcons_LOD->pTextures[pIconsFrameTable->GetFrame(uIconIdx_FlySpell, 0)->uTextureID]; | |
1193 if ( pRenderer->pRenderD3D ) | |
1194 pRenderer->DrawTextureIndexed(8u, 8u, v7); | |
1195 else | |
1196 pRenderer->DrawTextureTransparent(8u, 8u, v7); | |
1197 } | |
1198 if (pParty->WaterWalkActive()) | |
1199 { | |
1200 if ( pParty->uFlags & PARTY_FLAGS_1_STANDING_ON_WATER) | |
1201 v9 = &pIcons_LOD->pTextures[pIconsFrameTable->GetFrame(uIconIdx_WaterWalk, v0)->uTextureID]; | |
1202 else | |
1203 v9 = &pIcons_LOD->pTextures[pIconsFrameTable->GetFrame(uIconIdx_WaterWalk, 0)->uTextureID]; | |
1204 if ( pRenderer->pRenderD3D ) | |
1205 pRenderer->DrawTextureIndexed(396u, 8u, v9); | |
1206 else | |
1207 pRenderer->DrawTextureTransparent(396u, 8u, v9); | |
1208 } | |
1209 } | |
1210 | |
1211 for (uint i = 0; i < 4; ++i) | |
1212 { | |
1213 auto player = pParty->pPlayers + i; | |
1214 | |
1215 if (player->pPlayerBuffs[PLAYER_BUFF_HAMMERHANDS].uExpireTime) | |
1216 pRenderer->DrawTextureIndexed(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72, 427, pIcons_LOD->GetTexture(uTextureID_PlayerBuff_Hammerhands)); | |
1217 if (player->pPlayerBuffs[PLAYER_BUFF_BLESS].uExpireTime) | |
1218 pRenderer->DrawTextureIndexed(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72, 393, pIcons_LOD->GetTexture(uTextureID_PlayerBuff_Bless)); | |
1219 if (player->pPlayerBuffs[PLAYER_BUFF_PRESERVATION].uExpireTime) | |
1220 pRenderer->DrawTextureIndexed(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72, 410, pIcons_LOD->GetTexture(uTextureID_PlayerBuff_Preservation)); | |
1221 if (player->pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].uExpireTime) | |
1222 pRenderer->DrawTextureIndexed(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] + 72, 444, pIcons_LOD->GetTexture(uTextureID_PlayerBuff_PainReflection)); | |
1223 } | |
1224 } | |
1225 | |
1226 | |
1227 //----- (00421626) -------------------------------------------------------- | |
1228 GUIWindow *GameUI_InitializeCharacterWindow(unsigned int _this) | |
1229 { | |
1230 unsigned int v1; // edi@1 | |
1231 GUIWindow *pWindow; // edi@3 | |
1232 | |
1233 ++pIcons_LOD->uTexturePacksCount; | |
1234 v1 = _this; | |
1235 if ( !pIcons_LOD->uNumPrevLoadedFiles ) | |
1236 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | |
1237 pEventTimer->Pause(); | |
1238 pAudioPlayer->StopChannels(-1, -1); | |
1239 bRingsShownInCharScreen = 0; | |
1240 CharacterUI_LoadPaperdollTextures(); | |
1241 pCurrentScreen = v1; | |
1242 pWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_CharacterRecord, uActiveCharacter, 0); | |
1243 pCharacterScreen_StatsBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 12, pViewport->uViewportTL_Y + 308, | |
1244 (papredoll_dbrds[9] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[9]].uTextureWidth : 24), | |
1245 (papredoll_dbrds[9] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[9]].uTextureHeight : 26), | |
832 | 1246 1, 0, UIMSG_73, 0, 0x53u, pGlobalTXT_LocalizationStrings[216],// Stats |
706 | 1247 (Texture *)(papredoll_dbrds[10] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[10]] : 0), |
1248 papredoll_dbrds[9] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[9]] : 0, 0); | |
1249 pCharacterScreen_SkillsBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 102, pViewport->uViewportTL_Y + 308, | |
1250 (papredoll_dbrds[7] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[7]].uTextureWidth : 24), | |
1251 (papredoll_dbrds[7] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[7]].uTextureHeight : 26), | |
832 | 1252 1, 0, UIMSG_72, 0, 0x4Bu, pGlobalTXT_LocalizationStrings[205],//Skills |
706 | 1253 (Texture *)(papredoll_dbrds[8] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[8]] : 0), |
1254 papredoll_dbrds[7] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[7]] : 0, 0); | |
1255 pCharacterScreen_InventoryBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 192, pViewport->uViewportTL_Y + 308, | |
1256 (papredoll_dbrds[5] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[5]].uTextureWidth : 24), | |
1257 (papredoll_dbrds[5] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[5]].uTextureHeight : 26), | |
832 | 1258 1, 0, UIMSG_74, 0, 0x49u, pGlobalTXT_LocalizationStrings[120], //Inventory |
706 | 1259 (Texture *)(papredoll_dbrds[6] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[6]] : 0), |
1260 papredoll_dbrds[5] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[5]] : 0, 0); | |
1261 pCharacterScreen_AwardsBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 282, pViewport->uViewportTL_Y + 308, | |
1262 (papredoll_dbrds[3] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[3]].uTextureWidth : 24), | |
1263 (papredoll_dbrds[3] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[3]].uTextureHeight : 26), | |
832 | 1264 1, 0, UIMSG_75, 0, 0x41u, pGlobalTXT_LocalizationStrings[22], //Awards |
706 | 1265 (Texture *)(papredoll_dbrds[4] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[4]] : 0), |
1266 papredoll_dbrds[3] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[3]] : 0, 0); | |
1267 pCharacterScreen_ExitBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 371, pViewport->uViewportTL_Y + 308, | |
1268 (papredoll_dbrds[1] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[1]].uTextureWidth : 24), | |
1269 (papredoll_dbrds[1] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[1]].uTextureHeight : 26), | |
832 | 1270 1, 0, UIMSG_A8, 0, 0, pGlobalTXT_LocalizationStrings[79],//Exit |
706 | 1271 (Texture *)(papredoll_dbrds[2] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[2]] : 0), |
1272 papredoll_dbrds[1] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[1]] : 0, 0); | |
832 | 1273 pWindow->CreateButton(0, 0, 0x1DCu, 0x159u, 1, 122, UIMSG_InventoryLeftClick, 0, 0, "", 0); |
910 | 1274 pCharacterScreen_DetalizBtn = pWindow->CreateButton(0x258u, 0x12Cu, 0x1Eu, 0x1Eu, 1, 0, UIMSG_ChangeDetaliz, 0, 0, pGlobalTXT_LocalizationStrings[64], 0); |
1275 pCharacterScreen_DollBtn = pWindow->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, 1, 0, UIMSG_ClickPaperdoll, 0, 0, "", 0); | |
832 | 1276 pWindow->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 1u, 0x31u, "", 0); |
1277 pWindow->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 2u, 0x32u, "", 0); | |
1278 pWindow->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 3u, 0x33u, "", 0); | |
1279 pWindow->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 4u, 0x34u, "", 0); | |
1280 pWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_CycleCharacters, 0, 9u, "", 0); | |
706 | 1281 FillAwardsData(); |
1282 return pWindow; | |
1283 } | |
1284 | |
1285 | |
1286 //----- (004921C1) -------------------------------------------------------- | |
1287 void GameUI_DrawPortraits(unsigned int _this) | |
832 | 1288 { |
706 | 1289 Texture *pFace; // eax@10 |
1290 unsigned int v7; // eax@17 | |
1291 PlayerFrame *pFrame; // eax@21 | |
1292 unsigned int v9; // eax@27 | |
1293 bool v10; // eax@33 | |
1294 bool v11; // edi@40 | |
1295 bool v12; // edx@43 | |
1296 bool v13; // ecx@46 | |
1297 int v16; // eax@57 | |
1298 int v19; // eax@62 | |
1299 Texture *pPortrait; // [sp-4h] [bp-1Ch]@27 | |
1300 unsigned int v22; // [sp+14h] [bp-4h]@1 | |
1301 | |
1302 v22 = _this; | |
1303 if ( qword_A750D8 ) | |
1304 { | |
1305 qword_A750D8 -= (signed int)pMiscTimer->uTimeElapsed; | |
1306 if ( qword_A750D8 <= 0 ) | |
1307 { | |
1308 if ( pPlayers[word_A750E2]->CanAct() ) | |
1309 pPlayers[word_A750E2]->PlaySound((PlayerSpeech)word_A750E0, 0); | |
1310 qword_A750D8 = 0i64; | |
1311 } | |
1312 } | |
1313 | |
1314 for (uint i = 0; i < 4; ++i) | |
1315 { | |
1316 auto pPlayer = pParty->pPlayers + i; | |
1317 | |
1318 if (pPlayer->Eradicated()) | |
1319 { | |
1320 pFace = pTexture_PlayerFaceEradicated; | |
1321 pPortrait = pFace; | |
1322 v9 = pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i]; | |
1323 if ( pParty->pPartyBuffs[11].uExpireTime ) | |
1324 pRenderer->_4A6E7E(v9, 0x183u, pPortrait); | |
1325 else | |
1326 pRenderer->DrawTextureTransparent(v9 + 1, 0x184u, pPortrait); | |
1327 auto _v1 = 0; | |
1328 v10 = pPlayer->pPlayerBuffs[14].uExpireTime > 0; | |
1329 if (pPlayer->pPlayerBuffs[1].uExpireTime > 0) | |
1330 _v1 = 1; | |
1331 v11 = pPlayer->pPlayerBuffs[8].uExpireTime > 0; | |
1332 v12 = pPlayer->pPlayerBuffs[7].uExpireTime > 0; | |
1333 v13 = pPlayer->pPlayerBuffs[13].uExpireTime > 0; | |
1334 if ( v13 | v12 | v11 | _v1 | v10 ) | |
1335 sub_441A4E(i); | |
1336 continue; | |
1337 } | |
1338 if (pPlayer->Dead()) | |
1339 { | |
1340 pFace = pTexture_PlayerFaceDead; | |
1341 pPortrait = pFace; | |
1342 v9 = pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i]; | |
1343 if ( pParty->pPartyBuffs[11].uExpireTime ) | |
1344 pRenderer->_4A6E7E(v9, 0x183u, pPortrait); | |
1345 else | |
1346 pRenderer->DrawTextureTransparent(v9 + 1, 0x184u, pPortrait); | |
1347 auto _v1 = 0; | |
1348 v10 = pPlayer->pPlayerBuffs[14].uExpireTime > 0; | |
1349 if (pPlayer->pPlayerBuffs[1].uExpireTime > 0) | |
1350 _v1 = 1; | |
1351 v11 = pPlayer->pPlayerBuffs[8].uExpireTime > 0; | |
1352 v12 = pPlayer->pPlayerBuffs[7].uExpireTime > 0; | |
1353 v13 = pPlayer->pPlayerBuffs[13].uExpireTime > 0; | |
1354 if ( v13 | v12 | v11 | _v1 | v10 ) | |
1355 sub_441A4E(i); | |
1356 continue; | |
1357 } | |
1358 v7 = 0; | |
1359 for (uint j = 0; j < pPlayerFrameTable->uNumFrames; ++j) | |
1360 if (pPlayerFrameTable->pFrames[j].expression == pPlayer->expression) | |
1361 { | |
1362 v7 = j; | |
1363 break; | |
1364 } | |
1365 if ( v7 == 0 ) | |
1366 v7 = 1; | |
1367 if (pPlayer->expression == CHARACTER_EXPRESSION_21) | |
1368 pFrame = pPlayerFrameTable->GetFrameBy_y(&pPlayer->_expression21_frameset, &pPlayer->_expression21_animtime, pMiscTimer->uTimeElapsed); | |
1369 else | |
1370 pFrame = pPlayerFrameTable->GetFrameBy_x(v7, pPlayer->uExpressionTimePassed); | |
1371 if (pPlayer->field_1AA2 != pFrame->uTextureID - 1 || v22 ) | |
1372 { | |
1373 pPlayer->field_1AA2 = pFrame->uTextureID - 1; | |
1374 pFace = (Texture *)pTextures_PlayerFaces[i][pPlayer->field_1AA2];//pFace = (Texture *)pTextures_PlayerFaces[i][pFrame->uTextureID]; | |
1375 pPortrait = pFace; | |
1376 v9 = pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i]; | |
1377 if ( pParty->pPartyBuffs[11].uExpireTime ) | |
1378 pRenderer->_4A6E7E(v9, 0x183u, pPortrait); | |
1379 else | |
1380 pRenderer->DrawTextureTransparent(v9 + 1, 0x184u, pPortrait); | |
1381 auto _v1 = 0; | |
1382 v10 = pPlayer->pPlayerBuffs[14].uExpireTime > 0; | |
1383 if (pPlayer->pPlayerBuffs[1].uExpireTime > 0) | |
1384 _v1 = 1; | |
1385 v11 = pPlayer->pPlayerBuffs[8].uExpireTime > 0; | |
1386 v12 = pPlayer->pPlayerBuffs[7].uExpireTime > 0; | |
1387 v13 = pPlayer->pPlayerBuffs[13].uExpireTime > 0; | |
1388 if ( v13 | v12 | v11 | _v1 | v10 ) | |
1389 sub_441A4E(i); | |
1390 continue; | |
1391 } | |
1392 } | |
1393 if ( pParty->bTurnBasedModeOn == 1 ) | |
1394 { | |
1395 if ( pTurnEngine->field_4 != 1 ) | |
1396 { | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
809
diff
changeset
|
1397 if (PID_TYPE(pTurnEngine->pQueue[0].uPackedID) == OBJECT_Player) |
706 | 1398 { |
1399 //v14 = 0; | |
1400 if ( pTurnEngine->uActorQueueSize > 0 ) | |
1401 { | |
1402 //v15 = (char *)pTurnEngine->pQueue; | |
1403 for (uint i = 0; i < pTurnEngine->uActorQueueSize; ++i) | |
1404 { | |
1405 auto pElem = pTurnEngine->pQueue + i; | |
1406 | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
809
diff
changeset
|
1407 if (PID_TYPE(pElem->uPackedID) != OBJECT_Player) |
706 | 1408 break; |
1409 v16 = dword_5079D0; | |
1410 if ( pParty->uFlags & 0x10 ) | |
1411 { | |
1412 v16 = dword_5079CC; | |
1413 } | |
1414 else | |
1415 { | |
1416 if ( pParty->uFlags & 0x20 ) | |
1417 v16 = dword_5079C8; | |
1418 } | |
848 | 1419 pRenderer->DrawTextureTransparent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[PID_ID(pElem->uPackedID)] - 4, |
706 | 1420 0x181u, (Texture *)(v16 != -1 ? &pIcons_LOD->pTextures[v16] : 0)); |
1421 } | |
1422 } | |
1423 } | |
1424 } | |
1425 } | |
1426 else | |
1427 { | |
1428 for (uint i = 0; i < 4; ++i) | |
1429 { | |
1430 auto pPlayer = pParty->pPlayers + i; | |
1431 if (pPlayer->CanAct() && !pPlayer->uTimeToRecovery) | |
1432 { | |
1433 v19 = dword_5079D0; | |
1434 if ( pParty->uFlags & 0x10 ) | |
1435 { | |
1436 v19 = dword_5079CC; | |
1437 } | |
1438 else | |
1439 { | |
1440 if ( pParty->uFlags & 0x20 ) | |
1441 v19 = dword_5079C8; | |
1442 } | |
1443 pRenderer->DrawTextureTransparent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i] - 4, | |
1444 0x181u, (Texture *)(v19 != -1 ? &pIcons_LOD->pTextures[v19] : 0)); | |
1445 } | |
1446 } | |
1447 } | |
1448 } | |
1449 | |
709 | 1450 //----- (00441D38) -------------------------------------------------------- |
706 | 1451 void GameUI_DrawMinimap(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW, unsigned int uZoom, unsigned int bRedrawOdmMinimap) |
1452 { | |
1453 int uHeight; // ebx@6 | |
1454 __int16 v11; // cx@11 | |
1455 unsigned int v14; // ebx@23 | |
1456 int v15; // eax@23 | |
1457 __int16 v17; // di@30 | |
1458 double v18; // st7@30 | |
1459 float v19; // ST38_4@30 | |
1460 double v20; // st7@30 | |
1461 double v21; // st6@30 | |
1462 double v22; // st5@33 | |
1463 signed int v27; // eax@37 | |
1464 unsigned __int16 *v28; // ecx@37 | |
1465 signed int v29; // edi@40 | |
1466 //signed int v33; // ebx@50 | |
1467 //unsigned int v34; // eax@50 | |
1468 //signed int v35; // ecx@50 | |
1469 //unsigned __int16 v36; // di@66 | |
1470 int v37; // edi@72 | |
1471 int v38; // ebx@72 | |
1472 __int16 v39; // ax@87 | |
1473 int v40; // edi@91 | |
1474 int v41; // ebx@91 | |
1475 unsigned int v42; // eax@101 | |
1476 unsigned int v43; // ebx@101 | |
1477 unsigned int v44; // ST30_4@101 | |
1478 char *v45; // ebx@106 | |
1479 int v46; // edi@108 | |
1480 int v47; // eax@108 | |
1481 unsigned int v48; // ebx@114 | |
1482 unsigned int v49; // ST64_4@114 | |
709 | 1483 //unsigned int v51; // [sp-10h] [bp-64h]@79 |
706 | 1484 unsigned int v52; // [sp-10h] [bp-64h]@100 |
709 | 1485 //unsigned int v53; // [sp-Ch] [bp-60h]@79 |
706 | 1486 unsigned int v54; // [sp-Ch] [bp-60h]@100 |
709 | 1487 //unsigned int v55; // [sp-8h] [bp-5Ch]@77 |
706 | 1488 unsigned int v56; // [sp-8h] [bp-5Ch]@100 |
1489 //signed int v57; // [sp-4h] [bp-58h]@54 | |
709 | 1490 //unsigned __int16 v58; // [sp-4h] [bp-58h]@77 |
706 | 1491 unsigned __int16 v59; // [sp-4h] [bp-58h]@100 |
1492 unsigned __int16 v60; // [sp+10h] [bp-44h]@66 | |
1493 unsigned int v61; // [sp+10h] [bp-44h]@85 | |
1494 unsigned int v63; // [sp+14h] [bp-40h]@85 | |
1495 unsigned int v65; // [sp+18h] [bp-3Ch]@85 | |
1496 unsigned int lPitch; // [sp+20h] [bp-34h]@1 | |
1497 unsigned int lPitcha; // [sp+20h] [bp-34h]@23 | |
1498 char *lPitchb; // [sp+20h] [bp-34h]@106 | |
1499 unsigned int v69; // [sp+24h] [bp-30h]@23 | |
1500 signed int v70; // [sp+24h] [bp-30h]@37 | |
1501 unsigned __int16 uBlue; // [sp+28h] [bp-2Ch]@1 | |
1502 signed int uBluea; // [sp+28h] [bp-2Ch]@37 | |
1503 int v73; // [sp+2Ch] [bp-28h]@30 | |
1504 int v76; // [sp+34h] [bp-20h]@91 | |
1505 int v77; // [sp+34h] [bp-20h]@108 | |
709 | 1506 //int v79; // [sp+38h] [bp-1Ch]@72 |
1507 //char *a2c; // [sp+40h] [bp-14h]@68 | |
706 | 1508 signed int uCenterY; // [sp+48h] [bp-Ch]@1 |
1509 signed int uCenterX; // [sp+4Ch] [bp-8h]@1 | |
1510 signed int uWidth; // [sp+5Ch] [bp+8h]@30 | |
709 | 1511 //signed int uZe; // [sp+5Ch] [bp+8h]@67 |
706 | 1512 signed int uZf; // [sp+5Ch] [bp+8h]@85 |
1513 signed int uZg; // [sp+5Ch] [bp+8h]@105 | |
1514 unsigned int uWa; // [sp+60h] [bp+Ch]@23 | |
1515 float uWb; // [sp+60h] [bp+Ch]@30 | |
1516 unsigned int uWd; // [sp+60h] [bp+Ch]@95 | |
1517 float uZooma; // [sp+64h] [bp+10h]@117 | |
1518 unsigned int flagsb; // [sp+68h] [bp+14h]@66 | |
1519 Actor *flagsc; // [sp+68h] [bp+14h]@86 | |
1520 unsigned int flagsd; // [sp+68h] [bp+14h]@105 | |
1521 | |
1522 uCenterX = (uX + uZ) / 2; | |
1523 uCenterY = (uY + uW) / 2; | |
1524 lPitch = pRenderer->uTargetSurfacePitch; | |
1525 GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0, 0); | |
1526 uBlue = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0, 0xFFu); | |
1527 auto bWizardEyeActive = pParty->WizardEyeActive(); | |
1528 auto uWizardEyeSkillLevel = pParty->WizardEyeSkillLevel(); | |
1529 if (CheckHiredNPCSpeciality(Cartographer)) | |
1530 { | |
1531 bWizardEyeActive = true; | |
1532 uWizardEyeSkillLevel = 2; | |
1533 } | |
709 | 1534 bWizardEyeActive = true; |
1535 uWizardEyeSkillLevel = 3; | |
1536 pRenderer->SetRasterClipRect(uX, uY, uZ - 1, uW - 1); | |
706 | 1537 uHeight = uW - uY; |
1538 uWidth = uZ - uX; | |
1539 | |
1540 if ( uCurrentlyLoadedLevelType != LEVEL_Indoor) | |
1541 { | |
1542 v17 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uWidthLn2; | |
710 | 1543 auto pMapLod0 = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pLevelOfDetail0_prolly_alpha_mask; |
706 | 1544 auto pPal = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].pPalette16; |
1545 v73 = (1 << (v17 + 16)) / (signed int)uZoom; | |
1546 v18 = (double)(1 << (16 - v17)); | |
1547 v19 = v18; | |
1548 v20 = (double)(pParty->vPosition.x + 32768) / v18; | |
1549 v21 = (double)(32768 - pParty->vPosition.y) / v19; | |
1550 uWb = v21; | |
1551 switch (uZoom) | |
1552 { | |
1553 case 512: | |
1554 { | |
1555 v20 = v20 - (double)(uWidth / 2); | |
1556 v22 = (double)(uHeight / 2); | |
1557 uWb = v21 - v22; | |
1558 } | |
1559 break; | |
1560 | |
1561 case 1024: | |
1562 { | |
1563 v20 = v20 - (double)(uWidth / 4); | |
1564 v22 = (double)(uHeight / 4); | |
1565 uWb = v21 - v22; | |
1566 } | |
1567 break; | |
1568 | |
1569 case 2048: | |
1570 { | |
1571 v20 = v20 - (double)(uWidth / 8); | |
1572 v22 = (double)(uHeight / 8); | |
1573 uWb = v21 - v22; | |
1574 } | |
1575 break; | |
1576 | |
1577 default: assert(false); | |
1578 } | |
1579 assert(sizeof(pOdmMinimap) == 137 * 117 * sizeof(short)); | |
1580 | |
1581 v70 = floorf(v20 * 65536.0 + 0.5f);//LODWORD(v24); | |
1582 uBluea = floorf(uWb * 65536.0 + 0.5f);//LODWORD(v25); | |
1583 v27 = uBluea >> 16; | |
1584 v28 = &pRenderer->pTargetSurface[uX + uY * lPitch]; | |
1585 if (pMapLod0 && bRedrawOdmMinimap) | |
1586 { | |
1587 assert(uWidth == 137 && uHeight == 117); | |
1588 //auto pMinimap = (unsigned __int16 *)pOdmMinimap; | |
1589 | |
1590 auto mapWidth = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uTextureWidth; | |
1591 | |
1592 v29 = v70 >> 16; | |
1593 | |
1594 for (int y = 0; y < uHeight; ++y) | |
1595 { | |
1596 auto pMapLod0Line = &pMapLod0[v27 * mapWidth]; | |
1597 for (int x = 0; x < uWidth; ++x) | |
1598 { | |
1599 //*pMinimap++ = pPal[pMapLod0Line[v29]]; | |
1600 pOdmMinimap[y][x] = pPal[pMapLod0Line[v29]]; | |
1601 v29 = (v70 + x * v73) >> 16; | |
1602 } | |
1603 | |
1604 v29 = v70 >> 16; | |
1605 v28 += 137 - uWidth; | |
1606 uBluea += v73; | |
1607 v27 = uBluea >> 16; | |
1608 } | |
1609 } | |
1610 | |
1611 for (int y = 0; y < 117; ++y) | |
1612 { | |
1613 for (int x = 0; x < 137; ++x) | |
1614 { | |
1615 *v28++ = pOdmMinimap[y][x]; | |
1616 } | |
1617 v28 += lPitch - 137; | |
1618 } | |
1619 uNumBlueFacesInBLVMinimap = 0; | |
1620 } | |
1621 else | |
1622 { | |
1623 pRenderer->FillRectFast(uX, uY, uZ - uX, uHeight, 0xF); | |
1624 uNumBlueFacesInBLVMinimap = 0; | |
1625 | |
1626 for (uint i = 0; i < pIndoor->pMapOutlines->uNumOutlines; ++i) | |
1627 { | |
1628 auto pOutline = &pIndoor->pMapOutlines->pOutlines[i]; | |
1629 | |
1630 auto pFace1 = pIndoor->pFaces + pOutline->uFace1ID; | |
1631 auto pFace2 = pIndoor->pFaces + pOutline->uFace2ID; | |
1632 //v9 = pIndoor->pFaces[pMapVertex->uFace1ID].uAttributes; | |
1633 //v10 = pIndoor->pFaces[pMapVertex->uFace2ID].uAttributes; | |
1634 if (pFace1->Visible() && pFace2->Visible()) | |
1635 { | |
1636 v11 = pOutline->uFlags; | |
1637 if ( v11 & 1 ) | |
1638 goto LABEL_15; | |
1639 if (pFace1->uAttributes & 0x80 || pFace2->uAttributes & 0x80u != 0 ) | |
1640 goto LABEL_ABC; | |
1641 | |
1642 } | |
1643 continue; | |
1644 | |
1645 LABEL_ABC: | |
1646 pOutline->uFlags = v11 | 1; | |
1647 pIndoor->_visible_outlines[i >> 3] |= 1 << (7 - i % 8); | |
1648 | |
1649 LABEL_15: | |
1650 //v12 = &pIndoor->pFaces[pOutline->uFace1ID]; | |
1651 if (bWizardEyeActive && uWizardEyeSkillLevel >= 3 && | |
1652 (pFace1->uAttributes & 0x2000000 || pFace2->uAttributes & 0x2000000) && | |
1653 (pIndoor->pFaceExtras[pFace1->uFaceExtraID].uEventID || pIndoor->pFaceExtras[pFace2->uFaceExtraID].uEventID)) | |
1654 { | |
1655 if (uNumBlueFacesInBLVMinimap < 49) | |
1656 pBlueFacesInBLVMinimapIDs[uNumBlueFacesInBLVMinimap++] = i; | |
1657 } | |
1658 else | |
1659 { | |
1660 auto _a = (uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].x); | |
1661 auto _b = ((unsigned int)((unsigned __int64)_a >> 16) << 16); | |
1662 auto _c = ((signed int)(_b - uZoom * pParty->vPosition.x) >> 16); | |
1663 v69 = uCenterX + _c; | |
1664 v69 = uCenterX + ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].x) >> 16) << 16) - uZoom * pParty->vPosition.x) >> 16); | |
1665 lPitcha = uCenterY - ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].y) >> 16) << 16) - uZoom * pParty->vPosition.y) >> 16); | |
1666 uWa = uCenterX + ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex2ID].x) >> 16) << 16) - uZoom * pParty->vPosition.x) >> 16); | |
1667 v14 = uCenterY - ((signed int)(((unsigned int)((unsigned __int64)(uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex2ID].y) >> 16) << 16) - uZoom * pParty->vPosition.y) >> 16); | |
1668 v15 = abs(pOutline->sZ - pParty->vPosition.z) / 8; | |
1669 if ( v15 > 100 ) | |
1670 v15 = 100; | |
709 | 1671 pRenderer->RasterLine2D(v69, lPitcha, uWa, v14, viewparams->pPalette[-v15 + 200]); |
706 | 1672 } |
1673 } | |
1674 | |
1675 | |
1676 for (uint i = 0; i < uNumBlueFacesInBLVMinimap; ++i) | |
1677 { | |
1678 //v16 = (uint *)&pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[uZb]]; | |
1679 auto pOutline = &pIndoor->pMapOutlines->pOutlines[pBlueFacesInBLVMinimapIDs[i]]; | |
709 | 1680 pRenderer->RasterLine2D(uCenterX + ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom |
706 | 1681 * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].x) >> 16) << 16) |
1682 - uZoom * pParty->vPosition.x) >> 16), | |
1683 uCenterY | |
1684 - ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom | |
1685 * (signed __int64)pIndoor->pVertices[pOutline->uVertex1ID].y) >> 16) << 16) | |
1686 - uZoom * pParty->vPosition.y) >> 16), | |
1687 uCenterX | |
1688 + ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom | |
1689 * (signed __int64)pIndoor->pVertices[pOutline->uVertex2ID].x) >> 16) << 16) | |
1690 - uZoom * pParty->vPosition.x) >> 16), | |
1691 uCenterY | |
1692 - ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom | |
1693 * (signed __int64)pIndoor->pVertices[pOutline->uVertex2ID].y) >> 16) << 16) | |
1694 - uZoom * pParty->vPosition.y) >> 16), | |
1695 uBlue); | |
1696 } | |
1697 } | |
1698 | |
1699 | |
1700 assert(pParty->sRotationY >= 0); | |
1701 float angle = (pParty->sRotationY % 2048) / 2048.0f; | |
1702 const float two_pi = 2.0f * 3.14159f; | |
1703 | |
1704 uint arrow_idx = floorf(0.5f + 7 * angle); | |
1705 pRenderer->DrawTextureTransparent(uCenterX - 3, uCenterY - 3, pIcons_LOD->GetTexture(pTextureIDs_pMapDirs[arrow_idx])); | |
1706 | |
709 | 1707 flagsb = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0, 255); |
1708 v60 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(255, 0, 0); | |
706 | 1709 if (bWizardEyeActive) |
1710 { | |
709 | 1711 //uZe = 0; |
1712 if (uWizardEyeSkillLevel >= 2) | |
1713 for (uint i = 0; i < uNumSpriteObjects; ++i) | |
1714 //if (uNumSpriteObjects > 0) | |
1715 { | |
1716 auto object = pSpriteObjects + i; | |
1717 | |
1718 //a2c = (char *)&pSpriteObjects[0].uObjectDescID; | |
1719 //while ( 1 ) | |
1720 //{ | |
1721 if (!object->uType || !object->uObjectDescID) | |
1722 continue; | |
1723 //if (uWizardEyeSkillLevel == 1 | |
1724 v37 = uCenterX + ((unsigned __int64)((object->vPosition.x - pParty->vPosition.x) * (signed __int64)uZoom) >> 16); | |
1725 //v79 = (unsigned __int64)((object->vPosition.y - pParty->vPosition.y) * (signed __int64)(signed int)uZoom) >> 16; | |
1726 //v38 = uCenterY - v79; | |
1727 v38 = uCenterY - ((signed __int64)((object->vPosition.y - pParty->vPosition.y) * (signed __int64)uZoom) >> 16); | |
1728 if (v37 < pRenderer->raster_clip_x || v37 > pRenderer->raster_clip_z || | |
1729 v38 < pRenderer->raster_clip_y || v38 > pRenderer->raster_clip_w) | |
1730 continue; | |
1731 | |
1732 assert(uZoom >= 512); | |
1733 if (pObjectList->pObjects[object->uObjectDescID].uFlags & OBJECT_DESC_UNPICKABLE) | |
706 | 1734 { |
709 | 1735 pRenderer->RasterLine2D(v37, v38, |
1736 v37, v38, v60); | |
1737 } | |
1738 else if (uZoom > 512) | |
1739 { | |
1740 pRenderer->RasterLine2D(v37 - 1, v38 - 1, v37 - 1, v38 + 1, flagsb); | |
1741 pRenderer->RasterLine2D(v37, v38 - 2, v37, v38 + 1, flagsb); | |
1742 pRenderer->RasterLine2D(v37 + 1, v38 - 1, v37 + 1, v38 + 1, flagsb); | |
1743 pRenderer->RasterLine2D(v37 - 2, v38, v37 - 2, v38 + 1, flagsb); | |
1744 pRenderer->RasterLine2D(v37 + 2, v38, | |
1745 v37 + 2, v38 + 1, flagsb); | |
706 | 1746 } |
709 | 1747 else |
1748 { | |
1749 pRenderer->RasterLine2D(v37 - 1, v38 - 1, | |
1750 v37 - 1, v38, flagsb); | |
1751 pRenderer->RasterLine2D(v37, v38 - 1, | |
1752 v37, v38, flagsb); | |
1753 } | |
1754 //LABEL_82: | |
1755 //LABEL_83: | |
1756 //++uZe; | |
1757 //a2c += 112; | |
1758 //if ( uZe >= (signed int)uNumSpriteObjects ) | |
1759 //{ | |
1760 //goto LABEL_85; | |
1761 //} | |
1762 //} | |
706 | 1763 } |
709 | 1764 |
1765 | |
706 | 1766 LABEL_85: |
1767 v63 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(255, 0, 0); | |
1768 v61 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 255, 0); | |
1769 v65 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(255, 255, 0); | |
1770 uZf = 0; | |
1771 if ( (signed int)uNumActors > 0 ) | |
1772 { | |
1773 flagsc = pActors;//[0].uAIState; | |
1774 do | |
1775 { | |
1776 v39 = flagsc->uAIState; | |
1777 if ( flagsc->uAIState != 11 && v39 != 19 && (v39 == 5 || BYTE1(flagsc->uAttributes) & 0x80) ) | |
1778 { | |
1779 v40 = ((unsigned __int64)(( flagsc->vPosition.x - pParty->vPosition.x) | |
1780 * (signed __int64)(signed int)uZoom) >> 16) | |
1781 + uCenterX; | |
1782 v76 = (unsigned __int64)(( flagsc->vPosition.y - pParty->vPosition.y) | |
1783 * (signed __int64)(signed int)uZoom) >> 16; | |
1784 v41 = uCenterY - v76; | |
709 | 1785 if ( v40 >= pRenderer->raster_clip_x ) |
706 | 1786 { |
709 | 1787 if ( v40 <= pRenderer->raster_clip_z && v41 >= pRenderer->raster_clip_y && v41 <= pRenderer->raster_clip_w ) |
706 | 1788 { |
1789 uWd = v61; | |
1790 if ( BYTE3(flagsc->uAttributes) & 1 ) | |
1791 uWd = v63; | |
1792 if ( flagsc->uAIState == 5 ) | |
1793 uWd = v65; | |
1794 if ( (signed int)uZoom > 1024 ) | |
1795 { | |
709 | 1796 pRenderer->RasterLine2D(v40 - 1, v41 - 2, v40 - 1, v41 + 2, uWd); |
1797 pRenderer->RasterLine2D(v40, v41 - 2, v40, v41 + 2, uWd); | |
1798 pRenderer->RasterLine2D(v40 + 1, v41 - 2, v40 + 1, v41 + 2, uWd); | |
706 | 1799 v42 = v41 + 1; |
1800 v43 = v41 - 1; | |
1801 v44 = v42; | |
709 | 1802 pRenderer->RasterLine2D(v40 - 2, v43, v40 - 2, v42, uWd); |
706 | 1803 v40 += 2; |
1804 v59 = uWd; | |
1805 v56 = v44; | |
1806 v54 = v40; | |
1807 v52 = v43; | |
1808 } | |
1809 else | |
1810 { | |
709 | 1811 pRenderer->RasterLine2D(v40 - 1, v41 - 1, v40 - 1, uCenterY - v76, uWd); |
706 | 1812 v59 = uWd; |
1813 v56 = uCenterY - v76; | |
1814 v54 = v40; | |
1815 v52 = v41 - 1; | |
1816 } | |
709 | 1817 pRenderer->RasterLine2D(v40, v52, v54, v56, v59); |
706 | 1818 } |
1819 } | |
1820 } | |
1821 ++uZf; | |
1822 ++flagsc; | |
1823 } | |
1824 while ( uZf < (signed int)uNumActors ); | |
1825 } | |
1826 } | |
709 | 1827 |
1828 | |
706 | 1829 flagsd = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(255, 255, 255); |
1830 uZg = 0; | |
1831 if ( (signed int)uNumLevelDecorations > 0 ) | |
1832 { | |
1833 v45 = (char *)&pLevelDecorations[0].vPosition; | |
1834 lPitchb = (char *)&pLevelDecorations[0].vPosition; | |
1835 do | |
1836 { | |
1837 if ( *(v45 - 2) & 8 ) | |
1838 { | |
1839 v46 = ((unsigned __int64)((*(int *)v45 - pParty->vPosition.x) * (signed __int64)(signed int)uZoom) >> 16) | |
1840 + uCenterX; | |
1841 v77 = (unsigned __int64)((*((int *)v45 + 1) - pParty->vPosition.y) * (signed __int64)(signed int)uZoom) >> 16; | |
1842 v47 = uCenterY - v77; | |
709 | 1843 if ( v46 >= pRenderer->raster_clip_x ) |
706 | 1844 { |
709 | 1845 if ( v46 <= pRenderer->raster_clip_z && v47 >= pRenderer->raster_clip_y && v47 <= pRenderer->raster_clip_w ) |
706 | 1846 { |
1847 if ( (signed int)uZoom > 512 ) | |
1848 { | |
1849 v48 = v47 + 1; | |
1850 v49 = v47 - 1; | |
709 | 1851 pRenderer->RasterLine2D(v46 - 1, v47 - 1, v46 - 1, v47 + 1, flagsd); |
1852 pRenderer->RasterLine2D(v46, v49, v46, v48, flagsd); | |
1853 pRenderer->RasterLine2D(v46 + 1, v49, v46 + 1, v48, flagsd); | |
706 | 1854 v45 = lPitchb; |
1855 } | |
1856 else | |
1857 { | |
709 | 1858 pRenderer->RasterLine2D(v46, uCenterY - v77, v46, uCenterY - v77, flagsd); |
706 | 1859 } |
1860 } | |
1861 } | |
1862 } | |
1863 ++uZg; | |
1864 v45 += 32; | |
1865 lPitchb = v45; | |
1866 } | |
1867 while ( uZg < (signed int)uNumLevelDecorations ); | |
1868 } | |
1869 pRenderer->DrawTextureTransparent(0x1D4u, 0, (Texture *)(dword_5079D8 != -1 ? &pIcons_LOD->pTextures[dword_5079D8] : 0)); | |
1870 uZooma = (double)pParty->sRotationY * 0.1171875; | |
1871 //v50 = uZooma + 6.7553994e15; | |
727 | 1872 pRenderer->SetTextureClipRect(541, 0, 567, 480); |
706 | 1873 pRenderer->DrawTextureIndexed(floorf(uZooma + 0.5f) + 285, 136, (Texture *)(dword_5079B4 != -1 ? &pIcons_LOD->pTextures[dword_5079B4] : 0)); |
727 | 1874 pRenderer->ResetTextureClipRect(); |
706 | 1875 } |
1876 | |
1877 //----- (00441498) -------------------------------------------------------- | |
1878 void __cdecl GameUI_DrawTorchlightAndWizardEye() | |
1879 { | |
1880 if (pCurrentScreen == SCREEN_GAME | |
1881 || pCurrentScreen == SCREEN_MENU | |
1882 || pCurrentScreen == SCREEN_OPTIONS | |
1883 || pCurrentScreen == SCREEN_REST | |
1884 || pCurrentScreen == SCREEN_SPELL_BOOK | |
1885 || pCurrentScreen == SCREEN_CHEST | |
1886 || pCurrentScreen == SCREEN_SAVEGAME | |
1887 || pCurrentScreen == SCREEN_LOADGAME | |
1888 || pCurrentScreen == SCREEN_F | |
1889 || pCurrentScreen == SCREEN_BOOKS | |
1890 || pCurrentScreen == SCREEN_BRANCHLESS_NPC_DIALOG ) | |
1891 { | |
1892 if (pParty->TorchlightActive()) | |
1893 { | |
1894 auto icon = pIconsFrameTable->GetFrame((signed __int16)pUIAnum_Torchlight->uIconID, pEventTimer->Time()); | |
1895 pRenderer->DrawTextureTransparent(pUIAnum_Torchlight->x, pUIAnum_Torchlight->y, pIcons_LOD->GetTexture(icon->uTextureID)); | |
1896 } | |
1897 if (pParty->WizardEyeActive()) | |
1898 { | |
1899 auto icon = pIconsFrameTable->GetFrame((signed __int16)pUIAnim_WizardEye->uIconID, pEventTimer->Time()); | |
1900 pRenderer->DrawTextureTransparent(pUIAnim_WizardEye->x, pUIAnim_WizardEye->y, pIcons_LOD->GetTexture(icon->uTextureID)); | |
1901 } | |
1902 } | |
1903 } | |
1904 // 4E28F8: using guessed type int pCurrentScreen; | |
1905 | |
1906 | |
1907 //----- (00491F87) -------------------------------------------------------- | |
1908 void __cdecl DrawHiredNPCs() | |
1909 { | |
1910 //int v6; // eax@15 | |
1911 char v7; // al@17 | |
1912 unsigned int v8; // eax@18 | |
1913 int v9; // esi@18 | |
1914 int v10; // eax@18 | |
1915 unsigned int v11; // eax@19 | |
1916 unsigned int v12; // esi@19 | |
1917 unsigned int v13; // eax@23 | |
1918 IconFrame *v14; // eax@24 | |
1919 unsigned int v15; // eax@26 | |
1920 char pContainer[20]; // [sp+Ch] [bp-30h]@18 | |
1921 unsigned int v17; // [sp+20h] [bp-1Ch]@19 | |
1922 signed int uFrameID; // [sp+24h] [bp-18h]@19 | |
1923 //int i; // [sp+28h] [bp-14h]@15 | |
1924 unsigned int v20; // [sp+2Ch] [bp-10h]@20 | |
1925 unsigned int v21; // [sp+30h] [bp-Ch]@19 | |
1926 int v22; // [sp+34h] [bp-8h]@2 | |
1927 unsigned __int8 v23; // [sp+3Bh] [bp-1h]@2 | |
1928 | |
1929 if ( bNoNPCHiring != 1 ) | |
1930 { | |
1931 v23 = 0; | |
1932 v22 = 0; | |
1933 /*for (uint i = 0; i < 2; ++i) | |
1934 { | |
1935 if (pParty->pHirelings[i].pName) | |
1936 pTmpBuf[v22++] = i; | |
1937 }*/ | |
1938 if (pParty->pHirelings[0].pName) | |
1939 pTmpBuf[v22++] = 0; | |
1940 if (pParty->pHirelings[1].pName) | |
1941 pTmpBuf[v22++] = 1; | |
1942 | |
1943 for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i) | |
1944 { | |
1945 if (pNPCStats->pNewNPCData[i].uFlags & 128) | |
1946 { | |
1947 if (!pParty->pHirelings[0].pName || strcmp(pNPCStats->pNewNPCData[i].pName, pParty->pHirelings[0].pName)) | |
1948 { | |
1949 if (!pParty->pHirelings[1].pName || strcmp(pNPCStats->pNewNPCData[i].pName, pParty->pHirelings[1].pName)) | |
1950 pTmpBuf[v22++] = i + 2; | |
1951 } | |
1952 } | |
1953 } | |
1954 | |
1955 //v6 = (unsigned __int8)pParty->field_709; | |
1956 for ( int i = (unsigned __int8)pParty->field_709; i < v22 && v23 < 2; i++ ) | |
1957 { | |
1958 v7 = pTmpBuf[i]; | |
1959 if ( (unsigned __int8)v7 >= 2 ) | |
1960 { | |
1961 sprintf(pContainer, "NPC%03d", pNPCStats->pNPCData[(unsigned __int8)v7 + 499].uPortraitID); | |
1962 v15 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); | |
1963 pRenderer->DrawTextureIndexed(pHiredNPCsIconsOffsetsX[v23], pHiredNPCsIconsOffsetsY[v23], (Texture *)(v15 != -1 ? &pIcons_LOD->pTextures[v15] : 0)); | |
1964 } | |
1965 else | |
1966 { | |
1967 sprintf(pContainer, "NPC%03d", pParty->pHirelings[(unsigned __int8)v7].uPortraitID); | |
1968 v8 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); | |
1969 v9 = v23; | |
1970 pRenderer->DrawTextureIndexed(pHiredNPCsIconsOffsetsX[v9], pHiredNPCsIconsOffsetsY[v9], (Texture *)(v8 != -1 ? &pIcons_LOD->pTextures[v8] : 0)); | |
1971 v10 = (unsigned __int8)pTmpBuf[i]; | |
1972 if ( pParty->pHirelings[v10].evt_A == 1 ) | |
1973 { | |
1974 uFrameID = pParty->pHirelings[v10].evt_B; | |
1975 v11 = pHiredNPCsIconsOffsetsX[v9]; | |
1976 v12 = pHiredNPCsIconsOffsetsY[v9]; | |
1977 v17 = v11; | |
1978 v21 = 0; | |
1979 if ( (signed int)pIconsFrameTable->uNumIcons <= 0 ) | |
1980 { | |
1981 LABEL_23: | |
1982 v13 = 0; | |
1983 } | |
1984 else | |
1985 { | |
1986 v20 = 0; | |
1987 while ( _strcmpi("spell96", pIconsFrameTable->pIcons[v20 / 0x20].pAnimationName) ) | |
1988 { | |
1989 ++v21; | |
1990 v20 += 32; | |
1991 if ( (signed int)v21 >= (signed int)pIconsFrameTable->uNumIcons ) | |
1992 goto LABEL_23; | |
1993 } | |
1994 v13 = v21; | |
1995 } | |
1996 v14 = pIconsFrameTable->GetFrame(v13, uFrameID); | |
1997 pRenderer->DrawTextureTransparent(v17, v12, &pIcons_LOD->pTextures[v14->uTextureID]); | |
1998 } | |
1999 } | |
2000 ++v23; | |
2001 } | |
2002 } | |
2003 } | |
2004 // 6BE3C5: using guessed type char bNoNPCHiring; | |
2005 |