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