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