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