Mercurial > mm7
annotate mm7_1.cpp @ 100:81e93310f73c
rest screen, enemy status color fixed
author | zipi |
---|---|
date | Thu, 07 Feb 2013 22:23:10 +0000 |
parents | 98cd93e14777 |
children | 2baff1256844 |
rev | line source |
---|---|
0 | 1 /* This file has been generated by the Hex-Rays decompiler. |
2 Copyright (c) 2007-2011 Hex-Rays <info@hex-rays.com> | |
3 | |
4 Detected compiler: Visual C++ | |
5 */ | |
6 | |
7 //#include <defs.h> | |
8 #include "MM7.h" | |
9 | |
10 #include "MapInfo.h" | |
11 #include "Game.h" | |
12 #include "GUIWindow.h" | |
13 #include "GUIFont.h" | |
14 #include "GUIButton.h" | |
15 #include "GUIProgressBar.h" | |
16 #include "Party.h" | |
17 #include "AudioPlayer.h" | |
18 #include "Outdoor.h" | |
19 #include "IndoorCamera.h" | |
20 #include "Overlays.h" | |
21 #include "Monsters.h" | |
22 #include "Arcomage.h" | |
23 #include "LOD.h" | |
24 #include "Actor.h" | |
25 #include "Allocator.h" | |
26 #include "Events.h" | |
27 #include "Viewport.h" | |
28 #include "FrameTableInc.h" | |
29 #include "Math.h" | |
30 #include "LayingItem.h" | |
31 #include "ObjectList.h" | |
32 #include "Chest.h" | |
33 #include "PaletteManager.h" | |
34 #include "DecorationList.h" | |
35 #include "SaveLoad.h" | |
36 #include "stru123.h" | |
37 #include "Time.h" | |
38 #include "IconFrameTable.h" | |
39 #include "stru179.h" | |
40 #include "Awards.h" | |
41 #include "Autonotes.h" | |
42 #include "stru160.h" | |
43 #include "stru279.h" | |
44 #include "TurnEngine.h" | |
45 #include "stru277.h" | |
46 #include "Weather.h" | |
47 #include "stru272.h" | |
48 #include "stru298.h" | |
49 #include "StorylineTextTable.h" | |
50 #include "Events2D.h" | |
51 | |
52 #include "mm7_data.h" | |
53 | |
54 | |
55 | |
56 | |
57 int __stdcall aWinProc(HWND hWnd, UINT Msg, WPARAM wParam, unsigned int lParam); | |
58 int __stdcall InsertMM7CDDialogFunc(HWND hDlg, int a2, __int16 a3, int a4); | |
59 bool __fastcall FindMM7CD(HWND hWnd, char *pCDDrive); | |
60 bool __fastcall Initialize(HINSTANCE hInst, char *pCmdLine); | |
61 | |
62 | |
63 | |
64 | |
65 | |
66 | |
67 void __cdecl FreeSavegameThumbnails() | |
68 { | |
69 for (int i = 0; i < 40; ++i) | |
70 //pAllocator->FreeChunk(pSavegameThumbnails[i].pPixels); | |
71 pSavegameThumbnails[i].Release(); | |
72 } | |
73 | |
74 | |
75 //----- (004196A0) -------------------------------------------------------- | |
76 void __cdecl sub_4196A0() | |
77 { | |
78 GUIButton *i; // esi@2 | |
79 GUIButton *j; // esi@7 | |
80 | |
81 if ( dword_507CC0 ) | |
82 { | |
83 dword_507CC0 = 0; | |
84 for ( i = pGUIWindow_CurrentMenu->pControlsHead; i; i = i->pNext ) | |
85 { | |
86 if ( BYTE1(i->field_1C) & 0x80 ) | |
87 GUIButton::_41D0D8(i); | |
88 } | |
89 for ( j = pGUIWindow_CurrentMenu->pControlsHead; j; j = j->pNext ) | |
90 { | |
91 if ( j->uControlID == 120 ) | |
92 { | |
93 j->uX = dword_50698C; | |
94 j->uY = dword_506988; | |
95 j->uZ = dword_506984; | |
96 j->uW = dword_506980; | |
97 pGUIWindow_CurrentMenu->_41D08F(1, 0, 0, 0); | |
98 } | |
99 } | |
100 } | |
101 } | |
102 // 506980: using guessed type int dword_506980; | |
103 // 506984: using guessed type int dword_506984; | |
104 // 506988: using guessed type int dword_506988; | |
105 // 50698C: using guessed type int dword_50698C; | |
106 // 507CC0: using guessed type int dword_507CC0; | |
107 | |
108 //----- (00419719) -------------------------------------------------------- | |
109 char __fastcall CharacterUI_SkillsTab_Draw(unsigned int uPlayerID) | |
110 { | |
111 unsigned int v1; // esi@1 | |
112 Player *pPlayer; // ebp@1 | |
113 unsigned int v3; // eax@1 | |
114 signed int v4; // ecx@1 | |
115 int v5; // edi@3 | |
116 GUIWindow *v6; // ecx@3 | |
117 int v7; // eax@4 | |
118 GUIButton *v8; // edx@5 | |
119 int v9; // eax@7 | |
120 unsigned int v10; // ecx@9 | |
121 unsigned __int16 v11; // ax@9 | |
122 int v12; // eax@9 | |
123 unsigned __int8 v13; // cf@12 | |
124 unsigned __int8 v14; // zf@12 | |
125 unsigned int v15; // eax@12 | |
126 char *v16; // ecx@22 | |
127 GUIWindow *v17; // ecx@33 | |
128 int v18; // edx@34 | |
129 GUIButton *v19; // eax@35 | |
130 int v20; // edx@37 | |
131 unsigned __int16 v21; // cx@39 | |
132 unsigned int v22; // eax@39 | |
133 int v23; // edi@39 | |
134 unsigned int v24; // eax@42 | |
135 char v25; // sf@52 | |
136 char *v26; // ecx@52 | |
137 int v27; // edi@63 | |
138 GUIWindow *v28; // ecx@63 | |
139 int v29; // edx@64 | |
140 GUIButton *v30; // eax@65 | |
141 int v31; // edx@67 | |
142 unsigned int v32; // ecx@69 | |
143 int v33; // eax@69 | |
144 unsigned int v34; // eax@72 | |
145 char *v35; // ecx@82 | |
146 GUIWindow *v36; // ecx@93 | |
147 int v37; // edx@94 | |
148 GUIButton *v38; // eax@94 | |
149 int v39; // edx@97 | |
150 unsigned __int16 v40; // cx@99 | |
151 unsigned int v41; // eax@99 | |
152 int v42; // edi@99 | |
153 unsigned int v43; // eax@102 | |
154 char *v44; // ecx@112 | |
155 char *v46; // [sp-Ch] [bp-4Ch]@19 | |
156 char *v47; // [sp-Ch] [bp-4Ch]@49 | |
157 char *v48; // [sp-Ch] [bp-4Ch]@79 | |
158 char *v49; // [sp-Ch] [bp-4Ch]@109 | |
159 unsigned int v50; // [sp-8h] [bp-48h]@19 | |
160 unsigned int v51; // [sp-8h] [bp-48h]@49 | |
161 unsigned int v52; // [sp-8h] [bp-48h]@79 | |
162 unsigned int v53; // [sp-8h] [bp-48h]@109 | |
163 int v54; // [sp-4h] [bp-44h]@19 | |
164 int v55; // [sp-4h] [bp-44h]@49 | |
165 int v56; // [sp-4h] [bp-44h]@79 | |
166 int v57; // [sp-4h] [bp-44h]@109 | |
167 unsigned int v58; // [sp+10h] [bp-30h]@9 | |
168 unsigned int v59; // [sp+10h] [bp-30h]@39 | |
169 unsigned int v60; // [sp+10h] [bp-30h]@69 | |
170 unsigned int v61; // [sp+10h] [bp-30h]@99 | |
171 int v62; // [sp+14h] [bp-2Ch]@4 | |
172 int v63; // [sp+14h] [bp-2Ch]@34 | |
173 int v64; // [sp+14h] [bp-2Ch]@64 | |
174 int v65; // [sp+14h] [bp-2Ch]@94 | |
175 signed int i; // [sp+18h] [bp-28h]@4 | |
176 signed int v67; // [sp+18h] [bp-28h]@34 | |
177 signed int v68; // [sp+18h] [bp-28h]@64 | |
178 signed int v69; // [sp+18h] [bp-28h]@94 | |
179 int v70; // [sp+1Ch] [bp-24h]@3 | |
180 int v71; // [sp+1Ch] [bp-24h]@33 | |
181 int v72; // [sp+1Ch] [bp-24h]@63 | |
182 int v73; // [sp+1Ch] [bp-24h]@93 | |
183 int uY; // [sp+20h] [bp-20h]@9 | |
184 int uYa; // [sp+20h] [bp-20h]@33 | |
185 int uYb; // [sp+20h] [bp-20h]@69 | |
186 int uYc; // [sp+20h] [bp-20h]@93 | |
187 unsigned int a5; // [sp+24h] [bp-1Ch]@1 | |
188 unsigned int v79; // [sp+28h] [bp-18h]@1 | |
189 int *v80; // [sp+2Ch] [bp-14h]@3 | |
190 int *v81; // [sp+2Ch] [bp-14h]@33 | |
191 int *v82; // [sp+2Ch] [bp-14h]@63 | |
192 int *v83; // [sp+2Ch] [bp-14h]@93 | |
193 unsigned int v84; // [sp+30h] [bp-10h]@1 | |
194 int v85; // [sp+34h] [bp-Ch]@1 | |
195 unsigned int v86; // [sp+38h] [bp-8h]@1 | |
196 unsigned __int16 v87; // [sp+3Ch] [bp-4h]@9 | |
197 char *v88; // [sp+3Ch] [bp-4h]@24 | |
198 char *v89; // [sp+3Ch] [bp-4h]@54 | |
199 unsigned __int16 v90; // [sp+3Ch] [bp-4h]@69 | |
200 char *v91; // [sp+3Ch] [bp-4h]@84 | |
201 char *v92; // [sp+3Ch] [bp-4h]@114 | |
202 | |
203 v1 = uPlayerID; | |
204 a5 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); | |
205 v84 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xAFu, 0xFFu); | |
206 v85 = pGUIWindow_CurrentMenu->pCurrentPosActiveItem; | |
207 v86 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0, 0); | |
208 v79 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0); | |
41 | 209 pPlayer = &pParty->pPlayers[v1-1];//(Player *)&stru_AA1058[3].pSounds[6972 * v1 + 40552]; |
0 | 210 v3 = pIcons_LOD->LoadTexture("fr_skill", TEXTURE_16BIT_PALETTE); |
211 pRenderer->DrawTextureIndexed(8u, 8u, (Texture *)(v3 != -1 ? (int)&pIcons_LOD->pTextures[v3] : 0)); | |
212 v4 = v79; | |
213 if ( !pPlayer->uSkillPoints ) | |
214 v4 = 65535; | |
215 sprintf( | |
216 pTmpBuf, | |
41 | 217 "%s \f%05d%s\f00000\r177%s: \f%05d%d\f00000", |
0 | 218 pGlobalTXT_LocalizationStrings[206], // Skills for |
219 a5, | |
220 pPlayer->pName, | |
221 pGlobalTXT_LocalizationStrings[207], // Skill Points | |
222 v4, | |
223 pPlayer->uSkillPoints); | |
224 pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, 18, 0, pTmpBuf, 0, 0, 0); | |
225 v5 = 2 * LOBYTE(pFontLucida->uFontHeight) + 13;// Weapons, Level | |
226 sprintf(pTmpBuf, "%s\r400%s", pGlobalTXT_LocalizationStrings[242], pGlobalTXT_LocalizationStrings[131]); | |
227 pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, v5, a5, pTmpBuf, 0, 0, 0); | |
228 v6 = pGUIWindow_CurrentMenu; | |
229 v70 = 0; | |
69 | 230 v80 = pWeaponSkills; |
0 | 231 do |
232 { | |
233 v62 = *v80; | |
234 v7 = 0; | |
235 for ( i = 0; i < (signed int)v6->uNumControls; v7 = i++ + 1 ) | |
236 { | |
237 v8 = v6->pControlsHead; | |
238 if ( v7 > 0 ) | |
239 { | |
240 do | |
241 { | |
242 v8 = v8->pNext; | |
243 --v7; | |
244 } | |
245 while ( v7 ); | |
246 } | |
247 v9 = v8->field_1C; | |
248 if ( SBYTE1(v9) >= 0 ) | |
249 continue; | |
250 BYTE1(v9) &= 0x7Fu; | |
251 if ( v9 != v62 ) | |
252 continue; | |
253 v5 = v8->uY; | |
254 v10 = pPlayer->uSkillPoints; | |
255 ++v70; | |
256 v11 = pPlayer->pActiveSkills[v62]; | |
257 v87 = pPlayer->pActiveSkills[v62]; | |
258 v12 = v11 & 0x3F; | |
259 v58 = 0; | |
260 uY = v12; | |
261 if ( v10 >= v12 + 1 ) | |
262 v58 = v84; | |
263 if ( v85 == i ) | |
264 { | |
265 v13 = v10 < v12; | |
266 v14 = v10 == v12; | |
267 v15 = v86; | |
268 if ( !(v13 | v14) ) | |
269 v15 = v79; | |
270 v58 = v15; | |
271 } | |
272 else | |
273 { | |
274 v15 = v58; | |
275 } | |
276 if ( HIBYTE(v87) & 1 ) | |
277 { | |
278 if ( !v15 ) | |
279 v15 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); | |
280 v54 = uY; | |
281 v50 = v58; | |
282 v46 = pGlobalTXT_LocalizationStrings[96]; | |
283 } | |
284 else | |
285 { | |
286 if ( !(v87 & 0xC0) ) | |
287 { | |
288 sprintf(pTmpBuf, "%s\r400%2d", pSkillNames[v62], uY); | |
69 | 289 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 24, v5, v58, pTmpBuf, 0, 0, 0); |
290 v6 = pGUIWindow_CurrentMenu; | |
291 continue; | |
0 | 292 } |
293 v16 = pGlobalTXT_LocalizationStrings[432]; | |
294 if ( (v87 & 0x80u) == 0 ) | |
295 v16 = pGlobalTXT_LocalizationStrings[433]; | |
296 v88 = v16; | |
297 if ( !v15 ) | |
298 v15 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); | |
299 v54 = uY; | |
300 v50 = v58; | |
301 v46 = v88; | |
302 } | |
303 sprintf(pTmpBuf, "%s ", pSkillNames[v62], v15, v46, v50, v54); | |
304 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 24, v5, v58, pTmpBuf, 0, 0, 0); | |
305 v6 = pGUIWindow_CurrentMenu; | |
306 } | |
307 ++v80; | |
308 } | |
69 | 309 while ( v80 <= &pWeaponSkills[8]); |
0 | 310 if ( !v70 ) |
311 { | |
312 v5 = v5 + LOBYTE(pFontLucida->uFontHeight) - 3; | |
313 v6->DrawText(pFontLucida, 24, v5, 0, pGlobalTXT_LocalizationStrings[153], 0, 0, 0); | |
314 } | |
315 uYa = v5 + 2 * LOBYTE(pFontLucida->uFontHeight) - 10; | |
316 sprintf(pTmpBuf, "%s\r400%s", pGlobalTXT_LocalizationStrings[138], pGlobalTXT_LocalizationStrings[131]); | |
317 pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, uYa, a5, pTmpBuf, 0, 0, 0); | |
318 v17 = pGUIWindow_CurrentMenu; | |
319 v71 = 0; | |
69 | 320 v81 = pMagicSkills; |
0 | 321 do |
322 { | |
323 v18 = 0; | |
324 v67 = 0; | |
325 v63 = *v81; | |
326 while ( v67 < (signed int)v17->uNumControls ) | |
327 { | |
328 v19 = v17->pControlsHead; | |
329 if ( v18 > 0 ) | |
330 { | |
331 do | |
332 { | |
333 v19 = v19->pNext; | |
334 --v18; | |
335 } | |
336 while ( v18 ); | |
337 } | |
338 v20 = v19->field_1C; | |
339 if ( SBYTE1(v20) >= 0 || (BYTE1(v20) &= 0x7Fu, v20 != v63) ) | |
69 | 340 { |
341 v18 = v67++ + 1; | |
342 continue; | |
343 } | |
0 | 344 ++v71; |
345 uYa = v19->uY; | |
346 v21 = pPlayer->pActiveSkills[v63]; | |
347 v22 = pPlayer->uSkillPoints; | |
348 v23 = pPlayer->pActiveSkills[v63] & 0x3F; | |
349 v59 = 0; | |
350 if ( v22 >= v23 + 1 ) | |
351 v59 = v84; | |
352 if ( v85 == v67 ) | |
353 { | |
354 v13 = v22 < v23; | |
355 v14 = v22 == v23; | |
356 v24 = v86; | |
357 if ( !(v13 | v14) ) | |
358 v24 = v79; | |
359 v59 = v24; | |
360 } | |
361 else | |
362 { | |
363 v24 = v59; | |
364 } | |
365 if ( HIBYTE(v21) & 1 ) | |
366 { | |
367 if ( !v24 ) | |
368 v24 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); | |
369 v55 = v23; | |
370 v51 = v59; | |
371 v47 = pGlobalTXT_LocalizationStrings[96]; | |
372 } | |
373 else | |
374 { | |
375 if ( !(v21 & 0xC0) ) | |
376 { | |
377 sprintf(pTmpBuf, "%s\r400%2d", pSkillNames[v63], v23); | |
69 | 378 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 24, uYa, v59, pTmpBuf, 0, 0, 0); |
379 v17 = pGUIWindow_CurrentMenu; | |
380 v18 = v67++ + 1; | |
381 continue; | |
0 | 382 } |
383 v25 = (v21 & 0x80u) != 0; | |
384 v26 = pGlobalTXT_LocalizationStrings[432]; | |
385 if ( !v25 ) | |
386 v26 = pGlobalTXT_LocalizationStrings[433]; | |
387 v89 = v26; | |
388 if ( !v24 ) | |
389 v24 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); | |
390 v55 = v23; | |
391 v51 = v59; | |
392 v47 = v89; | |
393 } | |
394 sprintf(pTmpBuf, "%s ", pSkillNames[v63], v24, v47, v51, v55); | |
69 | 395 //LABEL_58: |
0 | 396 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 24, uYa, v59, pTmpBuf, 0, 0, 0); |
397 v17 = pGUIWindow_CurrentMenu; | |
69 | 398 //LABEL_59: |
0 | 399 v18 = v67++ + 1; |
400 } | |
401 ++v81; | |
402 } | |
69 | 403 while ( v81 <= &pMagicSkills[8]); |
0 | 404 if ( !v71 ) |
405 v17->DrawText( | |
406 pFontLucida, | |
407 24, | |
408 LOBYTE(pFontLucida->uFontHeight) + uYa - 3, | |
409 0, | |
410 pGlobalTXT_LocalizationStrings[153], | |
411 0, | |
412 0, | |
413 0); | |
414 v27 = 2 * LOBYTE(pFontLucida->uFontHeight) + 13; | |
415 sprintf(pTmpBuf, "%s\r177%s", pGlobalTXT_LocalizationStrings[11], pGlobalTXT_LocalizationStrings[131]); | |
416 pGUIWindow_CurrentMenu->DrawText(pFontArrus, 248, v27, a5, pTmpBuf, 0, 0, 0); | |
417 v28 = pGUIWindow_CurrentMenu; | |
418 v72 = 0; | |
41 | 419 v82 = pArmorSkills; |
0 | 420 do |
421 { | |
422 v29 = 0; | |
423 v68 = 0; | |
424 v64 = *v82; | |
425 while ( v68 < (signed int)v28->uNumControls ) | |
426 { | |
427 v30 = v28->pControlsHead; | |
428 if ( v29 > 0 ) | |
429 { | |
430 do | |
431 { | |
432 v30 = v30->pNext; | |
433 --v29; | |
434 } | |
435 while ( v29 ); | |
436 } | |
437 v31 = v30->field_1C; | |
438 if ( SBYTE1(v31) >= 0 || (BYTE1(v31) &= 0x7Fu, v31 != v64) ) | |
69 | 439 { |
440 v29 = v68++ + 1; | |
441 continue; | |
442 } | |
0 | 443 v27 = v30->uY; |
444 ++v72; | |
445 v60 = 0; | |
446 v90 = pPlayer->pActiveSkills[v64]; | |
447 v32 = pPlayer->uSkillPoints; | |
448 v33 = pPlayer->pActiveSkills[v64] & 0x3F; | |
449 uYb = v33; | |
450 if ( v32 >= v33 + 1 ) | |
451 v60 = v84; | |
452 if ( v85 == v68 ) | |
453 { | |
454 v13 = v32 < v33; | |
455 v14 = v32 == v33; | |
456 v34 = v86; | |
457 if ( !(v13 | v14) ) | |
458 v34 = v79; | |
459 v60 = v34; | |
460 } | |
461 else | |
462 { | |
463 v34 = v60; | |
464 } | |
465 if ( (pPlayer->pActiveSkills[v64] >> 8) & 1 ) | |
466 { | |
467 if ( !v34 ) | |
468 v34 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); | |
469 v56 = uYb; | |
470 v52 = v60; | |
471 v48 = pGlobalTXT_LocalizationStrings[96]; | |
472 } | |
473 else | |
474 { | |
475 if ( !(v90 & 0xC0) ) | |
476 { | |
477 sprintf(pTmpBuf, "%s\r177%2d", pSkillNames[v64], uYb); | |
69 | 478 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 248, v27, v60, pTmpBuf, 0, 0, 0); |
479 v28 = pGUIWindow_CurrentMenu; | |
480 v29 = v68++ + 1; | |
481 continue; | |
0 | 482 } |
483 v35 = pGlobalTXT_LocalizationStrings[432]; | |
484 if ( (v90 & 0x80u) == 0 ) | |
485 v35 = pGlobalTXT_LocalizationStrings[433]; | |
486 v91 = v35; | |
487 if ( !v34 ) | |
488 v34 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); | |
489 v56 = uYb; | |
490 v52 = v60; | |
491 v48 = v91; | |
492 } | |
493 sprintf(pTmpBuf, "%s ", pSkillNames[v64], v34, v48, v52, v56); | |
69 | 494 //LABEL_88: |
0 | 495 pGUIWindow_CurrentMenu->DrawText(pFontLucida, 248, v27, v60, pTmpBuf, 0, 0, 0); |
496 v28 = pGUIWindow_CurrentMenu; | |
69 | 497 //LABEL_89: |
0 | 498 v29 = v68++ + 1; |
499 } | |
500 ++v82; | |
501 } | |
69 | 502 while ( v82 <= &pArmorSkills[4]); |
0 | 503 if ( !v72 ) |
504 { | |
505 v27 = v27 + LOBYTE(pFontLucida->uFontHeight) - 3; | |
506 v28->DrawText(pFontLucida, 248, v27, 0, pGlobalTXT_LocalizationStrings[153], 0, 0, 0); | |
507 } | |
508 uYc = v27 + 2 * LOBYTE(pFontLucida->uFontHeight) - 10; | |
509 sprintf(pTmpBuf, "%s\r177%s", pGlobalTXT_LocalizationStrings[143], pGlobalTXT_LocalizationStrings[131]); | |
510 pGUIWindow_CurrentMenu->DrawText(pFontArrus, 248, uYc, a5, pTmpBuf, 0, 0, 0); | |
511 v36 = pGUIWindow_CurrentMenu; | |
512 v73 = 0; | |
69 | 513 v83 = pMiscSkills; |
0 | 514 do |
515 { | |
516 v37 = 0; | |
517 v69 = 0; | |
518 v38 = (GUIButton *)*v83; | |
519 v65 = *v83; | |
520 while ( v69 < (signed int)v36->uNumControls ) | |
521 { | |
522 v38 = v36->pControlsHead; | |
523 if ( v37 > 0 ) | |
524 { | |
525 do | |
526 { | |
527 v38 = v38->pNext; | |
528 --v37; | |
529 } | |
530 while ( v37 ); | |
531 } | |
532 v39 = v38->field_1C; | |
533 if ( SBYTE1(v39) >= 0 || (BYTE1(v39) &= 0x7Fu, v39 != v65) ) | |
69 | 534 { |
535 //goto LABEL_119; | |
536 v37 = v69++ + 1; | |
537 continue; | |
538 } | |
0 | 539 ++v73; |
540 uYc = v38->uY; | |
541 v40 = pPlayer->pActiveSkills[v65]; | |
542 v41 = pPlayer->uSkillPoints; | |
543 v42 = pPlayer->pActiveSkills[v65] & 0x3F; | |
544 v61 = 0; | |
545 if ( v41 >= v42 + 1 ) | |
546 v61 = v84; | |
547 if ( v85 == v69 ) | |
548 { | |
549 v13 = v41 < v42; | |
550 v14 = v41 == v42; | |
551 v43 = v86; | |
552 if ( !(v13 | v14) ) | |
553 v43 = v79; | |
554 v61 = v43; | |
555 } | |
556 else | |
557 { | |
558 v43 = v61; | |
559 } | |
560 if ( HIBYTE(v40) & 1 ) | |
561 { | |
562 if ( !v43 ) | |
563 v43 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); | |
564 v57 = v42; | |
565 v53 = v61; | |
566 v49 = pGlobalTXT_LocalizationStrings[96]; | |
567 } | |
568 else | |
569 { | |
570 if ( !(v40 & 0xC0) ) | |
571 { | |
572 sprintf(pTmpBuf, "%s\r177%2d", pSkillNames[v65], v42); | |
69 | 573 LOBYTE(v38) = pGUIWindow_CurrentMenu->DrawText(pFontLucida, 248, uYc, v61, pTmpBuf, 0, 0, 0); |
574 v36 = pGUIWindow_CurrentMenu; | |
575 v37 = v69++ + 1; | |
576 continue; | |
0 | 577 } |
578 v25 = (v40 & 0x80u) != 0; | |
579 v44 = pGlobalTXT_LocalizationStrings[432]; | |
580 if ( !v25 ) | |
581 v44 = pGlobalTXT_LocalizationStrings[433]; | |
582 v92 = v44; | |
583 if ( !v43 ) | |
584 v43 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); | |
585 v57 = v42; | |
586 v53 = v61; | |
587 v49 = v92; | |
588 } | |
589 sprintf(pTmpBuf, "%s ", pSkillNames[v65], v43, v49, v53, v57); | |
590 LOBYTE(v38) = pGUIWindow_CurrentMenu->DrawText(pFontLucida, 248, uYc, v61, pTmpBuf, 0, 0, 0); | |
591 v36 = pGUIWindow_CurrentMenu; | |
592 v37 = v69++ + 1; | |
593 } | |
594 ++v83; | |
595 } | |
69 | 596 while ( v83 <= &pMiscSkills[11]); |
0 | 597 if ( !v73 ) |
598 LOBYTE(v38) = v36->DrawText( | |
599 pFontLucida, | |
600 248, | |
601 LOBYTE(pFontLucida->uFontHeight) + uYc - 3, | |
602 0, | |
603 pGlobalTXT_LocalizationStrings[153], | |
604 0, | |
605 0, | |
606 0); | |
607 return (char)v38; | |
608 } | |
609 | |
610 //----- (0041A000) -------------------------------------------------------- | |
611 unsigned int __fastcall CharacterUI_AwardsTab_Draw(unsigned int uPlayerID) | |
612 { | |
613 unsigned int v1; // esi@1 | |
614 unsigned int v2; // ebx@1 | |
615 unsigned int v3; // eax@1 | |
616 unsigned int result; // eax@1 | |
617 int v5; // eax@15 | |
618 char *v6; // ebx@15 | |
619 int v7; // eax@23 | |
620 int v8; // eax@24 | |
621 int v9; // eax@25 | |
622 int v10; // eax@27 | |
623 int v11; // eax@32 | |
624 int v12; // eax@33 | |
625 int v13; // eax@34 | |
626 signed int v14; // eax@43 | |
627 unsigned int v15; // eax@43 | |
628 int v16; // eax@43 | |
629 int v17; // [sp-4h] [bp-D4h]@16 | |
630 char Source[100]; // [sp+Ch] [bp-C4h]@1 | |
631 GUIWindow a1; // [sp+70h] [bp-60h]@1 | |
632 unsigned int v20; // [sp+C4h] [bp-Ch]@15 | |
633 int v21; // [sp+C8h] [bp-8h]@14 | |
634 int v22; // [sp+CCh] [bp-4h]@40 | |
635 | |
636 v1 = uPlayerID; | |
637 v2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); | |
638 v3 = pIcons_LOD->LoadTexture("fr_award", TEXTURE_16BIT_PALETTE); | |
639 pRenderer->DrawTextureIndexed(8u, 8u, (Texture *)(v3 != -1 ? (int)&pIcons_LOD->pTextures[v3] : 0)); | |
70 | 640 sprintf(pTmpBuf, "%s \f%05d", pGlobalTXT_LocalizationStrings[23], v2);// TODO check args |
0 | 641 sprintf( |
642 Source, | |
643 pGlobalTXT_LocalizationStrings[429], | |
42 | 644 &pParty->pPlayers[v1-1].pName,//&stru_AA1058[3].pSounds[6972 * v1 + 40720], |
70 | 645 pClassNames[pParty->pPlayers[v1-1].uClass]);//&pClassNames[stru_AA1058[3].pSounds[6972 * v1 + 40737]]); |
0 | 646 strcat(pTmpBuf, Source); |
647 strcat(pTmpBuf, "\xC" "00000"); | |
648 pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, 18, 0, pTmpBuf, 0, 0, 0); | |
649 result = dword_506528; | |
650 a1.uFrameX = 12; | |
651 a1.uFrameY = 48; | |
652 a1.uFrameWidth = 424; | |
653 a1.uFrameHeight = 290; | |
654 a1.uFrameZ = 435; | |
655 a1.uFrameW = 337; | |
656 if ( dword_506544 && dword_506520 + dword_506528 < dword_506524 ) | |
657 result = dword_506528++ + 1; | |
658 if ( dword_506548 && result ) | |
659 { | |
660 --result; | |
661 dword_506528 = result; | |
662 } | |
663 if ( dword_50651C < 0 ) | |
664 { | |
665 result += dword_506520; | |
666 dword_506528 = result; | |
667 if ( (signed int)(dword_506520 + result) <= dword_506524 ) | |
668 goto LABEL_14; | |
669 result = dword_506524 - dword_506520; | |
670 goto LABEL_13; | |
671 } | |
672 if ( dword_50651C > 0 ) | |
673 { | |
674 result -= dword_506520; | |
675 dword_506528 = result; | |
676 if ( (result & 0x80000000u) != 0 ) | |
677 { | |
678 result = 0; | |
679 LABEL_13: | |
680 dword_506528 = result; | |
681 goto LABEL_14; | |
682 } | |
683 } | |
684 LABEL_14: | |
685 dword_506544 = 0; | |
686 dword_506548 = 0; | |
687 dword_506520 = 0; | |
688 dword_50651C = 0; | |
689 v21 = result; | |
690 if ( (signed int)result < dword_506524 ) | |
691 { | |
692 while ( 1 ) | |
693 { | |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
70
diff
changeset
|
694 v5 = pStru179.field_0[v21]; |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
70
diff
changeset
|
695 v20 = 8 * pStru179.field_0[v21]; |
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
70
diff
changeset
|
696 v6 = (char *)pAwards[v20/8-1].pText;//(char *)dword_723E80_award_related[v20 / 4]; |
0 | 697 if ( v5 != 1 ) |
698 break; | |
699 v17 = pParty->uFine; | |
700 LABEL_42: | |
701 sprintf(pTmpBuf, v6, v17); | |
702 v6 = pTmpBuf; | |
703 LABEL_43: | |
81
377535d6e366
structure boundaries fixed in many places. fixed quests, notes, awards, calendar.
zipi
parents:
70
diff
changeset
|
704 v14 = pAwards[v20/8-1].uSort;//dword_723E84[v20 / 4]; |
0 | 705 ++dword_506520; |
706 v15 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat( | |
707 pAwardsTextColors[3 * v14 % 6], | |
708 pAwardsTextColors[3 * v14 % 6 + 1], | |
709 pAwardsTextColors[3 * v14 % 6 + 2]); | |
710 a1.DrawText(pFontArrus, 0, 0, v15, v6, 0, 0, 0); | |
711 v16 = pFontArrus->CalcTextHeight(v6, &a1, 0, 0); | |
712 result = v16 + a1.uFrameY + 4; | |
713 if ( (signed int)result <= (signed int)a1.uFrameHeight ) | |
714 { | |
715 ++v21; | |
716 a1.uFrameY = result; | |
717 result = v21; | |
718 if ( v21 < dword_506524 ) | |
719 continue; | |
720 } | |
721 return result; | |
722 } | |
723 if ( (v5 < 85 || v5 > 91) && (v5 < 103 || v5 > 104) ) | |
724 goto LABEL_43; | |
725 if ( v5 > 89 ) | |
726 { | |
727 v11 = v5 - 90; | |
728 if ( !v11 ) | |
729 { | |
730 v10 = (unsigned __int8)pParty->uNumArenaKnightWins; | |
731 goto LABEL_40; | |
732 } | |
733 v12 = v11 - 1; | |
734 if ( !v12 ) | |
735 { | |
736 v10 = (unsigned __int8)pParty->uNumArenaLordWins; | |
737 goto LABEL_40; | |
738 } | |
739 v13 = v12 - 12; | |
740 if ( !v13 ) | |
741 { | |
742 v10 = pParty->field_874; | |
743 goto LABEL_40; | |
744 } | |
745 if ( v13 == 1 ) | |
746 { | |
747 v10 = pParty->field_878; | |
748 goto LABEL_40; | |
749 } | |
750 } | |
751 else | |
752 { | |
753 if ( v5 == 89 ) | |
754 { | |
755 v10 = (unsigned __int8)pParty->uNumArenaSquireWins; | |
756 goto LABEL_40; | |
757 } | |
758 v7 = v5 - 85; | |
759 if ( !v7 ) | |
760 { | |
761 v10 = pParty->uNumDeaths; | |
762 goto LABEL_40; | |
763 } | |
764 v8 = v7 - 1; | |
765 if ( !v8 ) | |
766 { | |
767 v10 = pParty->uNumBountiesCollected; | |
768 goto LABEL_40; | |
769 } | |
770 v9 = v8 - 1; | |
771 if ( !v9 ) | |
772 { | |
773 v10 = pParty->uNumPrisonTerms; | |
774 goto LABEL_40; | |
775 } | |
776 if ( v9 == 1 ) | |
777 { | |
778 v10 = (unsigned __int8)pParty->uNumArenaPageWins; | |
779 LABEL_40: | |
780 v22 = v10; | |
781 goto LABEL_41; | |
782 } | |
783 } | |
784 LABEL_41: | |
785 v17 = v22; | |
786 goto LABEL_42; | |
787 } | |
788 return result; | |
789 } | |
790 // 50651C: using guessed type int dword_50651C; | |
791 // 506520: using guessed type int dword_506520; | |
792 // 506524: using guessed type int dword_506524; | |
793 // 506528: using guessed type int dword_506528; | |
794 // 506544: using guessed type int dword_506544; | |
795 // 506548: using guessed type int dword_506548; | |
796 // 723E80: using guessed type int dword_723E80_award_related[]; | |
797 // 723E84: using guessed type int dword_723E84[]; | |
798 | |
799 //----- (0041A2C1) -------------------------------------------------------- | |
800 unsigned int __fastcall GetSizeInInventorySlots(unsigned int uNumPixels) | |
801 { | |
802 if ( (signed int)uNumPixels < 14 ) | |
803 uNumPixels = 14; | |
804 return ((signed int)(uNumPixels - 14) >> 5) + 1; | |
805 } | |
806 | |
807 //----- (0041A2D1) -------------------------------------------------------- | |
808 void __fastcall CharacterUI_InventoryTab_Draw(unsigned int uPlayerID, char a2) | |
809 { | |
22 | 810 Player *pPlayer; // esi@1 |
0 | 811 char v3; // bl@1 |
812 unsigned int v4; // eax@2 | |
22 | 813 ItemGen *pItem; // ebx@5 |
0 | 814 unsigned int v6; // eax@6 |
815 Texture *v7; // esi@6 | |
816 __int16 v8; // ax@6 | |
817 signed int v9; // edi@6 | |
818 signed int v10; // ecx@6 | |
819 signed int v11; // edx@6 | |
820 signed int v12; // eax@11 | |
821 int v13; // eax@13 | |
822 signed int v14; // edx@13 | |
823 int v15; // eax@13 | |
824 unsigned int v16; // ebx@15 | |
825 unsigned int v17; // edi@15 | |
22 | 826 Texture *pTexture; // ebx@24 |
0 | 827 double v19; // st7@26 |
828 const char *v20; // [sp-8h] [bp-40h]@20 | |
22 | 829 Player *pPlayer2; // [sp+14h] [bp-24h]@1 |
0 | 830 int uTextureId; // [sp+18h] [bp-20h]@6 |
831 int *v23; // [sp+1Ch] [bp-1Ch]@1 | |
832 int v24; // [sp+20h] [bp-18h]@5 | |
22 | 833 ItemGen *pItem2; // [sp+24h] [bp-14h]@5 |
0 | 834 int v26; // [sp+28h] [bp-10h]@3 |
68 | 835 unsigned int uCellID; // [sp+2Ch] [bp-Ch]@3 |
836 unsigned int uCellX; // [sp+30h] [bp-8h]@5 | |
837 unsigned int uCellY; // [sp+34h] [bp-4h]@5 | |
0 | 838 |
839 v23 = pRenderer->pActiveZBuffer; | |
22 | 840 pPlayer = pPlayers[uPlayerID]; |
0 | 841 v3 = a2; |
22 | 842 pPlayer2 = pPlayers[uPlayerID]; |
843 pRenderer->DrawTextureIndexed(8, 8, (Texture *)(uTextureID_507958 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_507958] : 0)); | |
0 | 844 if ( v3 ) |
845 { | |
846 v4 = pIcons_LOD->LoadTexture("fr_strip", TEXTURE_16BIT_PALETTE); | |
847 pRenderer->DrawTextureIndexed(8u, 0x131u, (Texture *)(v4 != -1 ? (int)&pIcons_LOD->pTextures[v4] : 0)); | |
848 } | |
68 | 849 uCellID = 0; |
22 | 850 v26 = (int)pPlayer->pInventoryIndices; |
0 | 851 do |
852 { | |
853 if ( *(int *)v26 > 0 ) | |
854 { | |
855 v24 = *(int *)v26 - 1; | |
68 | 856 uCellY = 32 * (uCellID / 14) + 17; |
22 | 857 pItem = &pPlayer->pInventoryItems[v24]; |
68 | 858 uCellX = 32 * (uCellID % 14) + 14; |
22 | 859 pItem2 = pItem; |
860 if ( pItem->uItemID ) | |
861 { | |
862 v6 = pIcons_LOD->LoadTexture(pItemsTable->pItems[pItem->uItemID].pIconName, TEXTURE_16BIT_PALETTE); | |
0 | 863 uTextureId = v6; |
864 v7 = (Texture *)(v6 != -1 ? (int)&pIcons_LOD->pTextures[v6] : 0); | |
865 v8 = (v6 != -1 ? pIcons_LOD->pTextures[v6].uTextureWidth : 24); | |
866 v9 = v7->uTextureHeight; | |
867 v10 = v7->uTextureWidth; | |
868 v11 = v7->uTextureWidth; | |
869 if ( v10 < 14 ) | |
870 v11 = 14; | |
871 if ( (v11 - 14) >> 5 == 0 && v8 < 32 ) | |
68 | 872 uCellX += (32 - v10) / 2; |
0 | 873 v12 = v7->uTextureWidth; |
874 if ( v10 < 14 ) | |
875 v12 = 14; | |
876 v13 = v12 - 14; | |
877 v14 = v7->uTextureHeight; | |
878 LOBYTE(v13) = v13 & 0xE0; | |
879 v15 = v13 + 32; | |
880 if ( v9 < 14 ) | |
881 v14 = 14; | |
22 | 882 v16 = pItem->uAttributes; |
68 | 883 v17 = uCellX + ((v15 - v10) >> 1) + pSRZBufferLineOffsets[uCellY + ((((v14 - 14) & 0xFFFFFFE0) - v9 + 32) >> 1)]; |
0 | 884 if ( !(v16 & 0xF0) ) |
885 { | |
886 if ( v16 & 1 | |
887 || pCurrentScreen != 13 ) | |
888 { | |
889 if ( v16 & 2 ) | |
68 | 890 pRenderer->_4A6776(uCellX, uCellY, v7); |
0 | 891 else |
68 | 892 pRenderer->DrawTextureTransparent(uCellX, uCellY, v7); |
0 | 893 } |
894 else | |
895 { | |
68 | 896 pRenderer->DrawTransparentGreenShade(uCellX, uCellY, v7); |
0 | 897 } |
22 | 898 ZBuffer_Fill(&v23[v17], uTextureId, v24 + 1); |
899 pPlayer = pPlayer2; | |
900 //goto LABEL_34; | |
68 | 901 ++uCellID; |
22 | 902 v26 += 4; |
68 | 903 continue; |
0 | 904 } |
905 if ( (unsigned __int8)(v16 & 0xF0) != 16 ) | |
906 { | |
907 if ( (unsigned __int8)(v16 & 0xF0) == 32 ) | |
908 { | |
909 v20 = "sp28a"; | |
22 | 910 pTexture = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v20, TEXTURE_16BIT_PALETTE)]; |
911 dword_50C9A8 -= pEventTimer->uTimeElapsed; | |
912 if ( dword_50C9A8 <= 0 ) | |
913 { | |
914 dword_50C9A8 = 0; | |
915 LOBYTE(pItem2->uAttributes) &= 0xFu; | |
916 ptr_50C9A4 = 0; | |
917 } | |
918 v19 = (double)GetTickCount() * 0.1; | |
68 | 919 pRenderer->_4A63E6(uCellX, uCellY, v7, pTexture, (signed __int64)v19, 0, 255); |
22 | 920 ZBuffer_Fill(&v23[v17], uTextureId, v24 + 1); |
921 pPlayer = pPlayer2; | |
922 //goto LABEL_34; | |
68 | 923 ++uCellID; |
22 | 924 v26 += 4; |
68 | 925 continue; |
0 | 926 } |
927 if ( (unsigned __int8)(v16 & 0xF0) == 64 ) | |
928 { | |
929 v20 = "sp30a"; | |
22 | 930 pTexture = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v20, TEXTURE_16BIT_PALETTE)]; |
0 | 931 dword_50C9A8 -= pEventTimer->uTimeElapsed; |
932 if ( dword_50C9A8 <= 0 ) | |
933 { | |
934 dword_50C9A8 = 0; | |
22 | 935 LOBYTE(pItem2->uAttributes) &= 0xFu; |
936 ptr_50C9A4 = 0; | |
937 } | |
938 v19 = (double)GetTickCount() * 0.1; | |
68 | 939 pRenderer->_4A63E6(uCellX, uCellY, v7, pTexture, (signed __int64)v19, 0, 255); |
22 | 940 ZBuffer_Fill(&v23[v17], uTextureId, v24 + 1); |
941 pPlayer = pPlayer2; | |
942 //goto LABEL_34; | |
68 | 943 ++uCellID; |
22 | 944 v26 += 4; |
68 | 945 continue; |
22 | 946 } |
947 if ( (unsigned __int8)(v16 & 0xF0) == 128 ) | |
948 { | |
949 v20 = "sp91a"; | |
950 pTexture = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v20, TEXTURE_16BIT_PALETTE)]; | |
951 dword_50C9A8 -= pEventTimer->uTimeElapsed; | |
952 if ( dword_50C9A8 <= 0 ) | |
953 { | |
954 dword_50C9A8 = 0; | |
955 LOBYTE(pItem2->uAttributes) &= 0xFu; | |
0 | 956 ptr_50C9A4 = 0; |
957 } | |
958 v19 = (double)GetTickCount() * 0.1; | |
68 | 959 pRenderer->_4A63E6(uCellX, uCellY, v7, pTexture, (signed __int64)v19, 0, 255); |
0 | 960 ZBuffer_Fill(&v23[v17], uTextureId, v24 + 1); |
22 | 961 pPlayer = pPlayer2; |
962 //goto LABEL_34; | |
68 | 963 ++uCellID; |
22 | 964 v26 += 4; |
68 | 965 continue; |
0 | 966 } |
967 } | |
968 v20 = "sptext01"; | |
22 | 969 pTexture = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v20, TEXTURE_16BIT_PALETTE)]; |
970 dword_50C9A8 -= pEventTimer->uTimeElapsed; | |
971 if ( dword_50C9A8 <= 0 ) | |
972 { | |
973 dword_50C9A8 = 0; | |
974 LOBYTE(pItem2->uAttributes) &= 0xFu; | |
975 ptr_50C9A4 = 0; | |
976 } | |
977 v19 = (double)GetTickCount() * 0.1; | |
68 | 978 pRenderer->_4A63E6(uCellX, uCellY, v7, pTexture, (signed __int64)v19, 0, 255); |
22 | 979 ZBuffer_Fill(&v23[v17], uTextureId, v24 + 1); |
980 pPlayer = pPlayer2; | |
981 } | |
982 } | |
983 //LABEL_34: | |
68 | 984 ++uCellID; |
0 | 985 v26 += 4; |
986 } | |
68 | 987 while ( uCellID < 126 ); |
0 | 988 } |
989 // 4E28F8: using guessed type int pCurrentScreen; | |
990 // 507958: using guessed type int uTextureID_507958; | |
991 // 50C9A8: using guessed type int dword_50C9A8; | |
992 | |
993 //----- (0041A556) -------------------------------------------------------- | |
994 void __cdecl draw_leather() | |
995 { | |
996 pRenderer->DrawTextureIndexed( | |
997 8u, | |
998 8u, | |
999 (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0)); | |
1000 } | |
1001 | |
1002 //----- (0041A57E) -------------------------------------------------------- | |
1003 char __cdecl QuickRefDraw() | |
1004 { | |
1005 unsigned int v0; // ebx@1 | |
1006 unsigned int v1; // eax@1 | |
1007 Player *pPlayer; // ebp@2 | |
1008 int v3; // eax@6 | |
1009 int v4; // edi@6 | |
1010 unsigned int v5; // eax@7 | |
1011 unsigned int v6; // edi@9 | |
1012 unsigned int v7; // edi@11 | |
1013 signed int v8; // eax@13 | |
1014 unsigned int v9; // eax@13 | |
1015 unsigned int v10; // edi@13 | |
1016 int v11; // eax@15 | |
1017 unsigned int v12; // eax@15 | |
1018 unsigned int v13; // edi@15 | |
1019 int v14; // eax@17 | |
1020 int v15; // ST18_4@17 | |
1021 int v16; // ebx@17 | |
1022 int v17; // eax@17 | |
1023 unsigned int v18; // eax@17 | |
1024 unsigned int v19; // edi@17 | |
1025 int v20; // eax@19 | |
1026 unsigned int v21; // edi@19 | |
1027 char *v22; // eax@21 | |
1028 unsigned int v23; // edi@21 | |
1029 int v24; // eax@23 | |
1030 unsigned int v25; // edi@23 | |
1031 char *v26; // eax@25 | |
1032 unsigned int v27; // edi@25 | |
1033 int v28; // ecx@27 | |
1034 char *v29; // eax@27 | |
1035 signed int v30; // edx@27 | |
1036 unsigned int v31; // edi@31 | |
1037 unsigned int v32; // edi@33 | |
1038 const char *v33; // ST10_4@35 | |
1039 unsigned int v34; // eax@35 | |
1040 unsigned int v35; // edi@35 | |
1041 unsigned __int8 v36; // al@37 | |
1042 char *v37; // eax@38 | |
1043 int v38; // eax@41 | |
1044 signed int v39; // edi@42 | |
1045 char *v40; // eax@45 | |
1046 unsigned int v41; // eax@45 | |
1047 signed int v43; // [sp+10h] [bp-1Ch]@1 | |
1048 unsigned int v44; // [sp+14h] [bp-18h]@2 | |
1049 int v45; // [sp+18h] [bp-14h]@1 | |
1050 unsigned int v46; // [sp+1Ch] [bp-10h]@1 | |
1051 unsigned int v47; // [sp+20h] [bp-Ch]@1 | |
1052 unsigned int v48; // [sp+24h] [bp-8h]@33 | |
1053 unsigned int v49; // [sp+28h] [bp-4h]@1 | |
1054 | |
1055 v0 = 0; | |
1056 v47 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); | |
1057 v49 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0, 0); | |
1058 v46 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0); | |
1059 v1 = pIcons_LOD->LoadTexture("quikref", TEXTURE_16BIT_PALETTE); | |
1060 pRenderer->DrawTextureIndexed(8u, 8u, (Texture *)(v1 != -1 ? (int)&pIcons_LOD->pTextures[v1] : 0)); | |
1061 v43 = 0; | |
1062 v45 = LOBYTE(pFontArrus->uFontHeight) + 1; | |
1063 do | |
1064 { | |
1065 pPlayer = &pParty->pPlayers[v43]; | |
1066 v44 = 94 * v43 + 89; | |
1067 if ( v43 == v0 ) | |
24 | 1068 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, 0x12u, v0, pGlobalTXT_LocalizationStrings[149], 60, v0);//Name |
0 | 1069 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 94 * v43 + 89, 0x12u, v47, pPlayer->pName, 84, v0); |
1070 if ( v43 == v0 ) | |
24 | 1071 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, 0x2Fu, v0, pGlobalTXT_LocalizationStrings[131], 60, v0); //Óðîâ. |
0 | 1072 v3 = pPlayer->GetActualLevel(); |
1073 sprintf(pTmpBuf, "%lu", v3); | |
1074 v4 = pPlayer->GetBaseLevel(); | |
1075 if ( pPlayer->GetActualLevel() <= v4 ) | |
1076 v5 = pPlayer->GetExperienceDisplayColor(); | |
1077 else | |
1078 v5 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, v0); | |
1079 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, 0x2Fu, v5, pTmpBuf, 84, v0); | |
1080 v6 = v45 + 47; | |
1081 if ( v43 == v0 ) | |
24 | 1082 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v45 + 47, v0, pGlobalTXT_LocalizationStrings[41], 60, v0);//Êëàññ |
0 | 1083 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v6, v0, pClassNames[pPlayer->uClass], 84, v0); |
1084 v7 = v45 + v6; | |
1085 if ( v43 == v0 ) | |
24 | 1086 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v7, v0, pGlobalTXT_LocalizationStrings[107], 60, v0);//Çäîð. |
0 | 1087 sprintf(pTmpBuf, "%d", pPlayer->sHealth); |
1088 v8 = pPlayer->GetMaxHealth(); | |
1089 v9 = UI_GetHealthManaStringColor(pPlayer->sHealth, v8); | |
1090 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v7, v9, pTmpBuf, 84, v0); | |
1091 v10 = v45 + v7; | |
1092 if ( v43 == v0 ) | |
24 | 1093 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v10, v0, pGlobalTXT_LocalizationStrings[209], 60, v0);//Ìàíà |
0 | 1094 sprintf(pTmpBuf, "%d", pPlayer->sMana); |
1095 v11 = pPlayer->GetMaxMana(); | |
1096 v12 = UI_GetHealthManaStringColor(pPlayer->sMana, v11); | |
1097 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v10, v12, pTmpBuf, 84, v0); | |
1098 v13 = v45 + v10; | |
1099 if ( v43 == v0 ) | |
24 | 1100 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v13, v0, pGlobalTXT_LocalizationStrings[0], 60, v0);//Êëàññ áðîíè |
0 | 1101 v14 = pPlayer->GetActualAC(); |
1102 sprintf(pTmpBuf, "%d", v14); | |
1103 v15 = v0; | |
1104 v16 = pPlayer->GetBaseAC(); | |
1105 v17 = pPlayer->GetActualAC(); | |
1106 v18 = UI_GetHealthManaStringColor(v17, v16); | |
1107 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v13, v18, pTmpBuf, 84, v15); | |
1108 v0 = 0; | |
1109 v19 = v45 + v13; | |
1110 if ( !v43 ) | |
24 | 1111 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v19, 0, pGlobalTXT_LocalizationStrings[18], 60, 0);//Àòàêà |
0 | 1112 v20 = pPlayer->GetActualAttack(0); |
1113 sprintf(pTmpBuf, "%+d", v20); | |
1114 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v19, 0, pTmpBuf, 84, 0); | |
1115 v21 = v45 + v19; | |
1116 if ( !v43 ) | |
24 | 1117 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v21, 0, pGlobalTXT_LocalizationStrings[66], 60, 0);//Ïîâð. |
0 | 1118 v22 = pPlayer->GetMeleeDamageString(); |
1119 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v21, 0, v22, 84, 0); | |
1120 v23 = v45 + v21; | |
1121 if ( !v43 ) | |
24 | 1122 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v23, 0, pGlobalTXT_LocalizationStrings[203], 60, 0);// Ñòðåëÿòü |
0 | 1123 v24 = pPlayer->GetRangedAttack(); |
1124 sprintf(pTmpBuf, "%+d", v24); | |
1125 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v23, 0, pTmpBuf, 84, 0); | |
1126 v25 = v45 + v23; | |
1127 if ( !v43 ) | |
24 | 1128 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v25, 0, pGlobalTXT_LocalizationStrings[66], 60, 0);//Ïîâð. |
0 | 1129 v26 = pPlayer->GetRangedDamageString(); |
1130 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v25, 0, v26, 84, 0); | |
1131 v27 = v45 + v25; | |
1132 if ( !v43 ) | |
24 | 1133 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v27, 0, pGlobalTXT_LocalizationStrings[205], 60, 0);//Íàâûêè |
0 | 1134 v28 = 0; |
1135 v29 = (char *)pPlayer->pActiveSkills; | |
1136 v30 = 36; | |
1137 do | |
1138 { | |
1139 if ( *(short *)v29 ) | |
1140 ++v28; | |
1141 v29 += 2; | |
1142 --v30; | |
1143 } | |
1144 while ( v30 ); | |
1145 sprintf(pTmpBuf, "%lu", v28); | |
1146 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v27, 0, pTmpBuf, 84, 0); | |
1147 v31 = v45 + v27; | |
1148 if ( !v43 ) | |
24 | 1149 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v31, 0, pGlobalTXT_LocalizationStrings[168], 60, 0);//Î÷êè |
0 | 1150 sprintf(pTmpBuf, "%lu", pPlayer->uSkillPoints); |
24 | 1151 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v31, pPlayer->uSkillPoints != 0 ? v46 : 0, pTmpBuf, 84, 0); |
0 | 1152 v32 = v45 + v31; |
1153 v48 = pPlayer->GetMajorConditionIdx(); | |
1154 if ( !v43 ) | |
24 | 1155 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v32, 0, pGlobalTXT_LocalizationStrings[45], 60, 0);//Ñîñò. |
0 | 1156 v33 = aCharacterConditionNames[v48]; |
1157 v34 = GetConditionDrawColor(v48); | |
1158 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v32, v34, v33, 84, 0); | |
1159 v35 = v45 + v32; | |
1160 if ( !v43 ) | |
24 | 1161 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v35, 0, pGlobalTXT_LocalizationStrings[170], 60, 0);//Á.Ïðèì. |
0 | 1162 v36 = pPlayer->uQuickSpell; |
1163 if ( v36 ) | |
1164 v37 = pSpellStats->pInfos[v36].pShortName; | |
1165 else | |
24 | 1166 v37 = pGlobalTXT_LocalizationStrings[153];//Íåò |
0 | 1167 pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v35, 0, v37, 84, 0); |
1168 ++v43; | |
1169 } | |
1170 while ( v43 < 4 ); | |
1171 v38 = GetPartyReputation(); | |
1172 if ( v38 >= 0 ) | |
1173 { | |
1174 v39 = v49; | |
1175 if ( v38 <= 5 ) | |
1176 v39 = 65535; | |
1177 } | |
1178 else | |
1179 { | |
1180 v39 = v46; | |
1181 } | |
1182 v40 = GetReputationString(v38); | |
24 | 1183 sprintf(pTmpBuf, "%s: ", pGlobalTXT_LocalizationStrings[180], v39, v40);//Reputation |
0 | 1184 pGUIWindow_CurrentMenu->DrawText(pFontArrus, 22, 323, 0, pTmpBuf, 0, 0, 0); |
1185 v41 = pParty->GetPartyFame(); | |
24 | 1186 sprintf(pTmpBuf, "\r261%s: %d", pGlobalTXT_LocalizationStrings[84], v41);// Fame Ñëàâà |
0 | 1187 return pGUIWindow_CurrentMenu->DrawText(pFontArrus, 0, 323, 0, pTmpBuf, 0, 0, 0); |
1188 } | |
1189 | |
1190 //----- (0041ABFD) -------------------------------------------------------- | |
1191 void __thiscall CharacterUI_CharacterScreen_Draw(unsigned int uPlayerIdx) | |
1192 { | |
1193 unsigned int v1; // edi@1 | |
1194 unsigned int v2; // eax@6 | |
17 | 1195 Texture *pTexture; // ecx@6 |
1196 GUIButton *pButton; // eax@6 | |
0 | 1197 unsigned int v5; // eax@7 |
1198 unsigned int v6; // eax@10 | |
1199 unsigned int v7; // eax@11 | |
1200 | |
1201 v1 = uPlayerIdx; | |
1202 if ( uPlayerIdx ) | |
1203 { | |
1204 pRenderer->ClearZBuffer(0, 479); | |
1205 switch ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] ) | |
1206 { | |
17 | 1207 case WINDOW_CharacterWindow_Stats: // stats |
0 | 1208 sub_4196A0(); |
1209 sub_419379(); | |
1210 CharacterUI_StatsTab_Draw(v1); | |
1211 v7 = pIcons_LOD->LoadTexture("ib-cd1-d", TEXTURE_16BIT_PALETTE); | |
17 | 1212 pTexture = (Texture *)(v7 != -1 ? (int)&pIcons_LOD->pTextures[v7] : 0); |
1213 pButton = pCharacterScreen_StatsBtn; | |
0 | 1214 break; |
17 | 1215 case WINDOW_CharacterWindow_Skills: // skills |
0 | 1216 if ( dword_507CC0 != uActiveCharacter ) |
1217 { | |
1218 sub_4196A0(); | |
39 | 1219 CharacterUI_SkillScreen_Draw(); |
0 | 1220 } |
1221 sub_419379(); | |
1222 CharacterUI_SkillsTab_Draw(v1); | |
1223 v6 = pIcons_LOD->LoadTexture("ib-cd2-d", TEXTURE_16BIT_PALETTE); | |
17 | 1224 pTexture = (Texture *)(v6 != -1 ? (int)&pIcons_LOD->pTextures[v6] : 0); |
1225 pButton = pCharacterScreen_SkillsBtn; | |
0 | 1226 break; |
17 | 1227 case WINDOW_CharacterWindow_Awards: // awards |
0 | 1228 sub_4196A0(); |
1229 sub_419379(); | |
1230 sub_419220(); | |
1231 CharacterUI_AwardsTab_Draw(v1); | |
1232 v5 = pIcons_LOD->LoadTexture("ib-cd4-d", TEXTURE_16BIT_PALETTE); | |
17 | 1233 pTexture = (Texture *)(v5 != -1 ? (int)&pIcons_LOD->pTextures[v5] : 0); |
1234 pButton = pCharacterScreen_AwardsBtn; | |
0 | 1235 break; |
17 | 1236 default: // inventory and other |
0 | 1237 if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] != 103 ) |
1238 goto LABEL_13; | |
1239 sub_4196A0(); | |
1240 sub_419379(); | |
1241 CharacterUI_InventoryTab_Draw(v1, 0); | |
1242 v2 = pIcons_LOD->LoadTexture("ib-cd3-d", TEXTURE_16BIT_PALETTE); | |
17 | 1243 pTexture = (Texture *)(v2 != -1 ? (int)&pIcons_LOD->pTextures[v2] : 0); |
1244 pButton = pCharacterScreen_InventoryBtn; | |
0 | 1245 break; |
1246 } | |
17 | 1247 pRenderer->DrawTextureIndexed(pButton->uX, pButton->uY, pTexture); |
0 | 1248 LABEL_13: |
1249 if ( bRingsShownInCharScreen ) | |
1250 CharacterUI_DrawPaperdollWithRingOverlay(v1); | |
1251 else | |
1252 CharacterUI_DrawPaperdoll(v1); | |
1253 } | |
1254 } | |
1255 // 507CC0: using guessed type int dword_507CC0; | |
1256 // 5118E0: using guessed type int bRingsShownInCharScreen; | |
1257 | |
1258 //----- (0041AD6E) -------------------------------------------------------- | |
1259 void __cdecl GameUI_DrawRightPanelItems() | |
1260 { | |
1261 if ( (signed int)((pParty->uTimePlayed - qword_507CC8) >> 32) <= 0 | |
1262 && (((pParty->uTimePlayed - qword_507CC8) >> 32) & 0x80000000u) != 0i64 ) | |
1263 qword_507CC8 = 0i64; | |
1264 if ( (((pParty->uTimePlayed - qword_507CC8) >> 32) & 0x80000000u) == 0i64 | |
1265 && (!(SHIDWORD(pParty->uTimePlayed) < (LODWORD(pParty->uTimePlayed) < (unsigned int)qword_507CC8) | |
1266 + HIDWORD(qword_507CC8) | (pParty->uTimePlayed - qword_507CC8) >> 32 == 0) | |
1267 || (unsigned int)(LODWORD(pParty->uTimePlayed) - qword_507CC8) > 0x80) ) | |
1268 { | |
1269 qword_507CC8 = pParty->uTimePlayed; | |
1270 byte_50697C = byte_50697C == 0; | |
1271 if ( byte_50697C | |
1272 && pCurrentScreen != 5 ) | |
1273 { | |
1274 if ( bFlashQuestBook ) | |
1275 pRenderer->DrawTextureTransparent( | |
1276 493u, | |
1277 355u, | |
1278 (Texture *)(uTextureID_ib_td1_A != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_ib_td1_A] : 0)); | |
1279 if ( bFlashAutonotesBook ) | |
1280 pRenderer->DrawTextureTransparent( | |
1281 527u, | |
1282 353u, | |
1283 (Texture *)(uTextureID_ib_td2_A != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_ib_td2_A] : 0)); | |
1284 if ( bFlashHistoryBook ) | |
1285 pRenderer->DrawTextureTransparent( | |
1286 600u, | |
1287 361u, | |
1288 (Texture *)(uTextureID_ib_td5_A != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_ib_td5_A] : 0)); | |
1289 } | |
1290 else | |
1291 { | |
1292 pRenderer->DrawTextureRGB(468u, 0, pTexture_RightFrame); | |
1293 DrawHiredNPCs(); | |
1294 } | |
1295 } | |
1296 } | |
1297 | |
1298 //----- (0041AEBB) -------------------------------------------------------- | |
1299 void __cdecl GameUI_DrawFoodAndGold() | |
1300 { | |
1301 unsigned int v0; // ebx@2 | |
1302 unsigned int v1; // ebp@2 | |
1303 int v2; // esi@2 | |
1304 | |
1305 if ( uGameState != GAME_STATE_FINAL_WINDOW ) | |
1306 { | |
1307 v0 = uGameUIFontMain; | |
1308 v1 = uGameUIFontShadow; | |
1309 v2 = sub_44100D() != 0 ? 381 : 322; | |
1310 sprintf(pTmpBuf, "\r087%lu", pParty->uNumFoodRations); | |
1311 pPrimaryWindow->DrawText(pFontSmallnum, 0, v2, v0, pTmpBuf, 0, 0, v1); | |
1312 sprintf(pTmpBuf, "\r028%lu", pParty->uNumGold); | |
1313 pPrimaryWindow->DrawText(pFontSmallnum, 0, v2, v0, pTmpBuf, 0, 0, v1); | |
1314 } | |
1315 } | |
1316 | |
1317 //----- (0041AF52) -------------------------------------------------------- | |
1318 void Actor::DrawHealthBar(Actor *a1, GUIWindow *a2) | |
1319 { | |
1320 unsigned int v2; // eax@1 | |
1321 GUIWindow *v3; // edi@1 | |
1322 unsigned int v4; // esi@1 | |
1323 signed int v5; // ebx@4 | |
1324 double v6; // st7@5 | |
1325 unsigned int v7; // eax@6 | |
1326 unsigned int v8; // ebx@10 | |
1327 unsigned int v9; // [sp+14h] [bp-Ch]@4 | |
1328 unsigned int v10; // [sp+1Ch] [bp-4h]@4 | |
1329 | |
1330 v2 = a1->pMonsterInfo.uHP; | |
1331 v3 = a2; | |
1332 v4 = 25; | |
1333 if ( (signed int)v2 > 25 ) | |
1334 { | |
1335 v4 = 200; | |
1336 if ( (signed int)v2 < 200 ) | |
1337 v4 = a1->pMonsterInfo.uHP; | |
1338 } | |
1339 v5 = a1->sCurrentHP; | |
1340 v10 = v4; | |
1341 v9 = uTextureID_mhp_grn; | |
1342 if ( v5 < (signed int)v2 ) | |
1343 { | |
1344 v6 = (double)(signed int)v2; | |
1345 v10 = (signed __int64)((double)(signed int)v4 / (double)(signed int)v2 * (double)a1->sCurrentHP); | |
1346 if ( v5 <= (signed int)(signed __int64)(0.34 * v6) ) | |
1347 { | |
1348 v7 = uTextureID_mhp_red; | |
1349 LABEL_9: | |
1350 v9 = v7; | |
1351 goto LABEL_10; | |
1352 } | |
1353 if ( v5 <= (signed int)(signed __int64)(v6 * 0.67) ) | |
1354 { | |
1355 v7 = uTextureID_mhp_yel; | |
1356 goto LABEL_9; | |
1357 } | |
1358 } | |
1359 LABEL_10: | |
1360 v8 = a2->uFrameX + (signed int)(a2->uFrameWidth - v4) / 2; | |
1361 pRenderer->Clip(v8, a2->uFrameY + 32, v8 + v4, a2->uFrameY + 52); | |
1362 pRenderer->DrawTextureIndexed( | |
1363 v8, | |
1364 v3->uFrameY + 32, | |
1365 (Texture *)(uTextureID_mhp_bd != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_mhp_bd] : 0)); | |
1366 pRenderer->Clip(v8, v3->uFrameY + 32, v8 + v10, v3->uFrameY + 52); | |
1367 pRenderer->DrawTextureIndexed( | |
1368 v8, | |
1369 v3->uFrameY + 34, | |
1370 (Texture *)(v9 != -1 ? (int)&pIcons_LOD->pTextures[v9] : 0)); | |
1371 pRenderer->ResetClip(); | |
1372 pRenderer->DrawTextureIndexed( | |
1373 v8 - 5, | |
1374 v3->uFrameY + 32, | |
1375 (Texture *)(uTextureID_mhp_capl != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_mhp_capl] : 0)); | |
1376 pRenderer->DrawTextureIndexed( | |
1377 v8 + v4, | |
1378 v3->uFrameY + 32, | |
1379 (Texture *)(uTextureID_mhp_capr != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_mhp_capr] : 0)); | |
1380 } | |
1381 | |
1382 //----- (0041B0C9) -------------------------------------------------------- | |
1383 void __cdecl GameUI_DrawLifeManaBars() | |
1384 { | |
1385 Texture *v0; // ebx@1 | |
1386 Player *v1; // ecx@2 | |
1387 float v2; // ST38_4@3 | |
1388 double v3; // st7@3 | |
1389 signed __int64 v4; // qax@6 | |
1390 Player *v5; // ecx@24 | |
1391 float v6; // ST30_4@25 | |
1392 double v7; // st7@25 | |
1393 bool v8; // ST38_4@27 | |
1394 Texture *v9; // [sp-4h] [bp-30h]@10 | |
1395 Texture *v10; // [sp+Ch] [bp-20h]@1 | |
1396 Player *v11; // [sp+10h] [bp-1Ch]@2 | |
1397 int v12; // [sp+10h] [bp-1Ch]@24 | |
1398 Texture *v13; // [sp+14h] [bp-18h]@1 | |
1399 Texture *v14; // [sp+18h] [bp-14h]@1 | |
1400 float v15; // [sp+1Ch] [bp-10h]@1 | |
1401 signed int v16; // [sp+24h] [bp-8h]@1 | |
1402 signed int v17; // [sp+28h] [bp-4h]@8 | |
1403 | |
1404 v0 = (Texture *)(uTextureID_BarGreen != -1 ? &pIcons_LOD->pTextures[uTextureID_BarGreen] : 0); | |
1405 v14 = (Texture *)(uTextureID_BarYellow != -1 ? &pIcons_LOD->pTextures[uTextureID_BarYellow] : 0); | |
1406 v13 = (Texture *)(uTextureID_BarRed != -1 ? &pIcons_LOD->pTextures[uTextureID_BarRed] : 0); | |
1407 v16 = 0; | |
1408 v10 = (Texture *)(uTextureID_BarBlue != -1 ? &pIcons_LOD->pTextures[uTextureID_BarBlue] : 0); | |
1409 v15 = (double)(uTextureID_BarGreen != -1 ? pIcons_LOD->pTextures[uTextureID_BarGreen].uTextureHeight : 26); | |
1410 do | |
1411 { | |
1412 v1 = &pParty->pPlayers[v16]; | |
1413 v11 = v1; | |
1414 if ( v1->sHealth <= 0 ) | |
1415 goto LABEL_24; | |
1416 v11 = &pParty->pPlayers[v16]; | |
1417 v2 = (double)v1->sHealth; | |
1418 v3 = v2 / (double)v1->GetMaxHealth(); | |
1419 if ( v3 <= 0.5 ) | |
1420 { | |
1421 if ( v3 <= 0.25 ) | |
1422 { | |
1423 if ( v3 <= 0.0 ) | |
1424 goto LABEL_24; | |
1425 if ( v16 == 2 || v16 == 3 ) | |
1426 v17 = 2; | |
1427 else | |
1428 v17 = 0; | |
1429 pRenderer->Clip( | |
1430 v17 + pHealthBarPos[v16], | |
1431 (unsigned __int64)(signed __int64)((1.0 - v3) * v15) + 402, | |
1432 v17 + pHealthBarPos[v16] + v13->uTextureWidth, | |
1433 v13->uTextureHeight + 402); | |
1434 v9 = v13; | |
1435 } | |
1436 else | |
1437 { | |
1438 if ( v16 == 2 || v16 == 3 ) | |
1439 v17 = 2; | |
1440 else | |
1441 v17 = 0; | |
1442 pRenderer->Clip( | |
1443 v17 + pHealthBarPos[v16], | |
1444 (unsigned __int64)(signed __int64)((1.0 - v3) * v15) + 402, | |
1445 v17 + pHealthBarPos[v16] + v14->uTextureWidth, | |
1446 v14->uTextureHeight + 402); | |
1447 v9 = v14; | |
1448 } | |
1449 } | |
1450 else | |
1451 { | |
1452 if ( v3 > 1.0 ) | |
1453 v3 = 1.0; | |
1454 v4 = (signed __int64)((1.0 - v3) * v15); | |
1455 if ( v16 == 2 || v16 == 3 ) | |
1456 v17 = 2; | |
1457 else | |
1458 v17 = 0; | |
1459 pRenderer->Clip( | |
1460 v17 + pHealthBarPos[v16], | |
1461 v4 + 402, | |
1462 v17 + pHealthBarPos[v16] + v0->uTextureWidth, | |
1463 v0->uTextureHeight + 402); | |
1464 v9 = v0; | |
1465 } | |
1466 pRenderer->DrawTextureIndexed(v17 + pHealthBarPos[v16], 0x192u, v9); | |
1467 pRenderer->ResetClip(); | |
1468 LABEL_24: | |
1469 v5 = v11; | |
1470 v12 = v11->sMana; | |
1471 if ( v12 > 0 ) | |
1472 { | |
1473 v6 = (double)v12; | |
1474 v7 = v6 / (double)v5->GetMaxMana(); | |
1475 if ( v7 > 1.0 ) | |
1476 v7 = 1.0; | |
1477 v8 = v16 == 2; | |
1478 pRenderer->Clip( | |
1479 (v16 == 2) + pManaBarPos[v16], | |
1480 (unsigned __int64)(signed __int64)((1.0 - v7) * v15) + 402, | |
1481 v8 + pManaBarPos[v16] + v10->uTextureWidth, | |
1482 v10->uTextureHeight + 402); | |
1483 pRenderer->DrawTextureIndexed(v8 + pManaBarPos[v16], 0x192u, v10); | |
1484 pRenderer->ResetClip(); | |
1485 } | |
1486 ++v16; | |
1487 } | |
1488 while ( v16 < 4 ); | |
1489 } | |
1490 | |
1491 //----- (0041B3B6) -------------------------------------------------------- | |
1492 void __cdecl draw_right_panel() | |
1493 { | |
1494 pRenderer->DrawTextureTransparent( | |
1495 pViewport->uViewportZ, | |
1496 0, | |
1497 (Texture *)(uTextureID_right_panel != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_right_panel] : 0)); | |
1498 } | |
1499 | |
1500 //----- (0041B3E2) -------------------------------------------------------- | |
1501 void __cdecl GameUI_DrawRightPanelFrames() | |
1502 { | |
1503 pRenderer->DrawTextureRGB(0, 0, pTexture_TopFrame); | |
1504 pRenderer->DrawTextureRGB(0, 8u, pTexture_LeftFrame); | |
1505 pRenderer->DrawTextureRGB(468u, 0, pTexture_RightFrame); | |
1506 pRenderer->DrawTextureRGB(0, 352u, pTexture_BottomFrame); | |
1507 GameUI_DrawFoodAndGold(); | |
1508 GameUI_DrawRightPanelItems(); | |
1509 } | |
1510 | |
1511 //----- (0041B438) -------------------------------------------------------- | |
1512 GUIButton *__fastcall GUI_HandleHotkey(unsigned __int8 uHotkey) | |
1513 { | |
1514 char v1; // al@1 | |
1515 int v2; // esi@1 | |
1516 char v3; // dl@1 | |
1517 GUIWindow *v4; // ecx@2 | |
1518 GUIButton *result; // eax@2 | |
1519 int v6; // edx@12 | |
1520 | |
1521 v1 = toupper(uHotkey); | |
1522 v2 = uNumVisibleWindows; | |
1523 v3 = v1; | |
1524 if ( uNumVisibleWindows >= 0 ) | |
1525 { | |
1526 while ( 2 ) | |
1527 { | |
1528 v4 = &pWindowList[pVisibleWindowsIdxs[v2] - 1]; | |
1529 for ( result = v4->pControlsHead; result; result = result->pNext ) | |
1530 { | |
1531 if ( result->uHotkey == v3 ) | |
1532 { | |
1533 v6 = result->uControlParam; | |
1534 if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
1535 { | |
1536 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)result->uControlID; | |
1537 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v6; | |
1538 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
1539 ++pMessageQueue_50CBD0->uNumMessages; | |
1540 } | |
1541 return result; | |
1542 } | |
1543 } | |
1544 if ( v4->uFrameX || v4->uFrameY || !(v4->uFrameWidth == 640 & v4->uFrameHeight == 480) ) | |
1545 { | |
1546 --v2; | |
1547 if ( v2 >= 0 ) | |
1548 continue; | |
1549 } | |
1550 break; | |
1551 } | |
1552 } | |
1553 return 0; | |
1554 } | |
1555 // 5075E0: using guessed type int pVisibleWindowsIdxs[20]; | |
1556 | |
1557 //----- (0041B4E1) -------------------------------------------------------- | |
1558 int __fastcall GUI_ReplaceHotkey(unsigned __int8 uOldHotkey, unsigned __int8 uNewHotkey, char bFirstCall) | |
1559 { | |
1560 unsigned __int8 v3; // bl@1 | |
1561 int result; // eax@1 | |
1562 int i; // edx@2 | |
1563 GUIButton *j; // ecx@3 | |
1564 int k; // edx@7 | |
1565 GUIButton *l; // ecx@8 | |
1566 unsigned __int8 v9; // [sp+4h] [bp-8h]@1 | |
1567 char v10; // [sp+8h] [bp-4h]@1 | |
1568 | |
1569 v3 = uNewHotkey; | |
1570 v10 = toupper(uOldHotkey); | |
1571 result = toupper(v3); | |
1572 v9 = result; | |
1573 if ( bFirstCall ) | |
1574 { | |
1575 for ( i = uNumVisibleWindows; i >= 0; --i ) | |
1576 { | |
1577 result = 84 * pVisibleWindowsIdxs[i]; | |
1578 //for ( j = *(GUIButton **)((char *)pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_ + result); j; j = j->pNext ) | |
1579 for ( j = pWindowList[pVisibleWindowsIdxs[i] - 1].pControlsHead; j; j = j->pNext ) | |
1580 j->field_28 = 0; | |
1581 } | |
1582 } | |
1583 for ( k = uNumVisibleWindows; k >= 0; --k ) | |
1584 { | |
1585 result = 84 * pVisibleWindowsIdxs[k]; | |
1586 //for ( l = *(GUIButton **)((char *)pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_ + result); l; l = l->pNext ) | |
1587 for ( l = pWindowList[pVisibleWindowsIdxs[k] - 1].pControlsHead; l; l = l->pNext ) | |
1588 { | |
1589 LOBYTE(result) = v10; | |
1590 if ( l->uHotkey == v10 ) | |
1591 { | |
1592 if ( !l->field_28 ) | |
1593 { | |
1594 LOBYTE(result) = v9; | |
1595 l->field_28 = 1; | |
1596 l->uHotkey = v9; | |
1597 } | |
1598 } | |
1599 } | |
1600 } | |
1601 return result; | |
1602 } | |
1603 // 5075E0: using guessed type int pVisibleWindowsIdxs[20]; | |
1604 | |
1605 //----- (0041B578) -------------------------------------------------------- | |
1606 void __cdecl MainMenuUI_LoadFontsAndSomeStuff() | |
1607 { | |
1608 pIcons_LOD->SetupPalettes(pRenderer->uTargetRBits, | |
1609 pRenderer->uTargetGBits, | |
1610 pRenderer->uTargetBBits); | |
1611 pPaletteManager->SetColorChannelInfo(pRenderer->uTargetRBits, | |
1612 pRenderer->uTargetGBits, | |
1613 pRenderer->uTargetBBits); | |
1614 pPaletteManager->RecalculateAll(); | |
1615 | |
1616 for (uint i = 0; i < 480; ++i) | |
1617 pSRZBufferLineOffsets[i] = 640 * i; | |
1618 | |
1619 pRenderer->ResetClip(); | |
1620 | |
1621 uTextureID_FONTPAL = pIcons_LOD->LoadTexture("FONTPAL", TEXTURE_16BIT_PALETTE); | |
1622 pFontArrus = LoadFont("arrus.fnt", "FONTPAL", 0); | |
1623 pFontLucida = LoadFont("lucida.fnt", "FONTPAL", 0); | |
1624 pFontCreate = LoadFont("create.fnt", "FONTPAL", 0); | |
1625 pFontSmallnum = LoadFont("smallnum.fnt", "FONTPAL", 0); | |
1626 pFontComic = LoadFont("comic.fnt", "FONTPAL", 0); | |
1627 pFontArrus->field_3 = 0; | |
1628 pFontLucida->field_3 = 0; | |
1629 pFontCreate->field_3 = 0; | |
1630 | |
1631 for (uint i = 0; i < 20; ++i) | |
1632 pWindowList[i].eWindowType = WINDOW_null; | |
1633 | |
1634 uNumVisibleWindows = -1; | |
1635 memset(pVisibleWindowsIdxs, 0, sizeof(pVisibleWindowsIdxs)); | |
1636 } | |
1637 | |
1638 //----- (0041B690) -------------------------------------------------------- | |
1639 void __cdecl MainMenuUI_Create() | |
1640 { | |
1641 unsigned int v0; // eax@1 | |
1642 unsigned int v1; // eax@1 | |
1643 unsigned int v2; // eax@1 | |
1644 unsigned int v3; // eax@1 | |
1645 unsigned int v4; // eax@1 | |
1646 unsigned int v5; // eax@1 | |
1647 Texture *v6; // ST78_4@1 | |
1648 const char *v7; // ST5C_4@1 | |
1649 unsigned __int8 v8; // al@1 | |
1650 //Texture *v9; // ST60_4@1 | |
1651 Texture *v10; // ST78_4@1 | |
1652 const char *v11; // ST5C_4@1 | |
1653 unsigned __int8 v12; // al@1 | |
1654 //Texture *v13; // ST60_4@1 | |
1655 unsigned int v14; // eax@1 | |
1656 Texture *v15; // ST78_4@1 | |
1657 const char *v16; // ST5C_4@1 | |
1658 unsigned __int8 v17; // al@1 | |
1659 //Texture *v18; // ST60_4@1 | |
1660 unsigned int uTextureID_ib_td4_A; // eax@1 | |
1661 Texture *v20; // ST78_4@1 | |
1662 unsigned __int8 v22; // al@1 | |
1663 //Texture *v23; // ST60_4@1 | |
1664 Texture *v24; // eax@1 | |
1665 Texture *v25; // esi@1 | |
1666 Texture *v26; // ST60_4@1 | |
1667 const char *v27; // ST5C_4@1 | |
1668 unsigned __int8 v28; // al@1 | |
1669 Texture *v29; // eax@1 | |
1670 Texture *v30; // esi@1 | |
1671 Texture *v31; // ST60_4@1 | |
1672 const char *v32; // ST5C_4@1 | |
1673 unsigned __int8 v33; // al@1 | |
1674 | |
1675 v0 = pIconsFrameTable->FindIcon("wizeyeC"); | |
1676 pIconsFrameTable->InitializeAnimation(v0); | |
1677 v1 = pIconsFrameTable->FindIcon("wizeyeB"); | |
1678 pIconsFrameTable->InitializeAnimation(v1); | |
1679 v2 = pIconsFrameTable->FindIcon("wizeyeA"); | |
1680 pIconsFrameTable->InitializeAnimation(v2); | |
1681 v3 = pIconsFrameTable->FindIcon("torchC"); | |
1682 pIconsFrameTable->InitializeAnimation(v3); | |
1683 v4 = pIconsFrameTable->FindIcon("torchB"); | |
1684 pIconsFrameTable->InitializeAnimation(v4); | |
1685 v5 = pIconsFrameTable->FindIcon("torchA"); | |
1686 pIconsFrameTable->InitializeAnimation(v5); | |
1687 pTextureIDs_pMapDirs[0] = pIcons_LOD->LoadTexture("MAPDIR8", TEXTURE_16BIT_PALETTE); | |
1688 pTextureIDs_pMapDirs[1] = pIcons_LOD->LoadTexture("MAPDIR1", TEXTURE_16BIT_PALETTE); | |
1689 pTextureIDs_pMapDirs[2] = pIcons_LOD->LoadTexture("MAPDIR2", TEXTURE_16BIT_PALETTE); | |
1690 pTextureIDs_pMapDirs[3] = pIcons_LOD->LoadTexture("MAPDIR3", TEXTURE_16BIT_PALETTE); | |
1691 pTextureIDs_pMapDirs[4] = pIcons_LOD->LoadTexture("MAPDIR4", TEXTURE_16BIT_PALETTE); | |
1692 pTextureIDs_pMapDirs[5] = pIcons_LOD->LoadTexture("MAPDIR5", TEXTURE_16BIT_PALETTE); | |
1693 pTextureIDs_pMapDirs[6] = pIcons_LOD->LoadTexture("MAPDIR6", TEXTURE_16BIT_PALETTE); | |
1694 pTextureIDs_pMapDirs[7] = pIcons_LOD->LoadTexture("MAPDIR7", TEXTURE_16BIT_PALETTE); | |
1695 uTextureID_BarBlue = pIcons_LOD->LoadTexture("ib-statB", TEXTURE_16BIT_PALETTE); | |
1696 uTextureID_BarGreen = pIcons_LOD->LoadTexture("ib-statG", TEXTURE_16BIT_PALETTE); | |
1697 uTextureID_BarYellow = pIcons_LOD->LoadTexture("ib-statY", TEXTURE_16BIT_PALETTE); | |
1698 uTextureID_BarRed = pIcons_LOD->LoadTexture("ib-statR", TEXTURE_16BIT_PALETTE); | |
1699 uTextureID_mhp_bd = pIcons_LOD->LoadTexture("mhp_bg", TEXTURE_16BIT_PALETTE); | |
1700 uTextureID_mhp_capl = pIcons_LOD->LoadTexture("mhp_capl", TEXTURE_16BIT_PALETTE); | |
1701 uTextureID_mhp_capr = pIcons_LOD->LoadTexture("mhp_capr", TEXTURE_16BIT_PALETTE); | |
1702 uTextureID_mhp_grn = pIcons_LOD->LoadTexture("mhp_grn", TEXTURE_16BIT_PALETTE); | |
1703 uTextureID_mhp_red = pIcons_LOD->LoadTexture("mhp_red", TEXTURE_16BIT_PALETTE); | |
1704 uTextureID_mhp_yel = pIcons_LOD->LoadTexture("mhp_yel", TEXTURE_16BIT_PALETTE); | |
1705 uTextureID_Leather = pIcons_LOD->LoadTexture("LEATHER", TEXTURE_16BIT_PALETTE); | |
1706 pTexture_Leather = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("ibground", TEXTURE_16BIT_PALETTE)]; | |
1707 uTextureID_x_x_u = pIcons_LOD->LoadTexture("x_x_u", TEXTURE_16BIT_PALETTE); | |
1708 uTextureID_BUTTDESC2 = pIcons_LOD->LoadTexture("BUTTESC2", TEXTURE_16BIT_PALETTE); | |
1709 uTextureID_x_ok_u = pIcons_LOD->LoadTexture("x_ok_u", TEXTURE_16BIT_PALETTE); | |
1710 uTextureID_BUTTYES2 = pIcons_LOD->LoadTexture("BUTTYES2", TEXTURE_16BIT_PALETTE); | |
1711 uTextureID_BUTTMAKE = pIcons_LOD->LoadTexture("BUTTMAKE", TEXTURE_16BIT_PALETTE); | |
1712 uTextureID_BUTTMAKE2 = pIcons_LOD->LoadTexture("BUTTMAKE2", TEXTURE_16BIT_PALETTE); | |
1713 | |
1714 pPrimaryWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0); | |
1715 pPrimaryWindow->CreateButton(7u, 8u, 0x1CCu, 0x157u, 1, 0, 0xAu, 0, 0, "", 0); | |
1716 pPrimaryWindow->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 1u, 0x31u, "", 0); | |
1717 pPrimaryWindow->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 2u, 0x32u, "", 0); | |
1718 pPrimaryWindow->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 3u, 0x33u, "", 0); | |
1719 pPrimaryWindow->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 4u, 0x34u, "", 0); | |
1720 pPrimaryWindow->CreateButton(0x18u, 0x194u, 5u, 0x31u, 1, 93, 0, 1u, 0, "", 0); | |
1721 pPrimaryWindow->CreateButton(0x8Bu, 0x194u, 5u, 0x31u, 1, 93, 0, 2u, 0, "", 0); | |
1722 pPrimaryWindow->CreateButton(0xFFu, 0x194u, 5u, 0x31u, 1, 93, 0, 3u, 0, "", 0); | |
1723 pPrimaryWindow->CreateButton(0x172u, 0x194u, 5u, 0x31u, 1, 93, 0, 4u, 0, "", 0); | |
1724 pPrimaryWindow->CreateButton(0x61u, 0x194u, 5u, 0x31u, 1, 93, 0, 1u, 0, "", 0); | |
1725 pPrimaryWindow->CreateButton(0xD4u, 0x194u, 5u, 0x31u, 1, 93, 0, 2u, 0, "", 0); | |
1726 pPrimaryWindow->CreateButton(0x148u, 0x194u, 5u, 0x31u, 1, 93, 0, 3u, 0, "", 0); | |
1727 pPrimaryWindow->CreateButton(0x1BBu, 0x194u, 5u, 0x31u, 1, 93, 0, 4u, 0, "", 0); | |
1728 uTextureID_ib_td1_A = pIcons_LOD->LoadTexture("ib-td1-A", TEXTURE_16BIT_PALETTE); | |
1729 v6 = (Texture *)(uTextureID_ib_td1_A != -1 ? &pIcons_LOD->pTextures[uTextureID_ib_td1_A] : 0); | |
17 | 1730 v7 = pGlobalTXT_LocalizationStrings[174];//Quests |
0 | 1731 v8 = pKeyActionMap->GetActionVKey(INPUT_Quest); |
17 | 1732 pBtn_Quests = pPrimaryWindow->CreateButton(0x1EBu, 0x161u, v6->uTextureWidth, v6->uTextureHeight, 1, 0, 0xC8u, 0, v8, v7, v6, 0); |
0 | 1733 uTextureID_ib_td2_A = pIcons_LOD->LoadTexture("ib-td2-A", TEXTURE_16BIT_PALETTE); |
1734 v10 = (Texture *)(uTextureID_ib_td2_A != -1 ? &pIcons_LOD->pTextures[uTextureID_ib_td2_A] : 0); | |
17 | 1735 v11 = pGlobalTXT_LocalizationStrings[154];//Autonotes |
0 | 1736 v12 = pKeyActionMap->GetActionVKey(INPUT_Autonotes); |
17 | 1737 pBtn_Autonotes = pPrimaryWindow->CreateButton(0x20Fu, 0x161u, v10->uTextureWidth, v10->uTextureHeight, 1, 0, 0xC9u, 0, v12, v11, v10, 0); |
0 | 1738 v14 = pIcons_LOD->LoadTexture("ib-td3-A", TEXTURE_16BIT_PALETTE); |
1739 v15 = (Texture *)(v14 != -1 ? (int)&pIcons_LOD->pTextures[v14] : 0); | |
17 | 1740 v16 = pGlobalTXT_LocalizationStrings[139];//Maps |
0 | 1741 v17 = pKeyActionMap->GetActionVKey(INPUT_Mapbook); |
17 | 1742 pBtn_Maps = pPrimaryWindow->CreateButton(0x222u, 0x161u, v15->uTextureWidth, v15->uTextureHeight, 1, 0, 0xCAu, 0, v17, v16, v15, 0); |
0 | 1743 uTextureID_ib_td4_A = pIcons_LOD->LoadTexture("ib-td4-A", TEXTURE_16BIT_PALETTE); |
1744 v20 = (Texture *)(uTextureID_ib_td4_A != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_ib_td4_A] : 0); | |
1745 v22 = pKeyActionMap->GetActionVKey(INPUT_TimeCal); | |
17 | 1746 pBtn_Calendar = pPrimaryWindow->CreateButton(0x23Au, 0x161u, v20->uTextureWidth, v20->uTextureHeight, 1, 0, 0xCBu, 0, v22, |
1747 pGlobalTXT_LocalizationStrings[78],//Calendar | |
1748 v20, 0); | |
0 | 1749 uTextureID_ib_td5_A = pIcons_LOD->LoadTexture("ib-td5-A", TEXTURE_16BIT_PALETTE); |
17 | 1750 pBtn_History = pPrimaryWindow->CreateButton(0x258u, 0x169u, |
0 | 1751 (uTextureID_ib_td5_A != -1 ? pIcons_LOD->pTextures[uTextureID_ib_td5_A].uTextureWidth : 24), |
1752 (uTextureID_ib_td5_A != -1 ? pIcons_LOD->pTextures[uTextureID_ib_td5_A].uTextureHeight : 26), | |
17 | 1753 1, 0, 0xE0u, 0, 0x48u, pGlobalTXT_LocalizationStrings[602],//History |
1754 (Texture *)(uTextureID_ib_td5_A != -1 ? &pIcons_LOD->pTextures[uTextureID_ib_td5_A] : 0), 0); | |
0 | 1755 v24 = &pIcons_LOD->pTextures[uTextureID_507980]; |
1756 v25 = (Texture *)(uTextureID_507980 != -1 ? (int)v24 : 0); | |
1757 bFlashHistoryBook = 0; | |
1758 v26 = (Texture *)(uTextureID_507980 != -1 ? (int)v24 : 0); | |
1759 bFlashAutonotesBook = 0; | |
1760 v27 = pGlobalTXT_LocalizationStrings[252]; | |
1761 bFlashQuestBook = 0; | |
1762 v28 = pKeyActionMap->GetActionVKey(INPUT_ZoomIn); | |
1763 dword_507A18 = pPrimaryWindow->CreateButton( | |
1764 0x23Eu, | |
1765 0x88u, | |
1766 v25->uTextureWidth, | |
1767 v25->uTextureHeight, | |
1768 2, | |
1769 0, | |
1770 0x170u, | |
1771 0, | |
1772 v28, | |
1773 v27, | |
1774 v26, | |
1775 0); | |
1776 v29 = &pIcons_LOD->pTextures[uTextureID_507984]; | |
1777 v30 = (Texture *)(uTextureID_507984 != -1 ? (int)v29 : 0); | |
1778 v31 = (Texture *)(uTextureID_507984 != -1 ? (int)v29 : 0); | |
1779 v32 = pGlobalTXT_LocalizationStrings[251]; | |
1780 v33 = pKeyActionMap->GetActionVKey(INPUT_ZoomOut); | |
1781 dword_507A14 = pPrimaryWindow->CreateButton( | |
1782 0x207u, | |
1783 0x88u, | |
1784 v30->uTextureWidth, | |
1785 v30->uTextureHeight, | |
1786 2, | |
1787 0, | |
1788 0x16Fu, | |
1789 0, | |
1790 v33, | |
1791 v32, | |
1792 v31, | |
1793 0); | |
1794 pPrimaryWindow->CreateButton(0x1E1u, 0, 0x99u, 0x43u, 1, 92, 0, 0, 0, "", 0); | |
1795 pPrimaryWindow->CreateButton(0x1EBu, 0x95u, 0x40u, 0x4Au, 1, 0, 0x86u, 0, 0x35u, "", 0); | |
1796 pPrimaryWindow->CreateButton(0x231u, 0x95u, 0x40u, 0x4Au, 1, 0, 0x87u, 0, 0x36u, "", 0); | |
1797 pPrimaryWindow->CreateButton(0x1DCu, 0x142u, 0x4Du, 0x11u, 1, 100, 0, 0, 0, "", 0); | |
1798 pPrimaryWindow->CreateButton(0x22Bu, 0x142u, 0x4Du, 0x11u, 1, 101, 0, 0, 0, "", 0); | |
1799 pBtn_CastSpell = pPrimaryWindow->CreateButton( | |
1800 0x1DCu, | |
1801 0x1C2u, | |
1802 (uTextureID_50797C != -1 ? pIcons_LOD->pTextures[uTextureID_50797C].uTextureWidth : 24), | |
1803 (uTextureID_50797C != -1 ? pIcons_LOD->pTextures[uTextureID_50797C].uTextureHeight : 26), | |
1804 1, | |
1805 0, | |
1806 0x69u, | |
1807 0, | |
1808 0x43u, | |
1809 pGlobalTXT_LocalizationStrings[38], | |
1810 (Texture *)(uTextureID_50797C != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_50797C] : 0), | |
1811 0); | |
1812 pBtn_Rest = pPrimaryWindow->CreateButton( | |
1813 0x206u, | |
1814 0x1C2u, | |
1815 (uTextureID_507978 != -1 ? pIcons_LOD->pTextures[uTextureID_507978].uTextureWidth : 24), | |
1816 (uTextureID_507978 != -1 ? pIcons_LOD->pTextures[uTextureID_507978].uTextureHeight : 26), | |
1817 1, | |
1818 0, | |
1819 0x68u, | |
1820 0, | |
1821 0x52u, | |
1822 pGlobalTXT_LocalizationStrings[182], | |
1823 (Texture *)(uTextureID_507978 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_507978] : 0), | |
1824 0); | |
1825 pBtn_QuickReference = pPrimaryWindow->CreateButton( | |
1826 0x230u, | |
1827 0x1C2u, | |
1828 (dword_507974 != -1 ? pIcons_LOD->pTextures[dword_507974].uTextureWidth : 24), | |
1829 (dword_507974 != -1 ? pIcons_LOD->pTextures[dword_507974].uTextureHeight : 26), | |
1830 1, | |
1831 0, | |
1832 0x6Au, | |
1833 0, | |
1834 0x5Au, | |
1835 pGlobalTXT_LocalizationStrings[173], | |
1836 (Texture *)(dword_507974 != -1 ? &pIcons_LOD->pTextures[dword_507974] : 0), | |
1837 0); | |
1838 pBtn_GameSettings = pPrimaryWindow->CreateButton( | |
1839 0x25Au, | |
1840 0x1C2u, | |
1841 (uTextureID_507970 != -1 ? pIcons_LOD->pTextures[uTextureID_507970].uTextureWidth : 24), | |
1842 (uTextureID_507970 != -1 ? pIcons_LOD->pTextures[uTextureID_507970].uTextureHeight : 26), | |
1843 1, | |
1844 0, | |
1845 0x6Bu, | |
1846 0, | |
1847 0, | |
1848 pGlobalTXT_LocalizationStrings[93], | |
1849 (Texture *)(uTextureID_507970 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_507970] : 0), | |
1850 0); | |
1851 pBtn_NPCLeft = pPrimaryWindow->CreateButton( | |
1852 0x1D5u, | |
1853 0xB2u, | |
1854 (uTextureID_507990 != -1 ? pIcons_LOD->pTextures[uTextureID_507990].uTextureWidth : 24), | |
1855 (uTextureID_507990 != -1 ? pIcons_LOD->pTextures[uTextureID_507990].uTextureHeight : 26), | |
1856 1, | |
1857 0, | |
1858 0xBCu, | |
1859 0, | |
1860 0, | |
1861 "", | |
1862 (Texture *)(uTextureID_507990 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_507990] : 0), | |
1863 0); | |
1864 pBtn_NPCRight = pPrimaryWindow->CreateButton( | |
1865 0x272u, | |
1866 0xB2u, | |
1867 (uTextureID_50798C != -1 ? pIcons_LOD->pTextures[uTextureID_50798C].uTextureWidth : 24), | |
1868 (uTextureID_50798C != -1 ? pIcons_LOD->pTextures[uTextureID_50798C].uTextureHeight : 26), | |
1869 1, | |
1870 0, | |
1871 0xBCu, | |
1872 1u, | |
1873 0, | |
1874 "", | |
1875 (Texture *)(uTextureID_50798C != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_50798C] : 0), | |
1876 0); | |
1877 Load_isn_spells_21_27(); | |
1878 } | |
1879 | |
1880 | |
1881 | |
1882 //----- (0041C047) -------------------------------------------------------- | |
1883 void __cdecl GameUI_DrawStatusBar_2() | |
1884 { | |
1885 unsigned int v0; // eax@1 | |
1886 char *v1; // edx@2 | |
1887 unsigned int v2; // ST18_4@5 | |
1888 const char *v3; // ST0C_4@5 | |
1889 unsigned int v4; // ST08_4@5 | |
1890 int v5; // eax@5 | |
1891 | |
1892 pRenderer->DrawTextureRGB(0, 352u, pTexture_StatusBar); | |
1893 if ( GameUI_StatusBar_TimedStringTimeLeft ) | |
1894 { | |
1895 v1 = GameUI_StatusBar_TimedString; | |
1896 } | |
1897 else | |
1898 { | |
1899 if ( !pStatusBarString[0] ) | |
1900 return; | |
1901 v1 = pStatusBarString; | |
1902 } | |
1903 LOWORD(v0) = uGameUIFontShadow; | |
1904 v2 = v0; | |
1905 LOWORD(v0) = uGameUIFontMain; | |
1906 v3 = v1; | |
1907 v4 = v0; | |
1908 v5 = pFontLucida->AlignText_Center(0x1C2u, v1); | |
1909 pPrimaryWindow->DrawText(pFontLucida, v5 + 11, 357, v4, v3, 0, 0, v2); | |
1910 } | |
1911 | |
1912 //----- (0041C0B8) -------------------------------------------------------- | |
1913 void __thiscall sub_41C0B8_set_status_string(const char *pStr) | |
1914 { | |
1915 const char *v1; // esi@1 | |
1916 int i; // eax@7 | |
1917 int j; // eax@11 | |
1918 | |
1919 v1 = pStr; | |
1920 if ( pStr && strcmp(pStr, "test") && !IsBadStringPtrA(v1, 1u) && (*v1 || GameUI_StatusBar_TimedStringTimeLeft) ) | |
1921 { | |
1922 if ( GameUI_StatusBar_TimedStringTimeLeft ) | |
1923 { | |
1924 for ( i = pFontLucida->GetLineWidth(GameUI_StatusBar_TimedString); | |
1925 i > 450; | |
1926 i = pFontLucida->GetLineWidth(GameUI_StatusBar_TimedString) ) | |
1927 byte_5C3427[strlen(GameUI_StatusBar_TimedString)] = 0; | |
1928 } | |
1929 else | |
1930 { | |
1931 strcpy(pStatusBarString, v1); | |
1932 for ( j = pFontLucida->GetLineWidth(pStatusBarString); | |
1933 j > 450; | |
1934 j = pFontLucida->GetLineWidth(pStatusBarString) ) | |
1935 GameUI_StatusBar_TimedString[strlen(pStatusBarString) + 199] = 0; | |
1936 } | |
1937 } | |
1938 } | |
1939 | |
1940 //----- (0041C179) -------------------------------------------------------- | |
1941 void __cdecl GameUI_DrawStatusBar() | |
1942 { | |
1943 unsigned int v0; // ebp@1 | |
1944 char *v1; // edi@5 | |
1945 int v2; // eax@5 | |
1946 unsigned int v3; // esi@5 | |
1947 size_t v4; // eax@6 | |
1948 GUIFont *v5; // ecx@6 | |
1949 int v6; // eax@9 | |
1950 size_t v7; // eax@10 | |
1951 GUIFont *v8; // ecx@10 | |
1952 char v9; // zf@12 | |
1953 unsigned int v10; // ST08_4@13 | |
1954 int v11; // eax@13 | |
1955 | |
1956 v0 = uGameUIFontShadow; | |
1957 if ( pStatusBarString[0] || GameUI_StatusBar_TimedStringTimeLeft || bForceDrawStatusBar ) | |
1958 { | |
1959 pRenderer->DrawTextureRGB(0, 352u, pTexture_StatusBar); | |
1960 if ( GameUI_StatusBar_TimedStringTimeLeft ) | |
1961 { | |
1962 v1 = GameUI_StatusBar_TimedString; | |
1963 v2 = pFontLucida->GetLineWidth(GameUI_StatusBar_TimedString); | |
1964 v3 = 450; | |
1965 while ( v2 > 450 ) | |
1966 { | |
1967 v4 = strlen(GameUI_StatusBar_TimedString); | |
1968 v5 = pFontLucida; | |
1969 byte_5C3427[v4] = 0; | |
1970 v2 = pFontLucida->GetLineWidth(GameUI_StatusBar_TimedString); | |
1971 } | |
1972 } | |
1973 else | |
1974 { | |
1975 v1 = pStatusBarString; | |
1976 v6 = pFontLucida->GetLineWidth(pStatusBarString); | |
1977 v3 = 450; | |
1978 while ( v6 > 450 ) | |
1979 { | |
1980 v7 = strlen(pStatusBarString); | |
1981 v8 = pFontLucida; | |
1982 GameUI_StatusBar_TimedString[v7 + 199] = 0; | |
1983 v6 = pFontLucida->GetLineWidth(pStatusBarString); | |
1984 } | |
1985 } | |
1986 v9 = *v1 == 0; | |
1987 bForceDrawStatusBar = 0; | |
1988 if ( !v9 ) | |
1989 { | |
1990 v10 = uGameUIFontMain; | |
1991 v11 = pFontLucida->AlignText_Center(v3, v1); | |
1992 pPrimaryWindow->DrawText(pFontLucida, v11 + 11, 357, v10, v1, 0, 0, v0); | |
1993 } | |
1994 } | |
1995 } | |
1996 // 5C35BC: using guessed type int bForceDrawStatusBar; | |
1997 | |
1998 | |
1999 //----- (0041CD4F) -------------------------------------------------------- | |
2000 bool __thiscall sub_41CD4F(unsigned int _this) | |
2001 { | |
2002 unsigned int v1; // edi@1 | |
2003 unsigned int v2; // eax@2 | |
2004 int v3; // esi@3 | |
2005 int v4; // ecx@10 | |
2006 GUIButton *v5; // eax@11 | |
2007 int v6; // edx@12 | |
2008 int v7; // ecx@20 | |
2009 char v8; // zf@21 | |
2010 GUIButton *v9; // ecx@24 | |
2011 int v10; // esi@24 | |
2012 int v11; // edx@26 | |
2013 int v12; // edx@28 | |
2014 int v13; // esi@32 | |
2015 GUIButton *v14; // eax@37 | |
2016 int v15; // edx@38 | |
2017 int v17; // ecx@50 | |
2018 int v18; // edx@50 | |
2019 GUIButton *v19; // ecx@54 | |
2020 int v20; // esi@54 | |
2021 int v21; // edx@56 | |
2022 int v22; // ecx@59 | |
2023 int v23; // edx@59 | |
2024 int v24; // ecx@60 | |
2025 int v25; // esi@63 | |
2026 unsigned int v26; // [sp+Ch] [bp-14h]@1 | |
2027 int v27; // [sp+10h] [bp-10h]@1 | |
2028 int v28; // [sp+14h] [bp-Ch]@10 | |
2029 int v29; // [sp+14h] [bp-Ch]@36 | |
2030 unsigned int uClickX; // [sp+18h] [bp-8h]@10 | |
2031 unsigned int uClickY; // [sp+1Ch] [bp-4h]@10 | |
2032 | |
2033 v1 = 0; | |
2034 v26 = _this; | |
2035 v27 = uNumVisibleWindows; | |
2036 if ( uNumVisibleWindows < 0 ) | |
2037 return 0; | |
2038 v2 = pMessageQueue_50CBD0->uNumMessages; | |
2039 while ( 1 ) | |
2040 { | |
2041 v3 = pVisibleWindowsIdxs[v27] - 1; | |
2042 if ( pWindowList[v3].field_44 == v1 ) | |
2043 goto LABEL_47; | |
2044 if ( v26 != 34 ) | |
2045 break; | |
2046 if ( pWindowList[v3].field_30 != v1 ) | |
2047 { | |
2048 pMouse->GetClickPos(&uClickX, &uClickY); | |
2049 v4 = pWindowList[v3].pStartingPosActiveItem; | |
2050 v29 = v4 + pWindowList[v3].pNumPresenceButton; | |
2051 if ( v4 < v4 + pWindowList[v3].pNumPresenceButton ) | |
2052 { | |
2053 while ( 1 ) | |
2054 { | |
2055 v14 = pWindowList[v3].pControlsHead; | |
2056 if ( v4 > 0 ) | |
2057 { | |
2058 v15 = v4; | |
2059 do | |
2060 { | |
2061 v14 = v14->pNext; | |
2062 --v15; | |
2063 } | |
2064 while ( v15 ); | |
2065 } | |
2066 if ( (signed int)uClickX >= (signed int)v14->uX | |
2067 && (signed int)uClickX <= (signed int)v14->uZ | |
2068 && (signed int)uClickY >= (signed int)v14->uY | |
2069 && (signed int)uClickY <= (signed int)v14->uW ) | |
2070 goto LABEL_66; | |
2071 ++v4; | |
2072 if ( v4 >= v29 ) | |
2073 { | |
2074 LABEL_45: | |
2075 v1 = 0; | |
2076 goto LABEL_46; | |
2077 } | |
2078 } | |
2079 } | |
2080 goto LABEL_46; | |
2081 } | |
2082 LABEL_47: | |
2083 --v27; | |
2084 if ( v27 < 0 ) | |
2085 return 0; | |
2086 } | |
2087 if ( v26 == 37 ) | |
2088 { | |
2089 v12 = pWindowList[v3].field_34; | |
2090 if ( pWindowList[v3].pCurrentPosActiveItem - pWindowList[v3].pStartingPosActiveItem - v12 >= 0 ) | |
2091 { | |
2092 v8 = pCurrentScreen == 21; | |
2093 pWindowList[v3].pCurrentPosActiveItem -= v12; | |
2094 if ( v8 ) | |
2095 { | |
2096 pAudioPlayer->PlaySound((SoundID)66, v1, v1, -1, v1, v1, v1, v1); | |
2097 v2 = pMessageQueue_50CBD0->uNumMessages; | |
2098 } | |
2099 } | |
2100 if ( pWindowList[v3].field_30 != v1 ) | |
2101 goto LABEL_47; | |
2102 v9 = pWindowList[v3].pControlsHead; | |
2103 v13 = pWindowList[v3].pCurrentPosActiveItem; | |
2104 if ( v13 > (signed int)v1 ) | |
2105 { | |
2106 do | |
2107 { | |
2108 v9 = v9->pNext; | |
2109 --v13; | |
2110 } | |
2111 while ( v13 ); | |
2112 } | |
2113 LABEL_26: | |
2114 v11 = v9->uControlParam; | |
2115 if ( (signed int)v2 < 40 ) | |
2116 { | |
2117 pMessageQueue_50CBD0->pMessages[v2].eType = (UIMessageType)v9->uControlID; | |
2118 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v11; | |
2119 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = v1; | |
2120 v2 = pMessageQueue_50CBD0->uNumMessages + 1; | |
2121 ++pMessageQueue_50CBD0->uNumMessages; | |
2122 } | |
2123 goto LABEL_47; | |
2124 } | |
2125 if ( v26 != 38 ) | |
2126 { | |
2127 if ( v26 == 39 ) | |
2128 { | |
2129 v7 = pWindowList[v3].pCurrentPosActiveItem + pWindowList[v3].field_34; | |
2130 if ( v7 < pWindowList[v3].pNumPresenceButton + pWindowList[v3].pStartingPosActiveItem ) | |
2131 { | |
2132 v8 = pCurrentScreen == 21; | |
2133 pWindowList[v3].pCurrentPosActiveItem = v7; | |
2134 if ( v8 ) | |
2135 { | |
2136 pAudioPlayer->PlaySound((SoundID)66, v1, v1, -1, v1, v1, v1, v1); | |
2137 v2 = pMessageQueue_50CBD0->uNumMessages; | |
2138 } | |
2139 } | |
2140 if ( pWindowList[v3].field_30 != v1 ) | |
2141 goto LABEL_47; | |
2142 v9 = pWindowList[v3].pControlsHead; | |
2143 v10 = pWindowList[v3].pCurrentPosActiveItem; | |
2144 if ( v10 > (signed int)v1 ) | |
2145 { | |
2146 do | |
2147 { | |
2148 v9 = v9->pNext; | |
2149 --v10; | |
2150 } | |
2151 while ( v10 ); | |
2152 } | |
2153 goto LABEL_26; | |
2154 } | |
2155 if ( v26 == 40 ) | |
2156 { | |
2157 v17 = pWindowList[v3].pStartingPosActiveItem; | |
2158 v18 = pWindowList[v3].pCurrentPosActiveItem; | |
2159 if ( v18 >= pWindowList[v3].pNumPresenceButton + v17 - 1 ) | |
2160 pWindowList[v3].pCurrentPosActiveItem = v17; | |
2161 else | |
2162 pWindowList[v3].pCurrentPosActiveItem = v18 + 1; | |
2163 if ( pWindowList[v3].field_30 != v1 ) | |
2164 return 1; | |
2165 v19 = pWindowList[v3].pControlsHead; | |
2166 v20 = pWindowList[v3].pCurrentPosActiveItem; | |
2167 if ( v20 > (signed int)v1 ) | |
2168 { | |
2169 do | |
2170 { | |
2171 v19 = v19->pNext; | |
2172 --v20; | |
2173 } | |
2174 while ( v20 ); | |
2175 } | |
2176 goto LABEL_56; | |
2177 } | |
2178 if ( v26 == 41 ) | |
2179 { | |
2180 pMouse->GetClickPos(&uClickX, &uClickY); | |
2181 v4 = pWindowList[v3].pStartingPosActiveItem; | |
2182 v28 = v4 + pWindowList[v3].pNumPresenceButton; | |
2183 if ( v4 < v4 + pWindowList[v3].pNumPresenceButton ) | |
2184 { | |
2185 while ( 1 ) | |
2186 { | |
2187 v5 = pWindowList[v3].pControlsHead; | |
2188 if ( v4 > 0 ) | |
2189 { | |
2190 v6 = v4; | |
2191 do | |
2192 { | |
2193 v5 = v5->pNext; | |
2194 --v6; | |
2195 } | |
2196 while ( v6 ); | |
2197 } | |
2198 if ( (signed int)uClickX >= (signed int)v5->uX | |
2199 && (signed int)uClickX <= (signed int)v5->uZ | |
2200 && (signed int)uClickY >= (signed int)v5->uY | |
2201 && (signed int)uClickY <= (signed int)v5->uW ) | |
2202 break; | |
2203 ++v4; | |
2204 if ( v4 >= v28 ) | |
2205 goto LABEL_45; | |
2206 } | |
2207 LABEL_66: | |
2208 pWindowList[v3].pCurrentPosActiveItem = v4; | |
2209 return 1; | |
2210 } | |
2211 LABEL_46: | |
2212 v2 = pMessageQueue_50CBD0->uNumMessages; | |
2213 goto LABEL_47; | |
2214 } | |
2215 goto LABEL_47; | |
2216 } | |
2217 v22 = pWindowList[v3].pCurrentPosActiveItem; | |
2218 v23 = pWindowList[v3].pStartingPosActiveItem; | |
2219 if ( v22 <= v23 ) | |
2220 v24 = pWindowList[v3].pNumPresenceButton + v23 - 1; | |
2221 else | |
2222 v24 = v22 - 1; | |
2223 v8 = pWindowList[v3].field_30 == v1; | |
2224 pWindowList[v3].pCurrentPosActiveItem = v24; | |
2225 if ( !v8 ) | |
2226 return 1; | |
2227 v19 = pWindowList[v3].pControlsHead; | |
2228 v25 = pWindowList[v3].pCurrentPosActiveItem; | |
2229 if ( v25 > (signed int)v1 ) | |
2230 { | |
2231 do | |
2232 { | |
2233 v19 = v19->pNext; | |
2234 --v25; | |
2235 } | |
2236 while ( v25 ); | |
2237 } | |
2238 LABEL_56: | |
2239 v21 = v19->uControlParam; | |
2240 if ( (signed int)v2 < 40 ) | |
2241 { | |
2242 pMessageQueue_50CBD0->pMessages[v2].eType = (UIMessageType)v19->uControlID; | |
2243 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v21; | |
2244 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = v1; | |
2245 ++pMessageQueue_50CBD0->uNumMessages; | |
2246 } | |
2247 return 1; | |
2248 } | |
2249 | |
2250 //----- (0041D20D) -------------------------------------------------------- | |
2251 char __fastcall sub_41D20D_buff_remaining_time_string(int ecx0, GUIWindow *edx0, __int64 a3, GUIFont *a2) | |
2252 { | |
2253 unsigned int v4; // edi@1 | |
2254 unsigned int v5; // esi@1 | |
2255 unsigned int v6; // ebp@1 | |
2256 unsigned int v7; // ebx@1 | |
2257 signed __int64 v8; // ST34_8@1 | |
2258 signed __int64 v9; // kr00_8@1 | |
2259 char *v10; // eax@2 | |
2260 char *v11; // eax@7 | |
2261 char *v12; // eax@13 | |
2262 char *v13; // eax@19 | |
2263 int uY; // [sp+0h] [bp-20h]@1 | |
2264 GUIWindow *a1; // [sp+4h] [bp-1Ch]@1 | |
2265 signed __int64 v17; // [sp+10h] [bp-10h]@1 | |
2266 signed __int64 v18; // [sp+18h] [bp-8h]@1 | |
2267 unsigned int v19; // [sp+24h] [bp+4h]@1 | |
2268 | |
2269 a1 = edx0; | |
2270 uY = ecx0; | |
2271 v4 = (unsigned __int64)(signed __int64)((double)a3 * 0.234375) >> 32; | |
2272 v5 = (signed __int64)((double)a3 * 0.234375); | |
2273 v6 = (unsigned __int64)((signed __int64)((double)a3 * 0.234375) / 60) >> 32; | |
2274 v7 = (signed __int64)((double)a3 * 0.234375) / 60; | |
2275 v8 = (signed __int64)((double)a3 * 0.234375) / 60 / 60; | |
2276 v19 = (unsigned int)v8 / 0x18; | |
2277 v18 = (signed __int64)__PAIR__(v4, v5) % 60; | |
2278 v17 = (signed __int64)__PAIR__(v6, v7) % 60; | |
2279 v9 = v8 % 24; | |
2280 strcpy(pTmpBuf, "\r020"); | |
2281 if ( (unsigned int)v8 / 0x18 ) | |
2282 { | |
2283 v10 = pGlobalTXT_LocalizationStrings[57]; // Days | |
2284 if ( v19 <= 1 ) | |
2285 v10 = pGlobalTXT_LocalizationStrings[56]; // Day | |
2286 sprintf(pTmpBuf2, "%d %s ", v19, v10); | |
2287 strcat(pTmpBuf, pTmpBuf2); | |
2288 } | |
2289 if ( v9 ) | |
2290 { | |
2291 if ( v9 <= 1 ) | |
2292 v11 = pGlobalTXT_LocalizationStrings[109];// Hour | |
2293 else | |
2294 v11 = pGlobalTXT_LocalizationStrings[110];// Hours | |
2295 sprintf(pTmpBuf2, "%d %s ", v9, v11); | |
2296 strcat(pTmpBuf, pTmpBuf2); | |
2297 } | |
2298 if ( v17 && !v19 ) | |
2299 { | |
2300 if ( v17 <= 1 ) | |
2301 v12 = pGlobalTXT_LocalizationStrings[437];// Minute | |
2302 else | |
2303 v12 = pGlobalTXT_LocalizationStrings[436];// Minutes | |
2304 sprintf(pTmpBuf2, "%d %s ", v17, v12); | |
2305 strcat(pTmpBuf, pTmpBuf2); | |
2306 } | |
2307 if ( v18 && !v9 ) | |
2308 { | |
2309 if ( v18 <= 1 ) | |
2310 v13 = pGlobalTXT_LocalizationStrings[439];// Second | |
2311 else | |
2312 v13 = pGlobalTXT_LocalizationStrings[438];// Seconds | |
2313 sprintf(pTmpBuf2, "%d %s ", v18, v13); | |
2314 strcat(pTmpBuf, pTmpBuf2); | |
2315 } | |
2316 return a1->DrawText(a2, 32, uY, 0, pTmpBuf, 0, 0, 0); | |
2317 } | |
2318 | |
2319 | |
2320 //----- (0041D895) -------------------------------------------------------- | |
2321 void __thiscall GameUI_DrawItemInfo(ItemGen *ecx0) | |
2322 { | |
2323 ItemGen *v1; // esi@1 | |
2324 unsigned int v2; // eax@3 | |
2325 char *v3; // edi@5 | |
2326 unsigned int v4; // eax@5 | |
2327 unsigned int v5; // esi@5 | |
2328 signed int v6; // eax@5 | |
2329 int v7; // edx@5 | |
2330 ItemGen *v8; // ecx@10 | |
2331 unsigned int v9; // eax@12 | |
2332 char v10; // zf@16 | |
2333 ItemGen *v11; // eax@16 | |
2334 ItemGen *v12; // eax@25 | |
2335 unsigned int v13; // ecx@32 | |
2336 unsigned int v14; // eax@32 | |
2337 Render *v15; // edi@33 | |
2338 const char *v16; // eax@34 | |
2339 int v17; // eax@36 | |
2340 int v18; // esi@37 | |
2341 unsigned __int16 v19; // ax@37 | |
2342 char v20; // al@40 | |
2343 char v21; // al@44 | |
2344 char v22; // al@48 | |
2345 char v23; // al@51 | |
2346 int v24; // eax@52 | |
2347 int v25; // eax@57 | |
2348 int v26; // eax@60 | |
2349 int v27; // eax@67 | |
2350 const char *v28; // edi@69 | |
2351 int v29; // eax@70 | |
2352 char *v30; // edi@78 | |
2353 const char *v31; // eax@78 | |
2354 int v32; // ecx@81 | |
2355 unsigned int v33; // eax@81 | |
2356 int v34; // esi@81 | |
2357 const char *v35; // eax@85 | |
2358 const char *v36; // eax@87 | |
2359 unsigned int v37; // eax@109 | |
2360 unsigned int v38; // eax@109 | |
2361 int v39; // eax@113 | |
2362 GUIFont *v40; // edx@113 | |
2363 signed int v41; // [sp-20h] [bp-298h]@113 | |
2364 int v42; // [sp-1Ch] [bp-294h]@113 | |
2365 char *v43; // [sp-18h] [bp-290h]@46 | |
2366 unsigned int v44; // [sp-18h] [bp-290h]@113 | |
2367 int v45; // [sp-14h] [bp-28Ch]@46 | |
2368 const char *v46; // [sp-14h] [bp-28Ch]@58 | |
2369 char *v47; // [sp-14h] [bp-28Ch]@110 | |
2370 char *v48; // [sp-10h] [bp-288h]@46 | |
2371 const char *v49; // [sp-10h] [bp-288h]@56 | |
2372 char *v50; // [sp-10h] [bp-288h]@58 | |
2373 int v51; // [sp-10h] [bp-288h]@110 | |
2374 const char *v52; // [sp-Ch] [bp-284h]@36 | |
2375 int v53; // [sp-Ch] [bp-284h]@46 | |
2376 char *v54; // [sp-Ch] [bp-284h]@56 | |
2377 int v55; // [sp-Ch] [bp-284h]@58 | |
2378 int v56; // [sp-Ch] [bp-284h]@110 | |
2379 unsigned int v57; // [sp-8h] [bp-280h]@36 | |
2380 int v58; // [sp-8h] [bp-280h]@46 | |
2381 int v59; // [sp-8h] [bp-280h]@56 | |
2382 int v60; // [sp-8h] [bp-280h]@58 | |
2383 unsigned int v61; // [sp-8h] [bp-280h]@110 | |
2384 char a1[100]; // [sp+8h] [bp-270h]@40 | |
2385 char Dest[100]; // [sp+6Ch] [bp-20Ch]@40 | |
2386 char v64[100]; // [sp+D0h] [bp-1A8h]@40 | |
2387 char v65[120]; // [sp+134h] [bp-144h]@92 | |
2388 char Source[40]; // [sp+1ACh] [bp-CCh]@49 | |
2389 int v67; // [sp+1D4h] [bp-A4h]@91 | |
2390 int v68; // [sp+1D8h] [bp-A0h]@106 | |
2391 int v69; // [sp+1DCh] [bp-9Ch]@101 | |
2392 int v70; // [sp+1E0h] [bp-98h]@97 | |
2393 int v71; // [sp+1E8h] [bp-90h]@93 | |
2394 int v72; // [sp+1ECh] [bp-8Ch]@91 | |
2395 int var88; // [sp+1F0h] [bp-88h]@1 | |
2396 Texture *v73; // [sp+1F4h] [bp-84h]@5 | |
2397 unsigned int v75; // [sp+1F8h] [bp-80h]@5 | |
2398 char *v76; // [sp+1FCh] [bp-7Ch]@5 | |
2399 int v77; // [sp+200h] [bp-78h]@12 | |
2400 int v78; // [sp+204h] [bp-74h]@5 | |
2401 GUIWindow v79; // [sp+208h] [bp-70h]@2 | |
2402 POINT a2; // [sp+25Ch] [bp-1Ch]@2 | |
2403 int v81; // [sp+264h] [bp-14h]@5 | |
2404 GUIFont *v82; // [sp+268h] [bp-10h]@1 | |
2405 char *v83; // [sp+26Ch] [bp-Ch]@18 | |
2406 char *Str; // [sp+270h] [bp-8h]@65 | |
2407 ItemGen *_this; // [sp+274h] [bp-4h]@1 | |
2408 | |
2409 v1 = ecx0; | |
2410 _this = ecx0; | |
2411 var88 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); | |
2412 v82 = pFontComic; | |
2413 if ( v1->uItemID ) | |
2414 { | |
2415 v79.Hint = 0; | |
2416 v79.uFrameWidth = 384; | |
2417 v79.uFrameHeight = 180; | |
2418 v79.uFrameY = 40; | |
2419 if ( pMouse->GetCursorPos(&a2)->x <= 320 ) | |
2420 v2 = pMouse->GetCursorPos(&a2)->x + 30; | |
2421 else | |
2422 v2 = pMouse->GetCursorPos(&a2)->x - v79.uFrameWidth - 30; | |
2423 v79.uFrameX = v2; | |
2424 v3 = (char *)&pItemsTable->pItems[_this->uItemID].pIconName; | |
2425 v76 = v3; | |
2426 v4 = pIcons_LOD->LoadTexture(*(const char **)v3, TEXTURE_16BIT_PALETTE); | |
2427 v5 = v4; | |
2428 v4 *= 72; | |
2429 v75 = v4; | |
2430 v73 = (struct Texture *)((char *)pIcons_LOD->pTextures + v4); | |
2431 v6 = 100 - *(unsigned __int16 *)((char *)&pIcons_LOD->pTextures[0].uTextureWidth + v4); | |
2432 v7 = v73->uTextureHeight; | |
2433 v78 = v6; | |
2434 v81 = 144 - v7; | |
2435 if ( v6 > 0 ) | |
2436 v78 = v6 >> 1; | |
2437 if ( v81 <= 0 ) | |
2438 v81 = 0; | |
2439 else | |
2440 v81 >>= 1; | |
2441 v8 = _this; | |
2442 if ( !v3[46] ) | |
2443 _this->uAttributes |= 1u; | |
2444 v9 = v8->uAttributes; | |
2445 v77 = 0; | |
2446 a2.y = v9 & 2; | |
2447 if ( pItemsTable->pItems[v8->uItemID].uEquipType == 18 ) | |
2448 v77 = v8->uAdditionalValue; | |
2449 if ( uActiveCharacter ) | |
2450 { | |
2451 if ( !(v9 & 1) ) | |
2452 { | |
2453 v10 = pPlayers[uActiveCharacter]->CanIdentify(_this) == 1; | |
2454 v11 = _this; | |
2455 if ( v10 ) | |
2456 _this->uAttributes |= 1u; | |
2457 v10 = (v11->uAttributes & 1) == 0; | |
2458 v83 = (char *)9; | |
2459 if ( v10 ) | |
2460 { | |
2461 ShowStatusBarString(pGlobalTXT_LocalizationStrings[446], 2u); | |
2462 } | |
2463 else | |
2464 { | |
2465 v83 = (char *)8; | |
2466 if ( _this->GetValue() < 100 * (pPlayers[uActiveCharacter]->uLevel + 5) ) | |
2467 v83 = (char *)7; | |
2468 } | |
2469 if ( dword_4E455C ) | |
2470 { | |
2471 pPlayers[uActiveCharacter]->PlaySound((int)v83, 0); | |
2472 dword_4E455C = 0; | |
2473 } | |
2474 } | |
2475 _this->UpdateTempBonus(pParty->uTimePlayed); | |
2476 if ( a2.y ) | |
2477 { | |
2478 v10 = pPlayers[uActiveCharacter]->CanRepair(_this) == 1; | |
2479 v12 = _this; | |
2480 if ( v10 ) | |
2481 _this->uAttributes = _this->uAttributes & 0xFFFFFFFD | 1; | |
2482 v10 = (v12->uAttributes & 2) == 0; | |
2483 v83 = (char *)11; | |
2484 if ( v10 ) | |
2485 v83 = (char *)10; | |
2486 else | |
2487 ShowStatusBarString(pGlobalTXT_LocalizationStrings[448], 2u); | |
2488 if ( dword_4E455C ) | |
2489 { | |
2490 pPlayers[uActiveCharacter]->PlaySound((int)v83, 0); | |
2491 dword_4E455C = 0; | |
2492 } | |
2493 } | |
2494 } | |
2495 v13 = _this->uAttributes; | |
2496 v14 = _this->uAttributes & 1; | |
2497 a2.y = _this->uAttributes & 1; | |
2498 if ( v13 & 2 ) | |
2499 { | |
2500 v79.DrawMessageBox(0); | |
2501 //v15 = &; | |
2502 pRenderer->Clip( | |
2503 v79.uFrameX + 12, | |
2504 v79.uFrameY + 12, | |
2505 v79.uFrameX + v79.uFrameWidth - 12, | |
2506 v79.uFrameY + v79.uFrameHeight - 12); | |
2507 v79.uFrameWidth -= 24; | |
2508 v79.uFrameHeight -= 12; | |
2509 v79.uFrameZ = v79.uFrameX + v79.uFrameWidth - 1; | |
2510 v79.uFrameW = v79.uFrameY + v79.uFrameHeight - 1; | |
2511 pRenderer->_4A6776( | |
2512 v79.uFrameX + v78, | |
2513 v81 + v79.uFrameY + 30, | |
2514 (Texture *)(v5 != -1 ? (int)((char *)pIcons_LOD->pTextures + v75) : 0)); | |
2515 if ( a2.y ) | |
2516 v16 = _this->GetIdentifiedName(); | |
2517 else | |
2518 v16 = (const char *)*((int *)v76 + 2); | |
2519 v79.DrawTitleText(pFontArrus, 0, 0xCu, var88, v16, 3u); | |
2520 v17 = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[32], &v79, 0, 0); | |
2521 v57 = 3; | |
2522 v52 = pGlobalTXT_LocalizationStrings[32]; | |
2523 goto LABEL_37; | |
2524 } | |
2525 if ( !v14 ) | |
2526 { | |
2527 v79.DrawMessageBox(0); | |
2528 v15 = pRenderer; | |
2529 pRenderer->Clip( | |
2530 v79.uFrameX + 12, | |
2531 v79.uFrameY + 12, | |
2532 v79.uFrameX + v79.uFrameWidth - 12, | |
2533 v79.uFrameY + v79.uFrameHeight - 12); | |
2534 v79.uFrameWidth -= 24; | |
2535 v79.uFrameHeight -= 12; | |
2536 v79.uFrameZ = v79.uFrameX + v79.uFrameWidth - 1; | |
2537 v79.uFrameW = v79.uFrameY + v79.uFrameHeight - 1; | |
2538 pRenderer->DrawTextureTransparent( | |
2539 v79.uFrameX + v78, | |
2540 v81 + v79.uFrameY + 30, | |
2541 (Texture *)(v5 != -1 ? (int)((char *)pIcons_LOD->pTextures + v75) : 0)); | |
2542 v79.DrawTitleText(pFontArrus, 0, 0xCu, var88, *((const char **)v76 + 2), 3u); | |
2543 v17 = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[232], &v79, 0, 0); | |
2544 v57 = 3; | |
2545 v52 = pGlobalTXT_LocalizationStrings[232]; | |
2546 LABEL_37: | |
2547 v18 = v17 >> 1; | |
2548 v19 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0x19u, 0x19u); | |
2549 v79.DrawTitleText(pFontArrus, 0x64u, ((signed int)v79.uFrameHeight >> 1) - v18, v19, v52, v57); | |
2550 goto LABEL_116; | |
2551 } | |
2552 sprintf(a1, pGlobalTXT_LocalizationStrings[463], *((int *)v3 + 2)); | |
2553 strcpy(Dest, ""); | |
2554 strcpy(v64, ""); | |
2555 v20 = v3[28]; | |
2556 if ( (unsigned __int8)v20 <= 1u ) | |
2557 { | |
2558 v58 = (unsigned __int8)v3[31]; | |
2559 v53 = (unsigned __int8)v3[30]; | |
2560 v48 = pGlobalTXT_LocalizationStrings[53]; | |
2561 v45 = (unsigned __int8)v3[32]; | |
2562 v43 = pGlobalTXT_LocalizationStrings[18]; | |
2563 } | |
2564 else | |
2565 { | |
2566 if ( v20 != 2 ) | |
2567 { | |
2568 if ( (unsigned __int8)v20 > 2u ) | |
2569 { | |
2570 if ( (unsigned __int8)v20 <= 0xBu ) | |
2571 { | |
2572 v21 = v3[30]; | |
2573 if ( v21 ) | |
2574 sprintf( | |
2575 Dest, | |
2576 "%s: +%d", | |
2577 pGlobalTXT_LocalizationStrings[11], | |
2578 (unsigned __int8)v21 + (unsigned __int8)v3[32]); | |
2579 } | |
2580 } | |
2581 goto LABEL_50; | |
2582 } | |
2583 v58 = (unsigned __int8)v3[31]; | |
2584 v53 = (unsigned __int8)v3[30]; | |
2585 v48 = pGlobalTXT_LocalizationStrings[53]; | |
2586 v45 = (unsigned __int8)v3[32]; | |
2587 v43 = pGlobalTXT_LocalizationStrings[203]; | |
2588 } | |
2589 sprintf(Dest, "%s: +%d %s: %dd%d", v43, v45, v48, v53, v58); | |
2590 v22 = v3[32]; | |
2591 if ( v22 ) | |
2592 { | |
2593 sprintf(Source, " +%d", (unsigned __int8)v22); | |
2594 strcat(Dest, Source); | |
2595 } | |
2596 LABEL_50: | |
2597 if ( v77 ) | |
2598 goto LABEL_65; | |
2599 v23 = v3[28]; | |
2600 if ( v23 == 14 ) | |
2601 { | |
2602 v24 = _this->_bonus_type; | |
2603 if ( v24 ) | |
2604 goto LABEL_56; | |
2605 LABEL_65: | |
2606 v79.uFrameWidth -= 12; | |
2607 a2.y = 3; | |
2608 v79.uFrameZ = v79.uFrameX + v79.uFrameWidth - 1; | |
2609 v79.uFrameW = v79.uFrameY + v79.uFrameHeight - 1; | |
2610 Str = (char *)(3 * (LOBYTE(pFontArrus->uFontHeight) + 8)); | |
2611 v83 = a1; | |
2612 do | |
2613 { | |
2614 if ( *v83 ) | |
2615 { | |
2616 v27 = v82->CalcTextHeight(v83, &v79, 100, 0); | |
2617 Str += v27 + 3; | |
2618 } | |
2619 v83 += 100; | |
2620 --a2.y; | |
2621 } | |
2622 while ( a2.y ); | |
2623 v28 = (const char *)*((int *)v3 + 3); | |
2624 if ( *v28 ) | |
2625 { | |
2626 v29 = pFontSmallnum->CalcTextHeight(v28, &v79, 100, 0); | |
2627 Str += v29; | |
2628 } | |
2629 v79.uFrameHeight = v73->uTextureHeight + v81 + 54; | |
2630 if ( (signed int)Str > (signed int)v79.uFrameHeight ) | |
2631 v79.uFrameHeight = (unsigned int)Str; | |
2632 if ( _this->uAttributes & 8 && (_this->uAdditionalValue || _this->_bonus_type) ) | |
2633 v79.uFrameHeight += LOBYTE(v82->uFontHeight); | |
2634 v83 = 0; | |
2635 if ( LOBYTE(pFontArrus->uFontHeight) ) | |
2636 { | |
2637 v79.uFrameWidth -= 24; | |
2638 v30 = (char *)LOBYTE(pFontArrus->uFontHeight); | |
2639 v31 = _this->GetIdentifiedName(); | |
2640 if ( pFontArrus->CalcTextHeight(v31, &v79, 0, 0) / (signed int)v30 ) | |
2641 v83 = v30; | |
2642 v79.uFrameWidth += 24; | |
2643 } | |
2644 v79.uFrameWidth += 12; | |
2645 v79.uFrameHeight += (unsigned int)v83; | |
2646 v79.uFrameW = v79.uFrameY + v79.uFrameHeight - 1; | |
2647 v79.uFrameZ = v79.uFrameX + v79.uFrameWidth - 1; | |
2648 v79.DrawMessageBox(0); | |
2649 v15 = pRenderer; | |
2650 pRenderer->Clip( | |
2651 v79.uFrameX + 12, | |
2652 v79.uFrameY + 12, | |
2653 v79.uFrameX + v79.uFrameWidth - 12, | |
2654 v79.uFrameY + v79.uFrameHeight - 12); | |
2655 v79.uFrameWidth -= 12; | |
2656 v32 = v73->uTextureHeight; | |
2657 v33 = v79.uFrameHeight; | |
2658 v79.uFrameHeight -= 12; | |
2659 v79.uFrameZ = v79.uFrameX + v79.uFrameWidth - 1; | |
2660 v79.uFrameW = v79.uFrameY + v79.uFrameHeight - 1; | |
2661 pRenderer->DrawTextureTransparent( | |
2662 v79.uFrameX + v78, | |
2663 v79.uFrameY + (signed int)(v33 - v32) / 2, | |
2664 (Texture *)(v5 != -1 ? (int)((char *)pIcons_LOD->pTextures + v75) : 0)); | |
2665 a2.y = 3; | |
2666 v34 = (int)(v83 + 35); | |
2667 Str = a1; | |
2668 do | |
2669 { | |
2670 if ( *Str ) | |
2671 { | |
2672 v79.DrawText(v82, 100, v34, 0, Str, 0, 0, 0); | |
2673 v34 += v82->CalcTextHeight(Str, &v79, 100, 0) + 3; | |
2674 } | |
2675 Str += 100; | |
2676 --a2.y; | |
2677 } | |
2678 while ( a2.y ); | |
2679 v35 = (const char *)*((int *)v76 + 3); | |
2680 if ( *v35 ) | |
2681 v79.DrawText(pFontSmallnum, 100, v34, 0, v35, 0, 0, 0); | |
2682 v79.uFrameX += 12; | |
2683 v79.uFrameWidth -= 24; | |
2684 v36 = _this->GetIdentifiedName(); | |
2685 v79.DrawTitleText(pFontArrus, 0, 0xCu, var88, v36, 3u); | |
2686 v79.uFrameWidth += 24; | |
2687 v79.uFrameX -= 12; | |
2688 if ( v77 ) | |
2689 { | |
2690 sprintf(pTmpBuf, "%s: %lu", pGlobalTXT_LocalizationStrings[465], v77); | |
2691 v40 = v82; | |
2692 v61 = 0; | |
2693 v56 = 0; | |
2694 v51 = 0; | |
2695 v47 = pTmpBuf; | |
2696 v44 = 0; | |
2697 v42 = v79.uFrameHeight - LOBYTE(v82->uFontHeight); | |
2698 v41 = 100; | |
2699 } | |
2700 else | |
2701 { | |
2702 if ( _this->uAttributes & 8 && (_this->uAdditionalValue || _this->_bonus_type) ) | |
2703 { | |
2704 sub_493F79((stru351 *)&v67, _this->uExpireTime - pParty->uTimePlayed); | |
2705 strcpy(pTmpBuf, "Duration:"); | |
2706 Str = (char *)(v72 - 1168); | |
2707 if ( v72 != 1168 ) | |
2708 { | |
2709 sprintf(v65, " %d:yr", v72 - 1168); | |
2710 strcat(pTmpBuf, v65); | |
2711 } | |
2712 if ( (((v71 || Str) && ((sprintf(v65, " %d:mo", v71), strcat(pTmpBuf, v65), v71) || Str) || v70) | |
2713 && ((sprintf(v65, " %d:dy", v70), strcat(pTmpBuf, v65), v71) || Str || v70) | |
2714 || v69) | |
2715 && ((sprintf(v65, " %d:hr", v69), strcat(pTmpBuf, v65), v71) || Str || v70 || v69) | |
2716 || v68 ) | |
2717 { | |
2718 sprintf(v65, " %d:mn", v68); | |
2719 strcat(pTmpBuf, v65); | |
2720 } | |
2721 v79.DrawText(v82, 100, v79.uFrameHeight - 2 * LOBYTE(v82->uFontHeight), 0, pTmpBuf, 0, 0, 0); | |
2722 } | |
2723 v37 = _this->GetValue(); | |
2724 sprintf(pTmpBuf, "%s: %lu", pGlobalTXT_LocalizationStrings[465], v37); | |
2725 v79.DrawText(v82, 100, v79.uFrameHeight - LOBYTE(v82->uFontHeight), 0, pTmpBuf, 0, 0, 0); | |
2726 v38 = _this->uAttributes; | |
2727 if ( BYTE1(v38) & 1 ) | |
2728 { | |
2729 v61 = 0; | |
2730 v56 = 0; | |
2731 v51 = 0; | |
2732 v47 = pGlobalTXT_LocalizationStrings[187]; | |
2733 } | |
2734 else | |
2735 { | |
2736 if ( !(BYTE1(v38) & 2) ) | |
2737 goto LABEL_116; | |
2738 v61 = 0; | |
2739 v56 = 0; | |
2740 v51 = 0; | |
2741 v47 = pGlobalTXT_LocalizationStrings[651]; | |
2742 } | |
2743 LOWORD(v38) = LOWORD(pRenderer->uTargetRMask); | |
2744 v44 = v38; | |
2745 v42 = v79.uFrameHeight - LOBYTE(v82->uFontHeight); | |
2746 v39 = v82->GetLineWidth(pTmpBuf); | |
2747 v40 = v82; | |
2748 v41 = v39 + 132; | |
2749 } | |
2750 v79.DrawText(v40, v41, v42, v44, v47, v51, v56, v61); | |
2751 LABEL_116: | |
2752 pRenderer->ResetClip(); | |
2753 if ( !areWeLoadingTexture ) | |
2754 { | |
2755 v73->Release(); | |
2756 pIcons_LOD->_40F9C5(); | |
2757 } | |
2758 return; | |
2759 } | |
2760 if ( v23 == 13 ) | |
2761 { | |
2762 v24 = pItemsTable->pItems[_this->uItemID].uDamageDice; | |
2763 LABEL_56: | |
2764 v59 = v24; | |
2765 v54 = pGlobalTXT_LocalizationStrings[449]; | |
2766 v49 = "%s: %d"; | |
2767 LABEL_64: | |
2768 sprintf(v64, v49, v54, v59); | |
2769 goto LABEL_65; | |
2770 } | |
2771 v25 = _this->_bonus_type; | |
2772 if ( v25 ) | |
2773 { | |
2774 v60 = _this->_bonus_strength; | |
2775 v55 = *((int *)&pItemsTable->pItems[799].uDamageMod + 5 * v25); | |
2776 v50 = pGlobalTXT_LocalizationStrings[210]; | |
2777 v46 = "%s: %s +%d"; | |
2778 } | |
2779 else | |
2780 { | |
2781 v26 = _this->uAdditionalValue; | |
2782 if ( !v26 ) | |
2783 { | |
2784 if ( _this->uNumCharges ) | |
2785 { | |
2786 v59 = _this->uNumCharges; | |
2787 v54 = pGlobalTXT_LocalizationStrings[464]; | |
2788 v49 = "%s: %lu"; | |
2789 goto LABEL_64; | |
2790 } | |
2791 goto LABEL_65; | |
2792 } | |
2793 v60 = _this->_bonus_strength; | |
2794 v55 = *((int *)&pItemsTable->pEnchantments[23].pName + 7 * v26); | |
2795 v50 = pGlobalTXT_LocalizationStrings[210]; | |
2796 v46 = "%s: %s"; | |
2797 } | |
2798 sprintf(v64, v46, v50, v55, v60); | |
2799 goto LABEL_65; | |
2800 } | |
2801 } | |
2802 // 4E455C: using guessed type int dword_4E455C; | |
2803 // 506128: using guessed type int areWeLoadingTexture; | |
2804 | |
2805 //----- (0041E360) -------------------------------------------------------- | |
2806 char *__fastcall MonsterPopup_Draw(unsigned int uActorID, GUIWindow *edx0) | |
2807 { | |
2808 unsigned int v2; // esi@1 | |
2809 Actor *v3; // esi@3 | |
2810 int v4; // eax@3 | |
2811 unsigned int v5; // ecx@3 | |
2812 NPCData *v6; // eax@3 | |
2813 unsigned __int16 v7; // cx@3 | |
2814 int v8; // eax@4 | |
2815 unsigned __int16 v9; // dx@4 | |
2816 SpriteFrame *v10; // edi@17 | |
2817 int v11; // esi@17 | |
2818 unsigned int v12; // ecx@17 | |
2819 Sprite *v13; // edi@18 | |
2820 int v14; // ecx@18 | |
2821 int v15; // edx@18 | |
2822 int v16; // edx@18 | |
2823 int v17; // eax@18 | |
2824 unsigned int v18; // ecx@19 | |
2825 unsigned int v19; // eax@21 | |
2826 char *v20; // esi@28 | |
2827 int v21; // edx@29 | |
2828 unsigned __int16 *v22; // ecx@29 | |
2829 int v23; // eax@29 | |
2830 int v24; // eax@32 | |
2831 int v25; // esi@32 | |
2832 char *v26; // edx@34 | |
2833 unsigned __int8 v27; // sf@36 | |
2834 unsigned __int8 v28; // of@36 | |
2835 int v29; // esi@40 | |
2836 char *v30; // ecx@40 | |
2837 int v31; // eax@40 | |
2838 int v32; // esi@43 | |
2839 unsigned __int16 v33; // ax@45 | |
2840 int v34; // edx@45 | |
2841 int v35; // eax@45 | |
2842 int v36; // eax@49 | |
2843 char *v37; // eax@52 | |
2844 int v38; // eax@55 | |
2845 unsigned __int16 v39; // ax@59 | |
2846 SpellBuff *v40; // eax@60 | |
2847 int v41; // edi@61 | |
2848 unsigned int v42; // eax@61 | |
2849 int v43; // eax@62 | |
2850 int v44; // eax@63 | |
2851 signed int v45; // edi@65 | |
2852 unsigned __int16 v46; // ax@73 | |
2853 Player *v47; // ecx@77 | |
2854 unsigned int v48; // eax@85 | |
2855 GUIFont *v49; // edi@90 | |
2856 int v50; // edi@90 | |
2857 SpellBuff *v51; // eax@91 | |
2858 char *v52; // ecx@98 | |
2859 char *v53; // ecx@101 | |
2860 char *v54; // ST0C_4@118 | |
2861 unsigned int v55; // eax@118 | |
2862 GUIFont *v56; // edi@124 | |
2863 unsigned __int8 v57; // al@128 | |
2864 int v58; // eax@132 | |
2865 Actor *v59; // ecx@133 | |
2866 unsigned __int8 v60; // dl@138 | |
2867 char *v61; // eax@145 | |
2868 char *v62; // eax@147 | |
2869 int v63; // eax@152 | |
2870 char *result; // eax@152 | |
2871 int v65; // eax@155 | |
2872 const char *v66; // [sp-10h] [bp-1FCh]@121 | |
2873 const char *v67; // [sp-10h] [bp-1FCh]@125 | |
2874 const char *v68; // [sp-10h] [bp-1FCh]@142 | |
2875 int v69; // [sp-Ch] [bp-1F8h]@121 | |
2876 char *v70; // [sp-Ch] [bp-1F8h]@125 | |
2877 char *v71; // [sp-Ch] [bp-1F8h]@142 | |
2878 char *v72; // [sp-8h] [bp-1F4h]@54 | |
2879 int v73; // [sp-8h] [bp-1F4h]@79 | |
2880 int v74; // [sp-8h] [bp-1F4h]@121 | |
2881 int v75; // [sp-8h] [bp-1F4h]@125 | |
2882 int v76; // [sp-8h] [bp-1F4h]@142 | |
2883 size_t v77; // [sp-4h] [bp-1F0h]@54 | |
2884 unsigned int v78; // [sp-4h] [bp-1F0h]@121 | |
2885 unsigned int v79; // [sp-4h] [bp-1F0h]@125 | |
2886 char *v80; // [sp-4h] [bp-1F0h]@142 | |
2887 char *v81; // [sp-4h] [bp-1F0h]@148 | |
2888 DDBLTFX Dst; // [sp+Ch] [bp-1E0h]@18 | |
2889 DDSURFACEDESC2 pDesc; // [sp+70h] [bp-17Ch]@18 | |
2890 RECT v84; // [sp+ECh] [bp-100h]@26 | |
2891 char *v85; // [sp+FCh] [bp-F0h]@145 | |
2892 char *v86; // [sp+100h] [bp-ECh]@145 | |
2893 char *v87; // [sp+104h] [bp-E8h]@145 | |
2894 char *v88; // [sp+108h] [bp-E4h]@145 | |
2895 char *v89; // [sp+10Ch] [bp-E0h]@145 | |
2896 char *v90; // [sp+110h] [bp-DCh]@145 | |
2897 char *v91; // [sp+114h] [bp-D8h]@145 | |
2898 char *v92; // [sp+118h] [bp-D4h]@145 | |
2899 char *v93; // [sp+11Ch] [bp-D0h]@145 | |
2900 char *v94; // [sp+120h] [bp-CCh]@145 | |
2901 char *v95; // [sp+124h] [bp-C8h]@127 | |
2902 char *v96; // [sp+128h] [bp-C4h]@127 | |
2903 char *v97; // [sp+12Ch] [bp-C0h]@127 | |
2904 char *v98; // [sp+130h] [bp-BCh]@127 | |
2905 char *v99; // [sp+134h] [bp-B8h]@127 | |
2906 char *v100; // [sp+138h] [bp-B4h]@127 | |
2907 char *v101; // [sp+13Ch] [bp-B0h]@127 | |
2908 char *v102; // [sp+140h] [bp-ACh]@127 | |
2909 char *v103; // [sp+144h] [bp-A8h]@127 | |
2910 char *v104; // [sp+148h] [bp-A4h]@127 | |
2911 char *v105; // [sp+14Ch] [bp-A0h]@127 | |
2912 RenderBillboardTransform_local0 v106; // [sp+150h] [bp-9Ch]@3 | |
2913 unsigned int v107; // [sp+1A0h] [bp-4Ch]@18 | |
2914 unsigned __int16 *v108; // [sp+1A4h] [bp-48h]@34 | |
2915 unsigned int v109; // [sp+1A8h] [bp-44h]@32 | |
2916 LPVOID v110; // [sp+1ACh] [bp-40h]@28 | |
2917 unsigned int v111; // [sp+1B0h] [bp-3Ch]@29 | |
2918 char **v112; // [sp+1B4h] [bp-38h]@3 | |
2919 IDirectDrawSurface *v222; // [sp+1B8h] [bp-34h]@18 | |
2920 unsigned __int8 v114; // [sp+1BFh] [bp-2Dh]@133 | |
2921 int v115; // [sp+1C0h] [bp-2Ch]@3 | |
2922 unsigned int v116; // [sp+1C4h] [bp-28h]@18 | |
2923 int i; // [sp+1C8h] [bp-24h]@18 | |
2924 Player *a2; // [sp+1CCh] [bp-20h]@28 | |
2925 int v119; // [sp+1D0h] [bp-1Ch]@18 | |
2926 SpellBuff *v120; // [sp+1D4h] [bp-18h]@18 | |
2927 Actor *v121; // [sp+1D8h] [bp-14h]@3 | |
2928 int a5; // [sp+1DCh] [bp-10h]@3 | |
2929 GUIWindow *a1; // [sp+1E0h] [bp-Ch]@1 | |
2930 int v124; // [sp+1E4h] [bp-8h]@18 | |
2931 char *a4; // [sp+1E8h] [bp-4h]@18 | |
2932 | |
2933 a1 = edx0; | |
2934 v2 = uActorID; | |
2935 | |
2936 static Actor pMonsterInfoUI_Doll; | |
2937 /*if ( !(bMonsterInfoUI_bDollInitialized & 1) ) | |
2938 { | |
2939 bMonsterInfoUI_bDollInitialized |= 1u; | |
2940 Actor::Actor(&pMonsterInfoUI_Doll); | |
2941 atexit(nullsub_3); | |
2942 }*/ | |
2943 v106.uParentBillboardID = -1; | |
2944 v3 = &pActors[v2]; | |
2945 v121 = v3; | |
2946 v4 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xFFu, 0x9Bu); | |
2947 v5 = v3->uNPC_ID; | |
2948 a5 = v4; | |
2949 v6 = GetNPCData(v5); | |
2950 v7 = v3->pMonsterInfo.uID; | |
2951 v112 = (char **)v6; | |
2952 v115 = byte_4E2B70[((signed __int16)v7 - 1) / 3] - 40; | |
2953 if ( v7 == pMonsterInfoUI_Doll.pMonsterInfo.uID ) | |
2954 { | |
2955 v9 = pMonsterInfoUI_Doll.uCurrentActionLength; | |
2956 } | |
2957 else | |
2958 { | |
2959 memcpy(&pMonsterInfoUI_Doll, v3, sizeof(pMonsterInfoUI_Doll)); | |
2960 pMonsterInfoUI_Doll.uCurrentActionAnimation = 7; | |
2961 pMonsterInfoUI_Doll.uCurrentActionTime = 0; | |
2962 v8 = rand(); | |
2963 v3 = v121; | |
2964 v9 = v8 % 256 + 128; | |
2965 pMonsterInfoUI_Doll.uCurrentActionLength = v8 % 256 + 128; | |
2966 } | |
2967 if ( (signed int)pMonsterInfoUI_Doll.uCurrentActionTime > (signed __int16)v9 ) | |
2968 { | |
2969 pMonsterInfoUI_Doll.uCurrentActionTime = 0; | |
2970 if ( pMonsterInfoUI_Doll.uCurrentActionAnimation == 7 || pMonsterInfoUI_Doll.uCurrentActionAnimation == 2 ) | |
2971 { | |
2972 pMonsterInfoUI_Doll.uCurrentActionAnimation = 0; | |
2973 pMonsterInfoUI_Doll.uCurrentActionLength = rand() % 128 + 128; | |
2974 } | |
2975 else | |
2976 { | |
2977 rand(); | |
2978 pMonsterInfoUI_Doll.uCurrentActionAnimation = 7; | |
2979 if ( (pMonsterInfoUI_Doll.pMonsterInfo.uID < 115 || pMonsterInfoUI_Doll.pMonsterInfo.uID > 186) | |
2980 && (pMonsterInfoUI_Doll.pMonsterInfo.uID < 232 || pMonsterInfoUI_Doll.pMonsterInfo.uID > 249) | |
2981 && rand() % 30 < 100 ) | |
2982 pMonsterInfoUI_Doll.uCurrentActionAnimation = 2; | |
2983 pMonsterInfoUI_Doll.uCurrentActionLength = 8 | |
2984 * pSpriteFrameTable->pSpriteSFrames[v3->pSpriteIDs[(signed __int16)pMonsterInfoUI_Doll.uCurrentActionAnimation]].uAnimLength; | |
2985 } | |
2986 } | |
2987 v10 = pSpriteFrameTable->GetFrame( | |
2988 v3->pSpriteIDs[(signed __int16)pMonsterInfoUI_Doll.uCurrentActionAnimation], | |
2989 pMonsterInfoUI_Doll.uCurrentActionTime); | |
2990 v11 = 40 * v10->pHwSpriteIDs[0] + 7218180; | |
2991 v106.pTarget = pRenderer->pTargetSurface; | |
2992 v106.pTargetZ = pRenderer->pActiveZBuffer; | |
2993 v106.uTargetPitch = pRenderer->uTargetSurfacePitch; | |
2994 v12 = a1->uFrameY + 52; | |
2995 v106.uViewportX = a1->uFrameX + 13; | |
2996 v106.uViewportY = v12; | |
2997 v106.uViewportW = v12 + 128; | |
2998 v106.uViewportZ = v106.uViewportX + 128; | |
2999 v106.uScreenSpaceX = (signed int)(v106.uViewportX + 128 + v106.uViewportX) / 2; | |
3000 v106.field_10 = 65536; | |
3001 v106.field_14 = 65536; | |
3002 v106.uScreenSpaceY = v115 + v12 + *(short *)(v11 + 18); | |
3003 v106.pPalette = PaletteManager::Get_Dark_or_Red_LUT(v10->uPaletteIndex, 0, 1); | |
3004 v106.sZValue = 0; | |
3005 v106.uFlags = 0; | |
3006 pRenderer->Clip_v2(0, 0, 0x27Fu, 0x1DFu); | |
3007 pRenderer->Line2D(v106.uViewportX - 1, v106.uViewportY - 1, v106.uViewportX + 129, v106.uViewportY - 1, a5); | |
3008 pRenderer->Line2D( | |
3009 v106.uViewportX + 129, | |
3010 v106.uViewportY - 1, | |
3011 v106.uViewportX + 129, | |
3012 v106.uViewportW + 1, | |
3013 a5); | |
3014 pRenderer->Line2D(v106.uViewportX + 129, v106.uViewportW + 1, v106.uViewportX - 1, v106.uViewportW + 1, a5); | |
3015 pRenderer->Line2D(v106.uViewportX - 1, v106.uViewportW + 1, v106.uViewportX - 1, v106.uViewportY - 1, a5); | |
3016 if ( pRenderer->pRenderD3D ) | |
3017 { | |
3018 v13 = &pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]]; | |
3019 v106.uScreenSpaceY = v115 + v106.uViewportY + v13->uBufferHeight; | |
3020 v222 = (IDirectDrawSurface *)v13->pTextureSurface; | |
3021 memset(&Dst, 0, 0x64u); | |
3022 Dst.dwSize = 100; | |
3023 Dst.dwFillColor = 0; | |
3024 memset(&pDesc, 0, 0x7Cu); | |
3025 pDesc.dwSize = 124; | |
3026 v222->GetSurfaceDesc((LPDDSURFACEDESC)&pDesc); | |
3027 v14 = v13->uBufferHeight; | |
3028 v120 = (SpellBuff *)v13->uBufferWidth; | |
3029 v107 = 0; | |
3030 v15 = v13->uAreaX; | |
3031 v119 = (signed int)v120 / 2; | |
3032 i = 0; | |
3033 a4 = (char *)(v106.uScreenSpaceX + v15 - (signed int)v120 / 2); | |
3034 v115 = v13->uAreaY; | |
3035 v16 = v13->uAreaWidth + (signed int)v120 / 2 + v15 - (int)v120; | |
3036 v124 = v106.uScreenSpaceY + v115 - v14; | |
3037 v17 = v13->uAreaHeight + v115 - v14; | |
3038 v116 = v106.uScreenSpaceX + v16; | |
3039 v119 = v106.uScreenSpaceY + v17; | |
3040 if ( (signed int)a4 < (signed int)v106.uViewportX ) | |
3041 { | |
3042 v18 = v106.uViewportX - (int)a4; | |
3043 a4 = (char *)v106.uViewportX; | |
3044 v107 = v18; | |
3045 } | |
3046 if ( v124 < (signed int)v106.uViewportY ) | |
3047 { | |
3048 v19 = v106.uViewportY - v124; | |
3049 v124 = v106.uViewportY; | |
3050 i = v19; | |
3051 } | |
3052 if ( (signed int)v116 > (signed int)v106.uViewportZ ) | |
3053 v116 = v106.uViewportZ; | |
3054 if ( v119 > (signed int)v106.uViewportW ) | |
3055 v119 = v106.uViewportW; | |
3056 pRenderer->FillRectFast( | |
3057 v106.uViewportX, | |
3058 v106.uViewportY, | |
3059 v106.uViewportZ - v106.uViewportX, | |
3060 v106.uViewportW - v106.uViewportY, | |
3061 pRenderer->uTargetBMask | pRenderer->uTargetGMask); | |
3062 pRenderer->FillRectFast( | |
3063 v106.uViewportX, | |
3064 v106.uViewportY, | |
3065 v106.uViewportZ - v106.uViewportX, | |
3066 v106.uViewportW - v106.uViewportY, | |
3067 pRenderer->uTargetBMask | pRenderer->uTargetGMask); | |
3068 v84.left = v106.uViewportX; | |
3069 v84.top = v106.uViewportY; | |
3070 v84.right = v106.uViewportZ; | |
3071 v84.bottom = v106.uViewportW; | |
3072 ErrD3D(pRenderer->pBackBuffer4->Blt(&v84, 0, 0, 16778240u, &Dst)); | |
3073 if ( pRenderer->uTargetGBits == 5 ) | |
3074 { | |
3075 memset(&pDesc, 0, 0x7Cu); | |
3076 pDesc.dwSize = 124; | |
3077 if ( !pRenderer->LockSurface_DDraw4((IDirectDrawSurface4 *)v222, &pDesc, 1u) ) | |
3078 goto LABEL_51; | |
3079 v20 = (char *)v124; | |
3080 v110 = pDesc.lpSurface; | |
3081 a2 = (Player *)v124; | |
3082 if ( v124 < v119 ) | |
3083 { | |
3084 v111 = 2 * pRenderer->uTargetSurfacePitch; | |
3085 v21 = (int)a4; | |
3086 v22 = &pRenderer->pTargetSurface[(int)&a4[v124 * pRenderer->uTargetSurfacePitch]]; | |
3087 v23 = i - v124; | |
3088 v120 = (SpellBuff *)&pRenderer->pTargetSurface[(int)&a4[v124 * pRenderer->uTargetSurfacePitch]]; | |
3089 v115 = i - v124; | |
3090 while ( 1 ) | |
3091 { | |
3092 v124 = v21; | |
3093 if ( v21 < (signed int)v116 ) | |
3094 { | |
3095 v24 = (int)&v20[v23]; | |
3096 v25 = v107 - v21; | |
3097 v109 = v24; | |
3098 for ( i = v107 - v21; ; v25 = i ) | |
3099 { | |
3100 v108 = (unsigned __int16 *)((pDesc.lPitch >> 1) * pDesc.dwHeight * v109 / v13->uAreaHeight); | |
3101 v26 = (char *)v108 + pDesc.dwWidth * (v25 + v124++) / v13->uAreaWidth; | |
3102 *v22 = *((short *)v110 + (int)v26); | |
3103 ++v22; | |
3104 if ( v124 >= (signed int)v116 ) | |
3105 break; | |
3106 } | |
3107 v23 = v115; | |
3108 } | |
3109 v22 = (unsigned __int16 *)((char *)v120 + v111); | |
3110 v20 = (char *)&a2->pConditions[0] + 1; | |
3111 v28 = __OFSUB__((int)&a2->pConditions[0] + 1, v119); | |
3112 v27 = (signed int)((char *)&a2->pConditions[0] + -v119 + 1) < 0; | |
3113 a2 = (Player *)((char *)a2 + 1); | |
3114 v120 = (SpellBuff *)((char *)v120 + v111); | |
3115 if ( !(v27 ^ v28) ) | |
3116 break; | |
3117 v21 = (int)a4; | |
3118 } | |
3119 } | |
3120 goto LABEL_37; | |
3121 } | |
3122 memset(&pDesc, 0, 0x7Cu); | |
3123 pDesc.dwSize = 124; | |
3124 if ( pRenderer->LockSurface_DDraw4((IDirectDrawSurface4 *)v222, &pDesc, 1u) ) | |
3125 { | |
3126 v108 = (unsigned __int16 *)pDesc.lpSurface; | |
3127 a2 = (Player *)v124; | |
3128 if ( v124 < v119 ) | |
3129 { | |
3130 v109 = 2 * pRenderer->uTargetSurfacePitch; | |
3131 v29 = (int)a4; | |
3132 v30 = (char *)&pRenderer->pTargetSurface[(int)&a4[v124 * pRenderer->uTargetSurfacePitch]]; | |
3133 v31 = i - v124; | |
3134 v120 = (SpellBuff *)&pRenderer->pTargetSurface[(int)&a4[v124 * pRenderer->uTargetSurfacePitch]]; | |
3135 v115 = i - v124; | |
3136 while ( 1 ) | |
3137 { | |
3138 v124 = v29; | |
3139 if ( v29 < (signed int)v116 ) | |
3140 { | |
3141 v32 = v107 - (int)a4; | |
3142 v111 = (unsigned int)((char *)a2 + v31); | |
3143 for ( i = v107 - (int)a4; ; v32 = i ) | |
3144 { | |
3145 v110 = (LPVOID)((pDesc.lPitch >> 1) * pDesc.dwHeight * v111 / v13->uAreaHeight); | |
3146 v33 = v108[(int)((char *)v110 + pDesc.dwWidth * (v32 + v124) / v13->uAreaWidth)]; | |
3147 v34 = v33 & 0x1F | 2 | |
3148 * (unsigned __int16)(v108[(int)((char *)v110 | |
3149 + pDesc.dwWidth * (v32 + v124++) / v13->uAreaWidth)] & 0xFFE0); | |
3150 v35 = v124; | |
3151 *(short *)v30 = v34; | |
3152 v30 += 2; | |
3153 if ( v35 >= (signed int)v116 ) | |
3154 break; | |
3155 } | |
3156 v31 = v115; | |
3157 } | |
3158 a2 = (Player *)((char *)a2 + 1); | |
3159 v30 = (char *)v120 + v109; | |
3160 v120 = (SpellBuff *)((char *)v120 + v109); | |
3161 if ( (signed int)a2 >= v119 ) | |
3162 break; | |
3163 v29 = (int)a4; | |
3164 } | |
3165 } | |
3166 LABEL_37: | |
3167 v222->Unlock(0); | |
3168 goto LABEL_51; | |
3169 } | |
3170 } | |
3171 else | |
3172 { | |
3173 pRenderer->FillRectFast( | |
3174 v106.uViewportX, | |
3175 v106.uViewportY, | |
3176 v106.uViewportZ - v106.uViewportX, | |
3177 v106.uViewportW - v106.uViewportY, | |
3178 0); | |
3179 v36 = v10->pHwSpriteIDs[0]; | |
3180 if ( v36 >= 0 ) | |
3181 pSprites_LOD->pSpriteHeaders[v36]._4ACC38(&v106, 0); | |
3182 } | |
3183 LABEL_51: | |
3184 if ( v121->uNPC_ID ) | |
3185 { | |
3186 v37 = v112[6]; | |
3187 if ( v37 ) | |
3188 { | |
3189 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[429], *v112, aNPCProfessionNames[(signed int)v37]); | |
3190 goto LABEL_59; | |
3191 } | |
3192 v77 = 2000; | |
3193 v72 = *v112; | |
3194 } | |
3195 else | |
3196 { | |
3197 v38 = v121->dword_000334_unique_name; | |
3198 v77 = 2000; | |
3199 if ( v38 ) | |
3200 v72 = (char *)*(&pMonsterStats->pPlacement.uNumStrings + v38); | |
3201 else | |
3202 v72 = pMonsterStats->pInfos[v121->pMonsterInfo.uID].pName; | |
3203 } | |
3204 strncpy(pTmpBuf, v72, v77); | |
3205 LABEL_59: | |
3206 v39 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); | |
3207 a1->DrawTitleText(pFontComic, 0, 0xCu, v39, pTmpBuf, 3u); | |
3208 Actor::DrawHealthBar(v121, a1); | |
3209 v119 = 0; | |
3210 pMonsterInfoUI_Doll.uCurrentActionTime += pMiscTimer->uTimeElapsed; | |
3211 v115 = 0; | |
3212 v116 = 0; | |
3213 i = 0; | |
3214 v112 = 0; | |
3215 if ( !uActiveCharacter ) | |
3216 { | |
3217 v45 = 1; | |
3218 goto LABEL_84; | |
3219 } | |
3220 LOBYTE(v40) = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID); | |
3221 v120 = v40; | |
3222 if ( !v40 ) | |
3223 goto LABEL_72; | |
3224 v41 = (unsigned __int8)v40 & 0x3F; | |
3225 v42 = SkillToMastery((unsigned __int16)v40) - 1; | |
3226 if ( !v42 ) | |
3227 { | |
3228 if ( v41 + 10 >= v121->pMonsterInfo.uLevel ) | |
3229 { | |
3230 v45 = 1; | |
3231 v119 = 1; | |
3232 goto LABEL_73; | |
3233 } | |
3234 goto LABEL_72; | |
3235 } | |
3236 v43 = v42 - 1; | |
3237 if ( !v43 ) | |
3238 { | |
3239 if ( 2 * v41 + 10 >= v121->pMonsterInfo.uLevel ) | |
3240 { | |
3241 v45 = 1; | |
3242 v119 = 1; | |
3243 v116 = 1; | |
3244 goto LABEL_73; | |
3245 } | |
3246 goto LABEL_72; | |
3247 } | |
3248 v44 = v43 - 1; | |
3249 if ( !v44 ) | |
3250 { | |
3251 if ( 3 * v41 + 10 >= v121->pMonsterInfo.uLevel ) | |
3252 { | |
3253 v45 = 1; | |
3254 v119 = 1; | |
3255 v116 = 1; | |
3256 i = 1; | |
3257 goto LABEL_73; | |
3258 } | |
3259 LABEL_72: | |
3260 v45 = 1; | |
3261 goto LABEL_73; | |
3262 } | |
3263 if ( v44 != 1 ) | |
3264 goto LABEL_72; | |
3265 v45 = 1; | |
3266 v119 = 1; | |
3267 v116 = 1; | |
3268 i = 1; | |
3269 v112 = (char **)1; | |
3270 LABEL_73: | |
3271 v46 = v121->uAIState; | |
3272 if ( v46 != 5 && v46 != 4 && !dword_507BF0_is_there_popup_onscreen && v120 ) | |
3273 { | |
3274 v47 = pPlayers[uActiveCharacter]; | |
3275 if ( v119 | v116 | i | (unsigned int)v112 ) | |
3276 { | |
3277 if ( v121->pMonsterInfo.uLevel >= v47->uLevel - 5 ) | |
3278 v73 = 105; | |
3279 else | |
3280 v73 = 104; | |
3281 } | |
3282 else | |
3283 { | |
3284 v73 = 106; | |
3285 } | |
3286 v47->PlaySound(v73, 0); | |
3287 } | |
3288 LABEL_84: | |
3289 a2 = pParty->pPlayers; | |
3290 do | |
3291 { | |
3292 LOBYTE(v48) = a2->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID); | |
3293 v111 = v48; | |
3294 v120 = (SpellBuff *)138; | |
3295 do | |
3296 { | |
3297 if ( (signed int)SkillToMastery(v111) >= 3 ) | |
3298 v115 = v45; | |
3299 v120 = (SpellBuff *)((char *)v120 - 1); | |
3300 } | |
3301 while ( v120 ); | |
3302 ++a2; | |
3303 } | |
3304 while ( (signed int)a2 < (signed int)pParty->pHirelings ); | |
3305 v49 = pFontSmallnum; | |
3306 a2 = (Player *)pFontSmallnum; | |
3307 a1->DrawText(pFontSmallnum, 12, 196, a5, pGlobalTXT_LocalizationStrings[631], 0, 0, 0); | |
3308 v50 = LOBYTE(v49->uFontHeight) + 193; | |
3309 if ( !v115 ) | |
3310 { | |
3311 v78 = 0; | |
3312 v74 = 0; | |
3313 v69 = 0; | |
3314 v66 = pGlobalTXT_LocalizationStrings[630]; | |
3315 goto LABEL_123; | |
3316 } | |
3317 a4 = 0; | |
3318 v51 = &v121->pActorBuffs[1]; | |
3319 v222 = 0; | |
3320 v120 = &v121->pActorBuffs[1]; | |
3321 do | |
3322 { | |
3323 if ( (signed __int64)v51->uExpireTime > 0 ) | |
3324 { | |
3325 switch ( (int)v51 ) | |
3326 { | |
3327 case 0u: | |
3328 v124 = 60; | |
3329 a4 = pGlobalTXT_LocalizationStrings[591]; | |
3330 break; | |
3331 case 1u: | |
3332 v124 = 82; | |
3333 a4 = pGlobalTXT_LocalizationStrings[649]; | |
3334 break; | |
3335 case 2u: | |
3336 v124 = 92; | |
3337 a4 = pGlobalTXT_LocalizationStrings[592]; | |
3338 break; | |
3339 case 3u: | |
3340 v124 = 63; | |
3341 a4 = pGlobalTXT_LocalizationStrings[4]; | |
3342 break; | |
3343 case 4u: | |
3344 v52 = pGlobalTXT_LocalizationStrings[220]; | |
3345 goto LABEL_100; | |
3346 case 5u: | |
3347 v52 = pGlobalTXT_LocalizationStrings[162]; | |
3348 LABEL_100: | |
3349 a4 = v52; | |
3350 v124 = 81; | |
3351 break; | |
3352 case 6u: | |
3353 v53 = pGlobalTXT_LocalizationStrings[593]; | |
3354 v124 = 35; | |
3355 goto LABEL_103; | |
3356 case 8u: | |
3357 v53 = pGlobalTXT_LocalizationStrings[608]; | |
3358 v124 = 62; | |
3359 LABEL_103: | |
3360 a4 = v53; | |
3361 break; | |
3362 case 7u: | |
3363 case 9u: | |
3364 a4 = 0; | |
3365 v124 = 0; | |
3366 goto LABEL_119; | |
3367 case 0xAu: | |
3368 v124 = 47; | |
3369 a4 = pGlobalTXT_LocalizationStrings[221]; | |
3370 break; | |
3371 case 0xBu: | |
3372 v124 = 66; | |
3373 a4 = pGlobalTXT_LocalizationStrings[607]; | |
3374 break; | |
3375 case 0xCu: | |
3376 v124 = 85; | |
3377 a4 = pGlobalTXT_LocalizationStrings[610]; | |
3378 break; | |
3379 case 0xDu: | |
3380 v124 = 86; | |
3381 a4 = pGlobalTXT_LocalizationStrings[609]; | |
3382 break; | |
3383 case 0xEu: | |
3384 v124 = 17; | |
3385 a4 = pGlobalTXT_LocalizationStrings[279]; | |
3386 break; | |
3387 case 0xFu: | |
3388 v124 = 38; | |
3389 a4 = pGlobalTXT_LocalizationStrings[442]; | |
3390 break; | |
3391 case 0x10u: | |
3392 v124 = 46; | |
3393 a4 = pGlobalTXT_LocalizationStrings[443]; | |
3394 break; | |
3395 case 0x11u: | |
3396 v124 = 51; | |
3397 a4 = pGlobalTXT_LocalizationStrings[440]; | |
3398 break; | |
3399 case 0x12u: | |
3400 v124 = 5; | |
3401 a4 = pGlobalTXT_LocalizationStrings[441]; | |
3402 break; | |
3403 case 0x13u: | |
3404 v124 = 95; | |
3405 a4 = pGlobalTXT_LocalizationStrings[229]; | |
3406 break; | |
3407 case 0x14u: | |
3408 v124 = 73; | |
3409 a4 = pGlobalTXT_LocalizationStrings[228]; | |
3410 break; | |
3411 default: | |
3412 a4 = 0; | |
3413 break; | |
3414 } | |
3415 if ( a4 ) | |
3416 { | |
3417 v54 = a4; | |
3418 v55 = GetSpellColor(v124); | |
3419 a1->DrawText((GUIFont *)a2, 28, v50, v55, v54, 0, 0, 0); | |
3420 v50 = v50 + BYTE5(a2->pConditions[0]) - 3; | |
3421 v51 = v120; | |
3422 } | |
3423 } | |
3424 LABEL_119: | |
3425 ++v51; | |
3426 v222 = (IDirectDrawSurface *)((char *)v222 + 1); | |
3427 v120 = v51; | |
3428 | |
3429 __debugbreak(); // fix condition | |
3430 } | |
3431 //while ( (signed int)((char *)&v222->lpVtbl + 1) < 22 ); | |
3432 while (true); | |
3433 if ( !a4 ) | |
3434 { | |
3435 v78 = 0; | |
3436 v74 = 0; | |
3437 v69 = 0; | |
3438 v66 = pGlobalTXT_LocalizationStrings[153]; | |
3439 LABEL_123: | |
3440 a1->DrawText((GUIFont *)a2, 28, v50, a5, v66, v69, v74, v78); | |
3441 } | |
3442 v56 = pFontSmallnum; | |
3443 a4 = (char *)v106.uViewportY; | |
3444 if ( v119 ) | |
3445 { | |
3446 sprintf(pTmpBuf, "%s", pGlobalTXT_LocalizationStrings[108], 0, v121->pMonsterInfo.uHP); | |
3447 a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); | |
3448 a4 = &a4[LOBYTE(v56->uFontHeight) - 3]; | |
3449 v79 = v121->pMonsterInfo.uAC; | |
3450 v75 = 0; | |
3451 v70 = pGlobalTXT_LocalizationStrings[12]; | |
3452 v67 = "%s"; | |
3453 } | |
3454 else | |
3455 { | |
3456 sprintf(pTmpBuf, "%s", pGlobalTXT_LocalizationStrings[108], 0, pGlobalTXT_LocalizationStrings[630]); | |
3457 a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); | |
3458 v79 = (unsigned int)pGlobalTXT_LocalizationStrings[630]; | |
3459 v75 = 0; | |
3460 v70 = pGlobalTXT_LocalizationStrings[12]; | |
3461 a4 = &a4[LOBYTE(v56->uFontHeight) - 3]; | |
3462 v67 = "%s"; | |
3463 } | |
3464 sprintf(pTmpBuf, v67, v70, v75, v79); | |
3465 a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); | |
3466 a4 = &a4[LOBYTE(v56->uFontHeight) - 6] + LOBYTE(v56->uFontHeight); | |
3467 v95 = pGlobalTXT_LocalizationStrings[87]; | |
3468 v96 = pGlobalTXT_LocalizationStrings[6]; | |
3469 v97 = pGlobalTXT_LocalizationStrings[240]; | |
3470 v98 = pGlobalTXT_LocalizationStrings[70]; | |
3471 v99 = pGlobalTXT_LocalizationStrings[624]; | |
3472 v100 = pGlobalTXT_LocalizationStrings[138]; | |
3473 v101 = pGlobalTXT_LocalizationStrings[214]; | |
3474 v102 = pGlobalTXT_LocalizationStrings[142]; | |
3475 v103 = pGlobalTXT_LocalizationStrings[29]; | |
3476 v104 = pGlobalTXT_LocalizationStrings[133]; | |
3477 v105 = pGlobalTXT_LocalizationStrings[54]; | |
3478 if ( v116 ) | |
3479 { | |
3480 sprintf(pTmpBuf, "%s", pGlobalTXT_LocalizationStrings[18], 0, (&v95)[4 * v121->pMonsterInfo.uAttack1Type]); | |
3481 a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); | |
3482 a4 = &a4[LOBYTE(v56->uFontHeight) - 3]; | |
3483 v57 = v121->pMonsterInfo.uAttack1DamageBonus; | |
3484 if ( v57 ) | |
3485 sprintf( | |
3486 pTmpBuf, | |
3487 "%s", | |
3488 pGlobalTXT_LocalizationStrings[53], | |
3489 0, | |
3490 v121->pMonsterInfo.uAttack1DamageDiceRolls, | |
3491 v121->pMonsterInfo.uAttack1DamageDiceSides, | |
3492 v57); | |
3493 else | |
3494 sprintf( | |
3495 pTmpBuf, | |
3496 "%s", | |
3497 pGlobalTXT_LocalizationStrings[53], | |
3498 0, | |
3499 v121->pMonsterInfo.uAttack1DamageDiceRolls, | |
3500 v121->pMonsterInfo.uAttack1DamageDiceSides); | |
3501 } | |
3502 else | |
3503 { | |
3504 sprintf(pTmpBuf, "%s", pGlobalTXT_LocalizationStrings[18], 0, pGlobalTXT_LocalizationStrings[630]); | |
3505 a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); | |
3506 a4 = &a4[LOBYTE(v56->uFontHeight) - 3]; | |
3507 sprintf(pTmpBuf, "%s", pGlobalTXT_LocalizationStrings[53], 0, pGlobalTXT_LocalizationStrings[630]); | |
3508 } | |
3509 a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); | |
3510 v58 = LOBYTE(v56->uFontHeight); | |
3511 a4 = &a4[v58 - 6] + v58; | |
3512 if ( !i ) | |
3513 { | |
3514 v80 = pGlobalTXT_LocalizationStrings[630]; | |
3515 v76 = 0; | |
3516 v71 = pGlobalTXT_LocalizationStrings[628]; | |
3517 v68 = "%s"; | |
3518 goto LABEL_144; | |
3519 } | |
3520 v120 = (SpellBuff *)pGlobalTXT_LocalizationStrings[628]; | |
3521 v59 = v121; | |
3522 v114 = v121->pMonsterInfo.uSpell1ID; | |
3523 if ( v114 && v121->pMonsterInfo.uSpell2ID ) | |
3524 v120 = (SpellBuff *)pGlobalTXT_LocalizationStrings[629]; | |
3525 if ( v114 ) | |
3526 { | |
3527 sprintf(pTmpBuf, "%s", v120, 0, pSpellStats->pInfos[v114].pShortName); | |
3528 a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); | |
3529 v58 = LOBYTE(v56->uFontHeight); | |
3530 a4 = &a4[v58 - 3]; | |
3531 v59 = v121; | |
3532 } | |
3533 v60 = v59->pMonsterInfo.uSpell2ID; | |
3534 if ( v60 ) | |
3535 { | |
3536 __debugbreak(); | |
3537 const char *fmt = "\xC\x25\x30\x35\x75\x9\x30\x36\x30\x25\x73\n"; | |
3538 sprintf(pTmpBuf, fmt, 0, pSpellStats->pInfos[v60].pShortName); | |
3539 a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); | |
3540 v58 = LOBYTE(v56->uFontHeight); | |
3541 a4 = &a4[v58 - 3]; | |
3542 v59 = v121; | |
3543 } | |
3544 if ( !v59->pMonsterInfo.uSpell1ID && !v59->pMonsterInfo.uSpell2ID ) | |
3545 { | |
3546 v80 = pGlobalTXT_LocalizationStrings[153]; | |
3547 v76 = 0; | |
3548 v71 = pGlobalTXT_LocalizationStrings[628]; | |
3549 v68 = "%s"; | |
3550 LABEL_144: | |
3551 sprintf(pTmpBuf, v68, v71, v76, v80); | |
3552 a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); | |
3553 v58 = LOBYTE(v56->uFontHeight); | |
3554 a4 = &a4[v58 - 3]; | |
3555 } | |
3556 a4 = &a4[v58 - 3]; | |
3557 a1->DrawText(v56, 150, (int)a4, a5, pGlobalTXT_LocalizationStrings[626], 0, 0, 0); | |
3558 a4 = &a4[LOBYTE(v56->uFontHeight) - 3]; | |
3559 v85 = pGlobalTXT_LocalizationStrings[87]; | |
3560 v86 = pGlobalTXT_LocalizationStrings[6]; | |
3561 v87 = pGlobalTXT_LocalizationStrings[240]; | |
3562 v88 = pGlobalTXT_LocalizationStrings[70]; | |
3563 v89 = pGlobalTXT_LocalizationStrings[142]; | |
3564 v90 = pGlobalTXT_LocalizationStrings[214]; | |
3565 v91 = pGlobalTXT_LocalizationStrings[29]; | |
3566 v92 = pGlobalTXT_LocalizationStrings[133]; | |
3567 v93 = pGlobalTXT_LocalizationStrings[54]; | |
3568 v94 = pGlobalTXT_LocalizationStrings[624]; | |
3569 v96 = (char *)v121->pMonsterInfo.uResFire; | |
3570 v97 = (char *)v121->pMonsterInfo.uResAir; | |
3571 v98 = (char *)v121->pMonsterInfo.uResWater; | |
3572 v99 = (char *)v121->pMonsterInfo.uResEarth; | |
3573 v100 = (char *)v121->pMonsterInfo.uResMind; | |
3574 v101 = (char *)v121->pMonsterInfo.uResSpirit; | |
3575 v102 = (char *)v121->pMonsterInfo.uResBody; | |
3576 v103 = (char *)v121->pMonsterInfo.uResLight; | |
3577 v61 = (char *)v121->pMonsterInfo.uResPhysical; | |
3578 v104 = (char *)v121->pMonsterInfo.uResDark; | |
3579 v105 = v61; | |
3580 if ( v112 ) | |
3581 { | |
3582 v124 = 0; | |
3583 do | |
3584 { | |
3585 v62 = (&v96)[v124]; | |
3586 if ( v62 == (char *)200 ) | |
3587 { | |
3588 v81 = pGlobalTXT_LocalizationStrings[625]; | |
3589 } | |
3590 else | |
3591 { | |
3592 if ( v62 ) | |
3593 v81 = pGlobalTXT_LocalizationStrings[627]; | |
3594 else | |
3595 v81 = pGlobalTXT_LocalizationStrings[153]; | |
3596 } | |
3597 sprintf(pTmpBuf, "%s", (&v85)[v124], 0, v81); | |
3598 a1->DrawText(v56, 170, (int)a4, a5, pTmpBuf, 0, 0, 0); | |
3599 v63 = LOBYTE(v56->uFontHeight); | |
3600 v124 += 4; | |
3601 result = &a4[v63 - 3]; | |
3602 a4 = result; | |
3603 } | |
3604 while ( v124 < 40 ); | |
3605 } | |
3606 else | |
3607 { | |
3608 i = 0; | |
3609 do | |
3610 { | |
3611 sprintf(pTmpBuf, "%s", (&v85)[4 * i], 0, pGlobalTXT_LocalizationStrings[630]); | |
3612 a1->DrawText(v56, 170, (int)a4, a5, pTmpBuf, 0, 0, 0); | |
3613 v65 = LOBYTE(v56->uFontHeight); | |
3614 ++i; | |
3615 result = &a4[v65 - 3]; | |
3616 a4 = result; | |
3617 } | |
3618 while ( i < 10 ); | |
3619 } | |
3620 if ( (signed __int64)pParty->pPartyBuffs[3].uExpireTime > 0 ) | |
3621 { | |
3622 sprintf(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[650], v121->sCurrentHP); | |
3623 pFontSmallnum->GetLineWidth(pTmpBuf); | |
3624 result = a1->DrawTitleText( | |
3625 pFontSmallnum, | |
3626 0, | |
3627 a1->uFrameHeight - LOBYTE(pFontSmallnum->uFontHeight) - 12, | |
3628 0, | |
3629 pTmpBuf, | |
3630 3u); | |
3631 } | |
3632 return result; | |
3633 } | |
3634 | |
3635 | |
3636 | |
3637 //----- (0041F54A) -------------------------------------------------------- | |
3638 void __cdecl LoadActualSkyFrame() | |
3639 { | |
3640 if ( pTexture_RestUI_CurrentSkyFrame ) | |
3641 pTexture_RestUI_CurrentSkyFrame->Release(); | |
3642 if ( pTexture_RestUI_CurrentHourglassFrame ) | |
3643 pTexture_RestUI_CurrentHourglassFrame->Release(); | |
3644 pIcons_LOD->_40F9C5(); | |
3645 sprintf(pTmpBuf, "TERRA%03d", pParty->uCurrentMinute / 6 + 10 * pParty->uCurrentHour); | |
3646 pTexture_RestUI_CurrentSkyFrame = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pTmpBuf, TEXTURE_16BIT_PALETTE)]; | |
3647 } | |
3648 | |
3649 //----- (0041F5BE) -------------------------------------------------------- | |
3650 void __cdecl Sleep6Hours() | |
3651 { | |
3652 if ( _506F18_num_hours_to_sleep < 6 ) | |
3653 { | |
3654 pParty->pPlayers[3].pConditions[2] = 0i64; | |
3655 pParty->pPlayers[2].pConditions[2] = 0i64; | |
3656 pParty->pPlayers[1].pConditions[2] = 0i64; | |
3657 pParty->pPlayers[0].pConditions[2] = 0i64; | |
3658 if ( _506F18_num_hours_to_sleep ) | |
3659 { | |
3660 Rest(_506F18_num_hours_to_sleep); | |
3661 _506F18_num_hours_to_sleep = 0; | |
3662 LoadActualSkyFrame(); | |
3663 } | |
3664 if ( dword_506F14 == 2 ) | |
3665 { | |
3666 pGUIWindow_CurrentMenu->Release(); | |
3667 pEventTimer->Resume(); | |
3668 if ( pTexture_RestUI_CurrentSkyFrame ) | |
3669 pTexture_RestUI_CurrentSkyFrame->Release(); | |
3670 if ( pTexture_RestUI_CurrentHourglassFrame ) | |
3671 pTexture_RestUI_CurrentHourglassFrame->Release(); | |
3672 pTexture_RestUI_CurrentHourglassFrame = 0; | |
3673 pTexture_RestUI_CurrentSkyFrame = 0; | |
3674 pIcons_LOD->_4114F2(); | |
3675 pIcons_LOD->_40F9C5(); | |
3676 pCurrentScreen = 0; | |
3677 viewparams->bRedrawGameUI = 1; | |
3678 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
3679 { | |
3680 pOutdoor->UpdateSunlightVectors(); | |
3681 pOutdoor->UpdateFog(); | |
3682 } | |
3683 } | |
3684 dword_506F14 = 0; | |
3685 } | |
3686 else | |
3687 { | |
3688 Rest(6u); | |
3689 _506F18_num_hours_to_sleep -= 6; | |
3690 LoadActualSkyFrame(); | |
3691 } | |
3692 viewparams->bRedrawGameUI = 1; | |
3693 } | |
3694 | |
3695 //----- (0041F6C1) -------------------------------------------------------- | |
3696 void __cdecl RestUI_Initialize() | |
3697 { | |
89 | 3698 Player *v0; // eax@10 |
0 | 3699 |
3700 if ( !dword_506F14 ) | |
3701 pAudioPlayer->StopChannels(-1, -1); | |
3702 if ( pCurrentScreen ) | |
3703 { | |
3704 pGUIWindow_CurrentMenu->Release(); | |
3705 pCurrentScreen = 0; | |
3706 viewparams->bRedrawGameUI = 1; | |
3707 } | |
3708 pEventTimer->Pause(); | |
3709 if ( dword_506F14 != 2 ) | |
3710 GUIWindow::Create(518u, 450u, 0, 0, (enum WindowType)90, (int)pBtn_Rest, 0); | |
3711 _506F18_num_hours_to_sleep = 0; | |
3712 dword_506F14 = 0; | |
3713 uRestUI_FoodRequiredToRest = 2; | |
3714 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
3715 uRestUI_FoodRequiredToRest = pOutdoor->GetNumFoodRequiredToRestInCurrentPos( | |
3716 pParty->vPosition.x, | |
3717 pParty->vPosition.y, | |
3718 pParty->vPosition.z); | |
3719 if ( sub_476387() ) | |
3720 { | |
89 | 3721 v0 = pParty->pPlayers;//[0].uClass; |
3722 while ( v0 <= &pParty->pPlayers[3] ) | |
3723 { | |
3724 ++v0; | |
3725 if ( v0 > &pParty->pPlayers[3] ) | |
3726 break; | |
3727 } | |
3728 if(v0->uClass == 31) | |
3729 ++uRestUI_FoodRequiredToRest; | |
3730 } | |
0 | 3731 if ( CheckHiredNPCSpeciality(0x1Du) ) |
3732 --uRestUI_FoodRequiredToRest; | |
3733 if ( CheckHiredNPCSpeciality(0x1Eu) ) | |
3734 uRestUI_FoodRequiredToRest -= 2; | |
3735 if ( CheckHiredNPCSpeciality(0x30u) ) | |
3736 --uRestUI_FoodRequiredToRest; | |
3737 if ( uRestUI_FoodRequiredToRest < 1 ) | |
3738 uRestUI_FoodRequiredToRest = 1; | |
3739 if ( !_strcmpi(pCurrentMapName, "d29.blv") && (unsigned __int16)_449B57_test_bit(pParty->_award_bits, 98) ) | |
3740 uRestUI_FoodRequiredToRest = 0; | |
3741 ++pIcons_LOD->uTexturePacksCount; | |
3742 if ( !pIcons_LOD->uNumPrevLoadedFiles ) | |
3743 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | |
3744 pCurrentScreen = 5; | |
3745 _507CD4_RestUI_hourglass_anim_controller = 0; | |
3746 uTextureID_RestUI_restmain = pIcons_LOD->LoadTexture("restmain", TEXTURE_16BIT_PALETTE); | |
3747 uTextureID_RestUI_restb1 = pIcons_LOD->LoadTexture("restb1", TEXTURE_16BIT_PALETTE); | |
3748 uTextureID_RestUI_restb2 = pIcons_LOD->LoadTexture("restb2", TEXTURE_16BIT_PALETTE); | |
3749 uTextureID_RestUI_restb3 = pIcons_LOD->LoadTexture("restb3", TEXTURE_16BIT_PALETTE); | |
3750 uTextureID_RestUI_restb4 = pIcons_LOD->LoadTexture("restb4", TEXTURE_16BIT_PALETTE); | |
3751 uTextureID_RestUI_restexit = pIcons_LOD->LoadTexture("restexit", TEXTURE_16BIT_PALETTE); | |
3752 LoadActualSkyFrame(); | |
3753 pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640u, 480u, (enum WindowType)16, 0, 0); | |
3754 pButton_RestUI_Exit = pGUIWindow_CurrentMenu->CreateButton( | |
3755 280u, | |
3756 297u, | |
3757 154u, | |
3758 37u, | |
3759 1, | |
3760 0, | |
3761 0xA7u, | |
3762 0, | |
3763 0, | |
3764 "", | |
3765 (Texture *)(uTextureID_RestUI_restexit != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_RestUI_restexit] : 0), | |
3766 0); | |
3767 pButton_RestUI_Main = pGUIWindow_CurrentMenu->CreateButton( | |
3768 24u, | |
3769 154u, | |
3770 225u, | |
3771 37u, | |
3772 1, | |
3773 0, | |
3774 0x61u, | |
3775 0, | |
3776 0x52u, | |
3777 "", | |
3778 (Texture *)(uTextureID_RestUI_restb4 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_RestUI_restb4] : 0), | |
3779 0); | |
3780 pButton_RestUI_WaitUntilDawn = pGUIWindow_CurrentMenu->CreateButton( | |
3781 61u, | |
3782 232u, | |
3783 154u, | |
3784 33u, | |
3785 1, | |
3786 0, | |
3787 0x6Du, | |
3788 0, | |
3789 0x44u, | |
3790 "", | |
3791 (Texture *)(uTextureID_RestUI_restb1 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_RestUI_restb1] : 0), | |
3792 0); | |
3793 pButton_RestUI_Wait1Hour = pGUIWindow_CurrentMenu->CreateButton( | |
3794 61u, | |
3795 264u, | |
3796 154u, | |
3797 33u, | |
3798 1, | |
3799 0, | |
3800 0x60u, | |
3801 0, | |
3802 0x48u, | |
3803 "", | |
3804 (Texture *)(uTextureID_RestUI_restb2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_RestUI_restb2] : 0), | |
3805 0); | |
3806 pButton_RestUI_Wait5Minutes = pGUIWindow_CurrentMenu->CreateButton( | |
3807 61u, | |
3808 296u, | |
3809 154u, | |
3810 33u, | |
3811 1, | |
3812 0, | |
3813 0x5Fu, | |
3814 0, | |
3815 0x4Du, | |
3816 "", | |
3817 (Texture *)(uTextureID_RestUI_restb3 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_RestUI_restb3] : 0), | |
3818 0); | |
3819 } | |
3820 | |
3821 //----- (0041FA01) -------------------------------------------------------- | |
3822 void __cdecl RestUI_Draw() | |
3823 { | |
3824 int v0; // esi@1 | |
3825 Player **ppPlayers; // ecx@1 | |
3826 Player *pPlayer; // eax@2 | |
3827 unsigned int v3; // eax@15 | |
3828 char v4; // al@17 | |
3829 bool v5; // eax@21 | |
3830 GUIButton Dst; // [sp+8h] [bp-DCh]@19 | |
3831 //double v7; // [sp+C4h] [bp-20h]@17 | |
3832 float v8; // [sp+CCh] [bp-18h]@17 | |
3833 __int64 v9; // [sp+D0h] [bp-14h]@17 | |
3834 unsigned int v10; // [sp+D8h] [bp-Ch]@9 | |
3835 __int16 a9[2]; // [sp+DCh] [bp-8h]@1 | |
3836 int a5; // [sp+E0h] [bp-4h]@1 | |
3837 | |
3838 v0 = 0; | |
3839 a5 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xAu, 0, 0); | |
3840 *(int *)a9 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE6u, 0xD6u, 0xC1u); | |
3841 ppPlayers = &pPlayers[1]; | |
3842 do | |
3843 { | |
3844 pPlayer = *ppPlayers; | |
3845 if ( !(*ppPlayers)->pConditions[14] && !pPlayer->pConditions[16] && pPlayer->sHealth > 0 ) | |
3846 ++v0; | |
3847 ++ppPlayers; | |
3848 } | |
3849 while ( (signed int)ppPlayers <= (signed int)&pPlayers[4] ); | |
3850 if ( v0 ) | |
3851 { | |
3852 pRenderer->DrawTextureIndexed( | |
3853 8u, | |
3854 8u, | |
3855 (Texture *)(uTextureID_RestUI_restmain != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_RestUI_restmain] : 0)); | |
3856 v10 = pParty->uCurrentHour; | |
3857 dword_506F1C = pGUIWindow_CurrentMenu->pCurrentPosActiveItem; | |
3858 if ( (signed int)pParty->uCurrentHour <= 12 ) | |
3859 { | |
3860 if ( !v10 ) | |
3861 v10 = 12; | |
3862 } | |
3863 else | |
3864 { | |
3865 v10 -= 12; | |
3866 } | |
3867 pRenderer->DrawTextureIndexed(16u, 26u, pTexture_RestUI_CurrentSkyFrame); | |
3868 if ( pTexture_RestUI_CurrentHourglassFrame ) | |
3869 { | |
3870 pTexture_RestUI_CurrentHourglassFrame->Release(); | |
3871 pIcons_LOD->_40F9C5(); | |
3872 } | |
3873 v3 = pEventTimer->uTimeElapsed + _507CD4_RestUI_hourglass_anim_controller; | |
3874 _507CD4_RestUI_hourglass_anim_controller += pEventTimer->uTimeElapsed; | |
3875 if ( (unsigned int)_507CD4_RestUI_hourglass_anim_controller >= 512 ) | |
3876 { | |
3877 v3 = 0; | |
3878 _507CD4_RestUI_hourglass_anim_controller = 0; | |
3879 } | |
3880 v9 = v3; | |
3881 v8 = (double)v3 * 0.001953125 * 120.0; | |
3882 //v7 = v8 + 6.7553994e15; | |
3883 HIDWORD(v9) = floorf(v8 + 0.5f);//LODWORD(v7); | |
3884 v4 = (int)floorf(v8 + 0.5f) % 256 + 1;//LOBYTE(v7) + 1; | |
3885 byte_4E2BC8 = v4; | |
3886 if ( (unsigned __int8)(v4) >= 0x78u ) | |
3887 { | |
3888 v4 = 1; | |
3889 byte_4E2BC8 = 1; | |
3890 } | |
3891 sprintf(pTmpBuf, "hglas%03d", (unsigned __int8)v4); | |
3892 pTexture_RestUI_CurrentHourglassFrame = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pTmpBuf, TEXTURE_16BIT_PALETTE)]; | |
3893 pRenderer->DrawTextureIndexed(0x10Bu, 0x9Fu, pTexture_RestUI_CurrentHourglassFrame); | |
3894 memset(&Dst, 0, 0xBCu); | |
3895 Dst.uX = 24; | |
3896 Dst.uY = 154; | |
3897 Dst.uWidth = 171; | |
3898 Dst.uHeight = 37; | |
3899 Dst.uZ = 194; | |
3900 Dst.uW = 190; | |
3901 Dst.pParent = pButton_RestUI_WaitUntilDawn->pParent; | |
3902 Dst.DrawLabel(pGlobalTXT_LocalizationStrings[183], pFontCreate, a5, *(int **)a9); | |
3903 Dst.pParent = 0; | |
3904 sprintf(pTmpBuf, "\r408%d", uRestUI_FoodRequiredToRest); | |
3905 pGUIWindow_CurrentMenu->DrawText(pFontCreate, 0, 164, a5, pTmpBuf, 0, 0, *(unsigned int *)a9); | |
3906 pButton_RestUI_WaitUntilDawn->DrawLabel( | |
3907 pGlobalTXT_LocalizationStrings[237], | |
3908 pFontCreate, | |
3909 a5, | |
3910 *(int **)a9); | |
3911 pButton_RestUI_Wait1Hour->DrawLabel(pGlobalTXT_LocalizationStrings[239], pFontCreate, a5, *(int **)a9); | |
3912 pButton_RestUI_Wait5Minutes->DrawLabel(pGlobalTXT_LocalizationStrings[238], pFontCreate, a5, *(int **)a9); | |
3913 pButton_RestUI_Exit->DrawLabel(pGlobalTXT_LocalizationStrings[81], pFontCreate, a5, *(int **)a9); | |
3914 memset(&Dst, 0, 0xBCu); | |
3915 Dst.uX = 45; | |
3916 Dst.uY = 199; | |
3917 Dst.uWidth = 185; | |
3918 Dst.uHeight = 30; | |
3919 Dst.uZ = 229; | |
3920 Dst.uW = 228; | |
3921 Dst.pParent = pButton_RestUI_WaitUntilDawn->pParent; | |
3922 Dst.DrawLabel(pGlobalTXT_LocalizationStrings[236], pFontCreate, a5, *(int **)a9); | |
3923 Dst.pParent = 0; | |
3924 v5 = pParty->uCurrentHour >= 0xC && pParty->uCurrentHour < 0x18; | |
3925 sprintf(pTmpBuf, "%d:%02d %s", v10, pParty->uCurrentMinute, aAMPMNames[v5]); | |
3926 pGUIWindow_CurrentMenu->DrawText(pFontCreate, 368, 168, a5, pTmpBuf, 0, 0, *(unsigned int *)a9); | |
3927 sprintf(pTmpBuf, "%s\r190%d", pGlobalTXT_LocalizationStrings[56], pParty->uDaysPlayed + 1); | |
3928 pGUIWindow_CurrentMenu->DrawText(pFontCreate, 350, 190, a5, pTmpBuf, 0, 0, *(unsigned int *)a9); | |
3929 sprintf(pTmpBuf, "%s\r190%d", pGlobalTXT_LocalizationStrings[146], pParty->uCurrentMonth + 1); | |
3930 pGUIWindow_CurrentMenu->DrawText(pFontCreate, 350, 222, a5, pTmpBuf, 0, 0, *(unsigned int *)a9); | |
3931 sprintf(pTmpBuf, "%s\r190%d", pGlobalTXT_LocalizationStrings[245], pParty->uCurrentYear); | |
3932 pGUIWindow_CurrentMenu->DrawText(pFontCreate, 350, 254, a5, pTmpBuf, 0, 0, *(unsigned int *)a9); | |
3933 if ( dword_506F14 ) | |
3934 Sleep6Hours(); | |
3935 } | |
3936 else | |
3937 { | |
3938 GUIWindow::Create( | |
3939 pButton_RestUI_Exit->uX, | |
3940 pButton_RestUI_Exit->uY, | |
3941 0, | |
3942 0, | |
3943 (enum WindowType)96, | |
3944 (int)pButton_RestUI_Exit, | |
3945 (int)pGlobalTXT_LocalizationStrings[81]); | |
3946 } | |
3947 } | |
3948 // 4E2BC8: using guessed type char byte_4E2BC8; | |
3949 // 506F14: using guessed type int dword_506F14; | |
3950 // 506F1C: using guessed type int dword_506F1C; | |
3951 // 50765C: using guessed type int uTextureID_RestUI_restmain; | |
3952 // 507CD4: using guessed type int 507CD4_RestUI_hourglass_anim_controller; | |
3953 | |
3954 //----- (0041FE71) -------------------------------------------------------- | |
3955 int Chest::CanPlaceItemAt(signed int a1, int a2, unsigned int uChestID) | |
3956 { | |
3957 int v3; // eax@1 | |
3958 unsigned int v4; // eax@1 | |
3959 Texture *v5; // ecx@1 | |
3960 signed int v6; // eax@1 | |
3961 signed int v7; // edi@3 | |
3962 signed int v8; // eax@3 | |
3963 int v9; // edi@3 | |
3964 int v10; // ebx@5 | |
3965 int v11; // esi@9 | |
3966 int v12; // edx@10 | |
3967 int v13; // ecx@11 | |
3968 char *v14; // eax@12 | |
3969 int v16; // [sp+Ch] [bp-Ch]@1 | |
3970 signed int v17; // [sp+10h] [bp-8h]@1 | |
3971 signed int v18; // [sp+14h] [bp-4h]@1 | |
3972 | |
3973 v17 = a1; | |
3974 v3 = pChests[uChestID].uChestBitmapID; | |
3975 v16 = pChestHeightsByType[v3]; | |
3976 v18 = pChestWidthsByType[v3]; | |
3977 v4 = pIcons_LOD->LoadTexture(pItemsTable->pItems[a2].pIconName, TEXTURE_16BIT_PALETTE); | |
3978 v5 = (Texture *)(v4 != -1 ? (int)&pIcons_LOD->pTextures[v4] : 0); | |
3979 v6 = (v4 != -1 ? pIcons_LOD->pTextures[v4].uTextureWidth : 24); | |
3980 if ( v6 < 14 ) | |
3981 v6 = 14; | |
3982 v7 = v6 - 14; | |
3983 v8 = v5->uTextureHeight; | |
3984 v9 = (v7 >> 5) + 1; | |
3985 if ( v8 < 14 ) | |
3986 v8 = 14; | |
3987 v10 = ((v8 - 14) >> 5) + 1; | |
3988 if ( !areWeLoadingTexture ) | |
3989 { | |
3990 v5->Release(); | |
3991 pIcons_LOD->_40F9C5(); | |
3992 } | |
3993 if ( v9 + v17 % v18 <= v18 && v10 + v17 / v18 <= v16 ) | |
3994 { | |
3995 v11 = 0; | |
3996 if ( v10 <= 0 ) | |
3997 return 1; | |
3998 v12 = 0; | |
3999 while ( 1 ) | |
4000 { | |
4001 v13 = 0; | |
4002 if ( v9 > 0 ) | |
4003 break; | |
4004 LABEL_15: | |
4005 v12 += v18; | |
4006 ++v11; | |
4007 if ( v11 >= v10 ) | |
4008 return 1; | |
4009 } | |
4010 v14 = (char *)&pChests[0].pInventoryIndices[v17 + v12 + 2662 * uChestID]; | |
4011 while ( !*(short *)v14 ) | |
4012 { | |
4013 ++v13; | |
4014 v14 += 2; | |
4015 if ( v13 >= v9 ) | |
4016 goto LABEL_15; | |
4017 } | |
4018 } | |
4019 return 0; | |
4020 } | |
4021 // 506128: using guessed type int areWeLoadingTexture; | |
4022 | |
4023 //----- (0041FF64) -------------------------------------------------------- | |
4024 int Chest::_41FF64(unsigned int uChestID) | |
4025 { | |
4026 unsigned int v1; // ecx@1 | |
4027 signed int result; // eax@1 | |
4028 int v3; // edx@1 | |
4029 ItemGen *pItem; // ecx@2 | |
4030 | |
4031 v1 = uChestID; | |
4032 result = 0; | |
4033 v3 = pChestWidthsByType[pChests[v1].uChestBitmapID] * pChestHeightsByType[pChests[v1].uChestBitmapID]; | |
4034 if ( v3 <= 0 ) | |
4035 { | |
4036 LABEL_5: | |
4037 result = -1; | |
4038 } | |
4039 else | |
4040 { | |
4041 pItem = pChests[v1].mm7__vector_pItems; | |
4042 while ( pItem->uItemID ) | |
4043 { | |
4044 ++result; | |
4045 ++pItem; | |
4046 if ( result >= v3 ) | |
4047 goto LABEL_5; | |
4048 } | |
4049 } | |
4050 return result; | |
4051 } | |
4052 | |
4053 //----- (0041FFA2) -------------------------------------------------------- | |
4054 int Chest::_41FFA2(int a1, ItemGen *a2, unsigned int uChestID) | |
4055 { | |
4056 int v3; // eax@1 | |
4057 ItemGen *v4; // edi@1 | |
4058 int v5; // esi@1 | |
4059 int result; // eax@11 | |
4060 unsigned int v7; // eax@12 | |
4061 int v8; // edx@12 | |
4062 int v9; // ecx@12 | |
4063 signed int v10; // eax@12 | |
4064 signed int v11; // edi@14 | |
4065 unsigned int v12; // esi@14 | |
4066 int v13; // edi@16 | |
4067 void *v14; // edi@21 | |
4068 int v15; // edi@21 | |
4069 int i; // ecx@21 | |
4070 ItemGen *Src; // [sp+Ch] [bp-18h]@1 | |
4071 signed int v18; // [sp+10h] [bp-14h]@2 | |
4072 int v19; // [sp+14h] [bp-10h]@1 | |
4073 int v20; // [sp+18h] [bp-Ch]@19 | |
4074 signed int v21; // [sp+1Ch] [bp-8h]@1 | |
4075 signed int v22; // [sp+20h] [bp-4h]@3 | |
4076 int v23; // [sp+20h] [bp-4h]@19 | |
4077 | |
4078 v21 = 0; | |
4079 v3 = pChests[uChestID].uChestBitmapID; | |
4080 v4 = a2; | |
4081 v5 = pChestWidthsByType[v3] * pChestHeightsByType[v3]; | |
4082 Src = a2; | |
4083 v19 = pChestWidthsByType[v3]; | |
4084 if ( a1 == -1 ) | |
4085 { | |
4086 v18 = _41FF64(uChestID); | |
4087 if ( v18 == -1 ) | |
4088 return 0; | |
4089 v22 = 0; | |
4090 if ( v5 > 0 ) | |
4091 { | |
4092 while ( !Chest::CanPlaceItemAt(v22, v4->uItemID, (unsigned int)pChestWindow->ptr_1C) ) | |
4093 { | |
4094 ++v22; | |
4095 if ( v22 >= v5 ) | |
4096 goto LABEL_8; | |
4097 } | |
4098 v21 = v22; | |
4099 } | |
4100 LABEL_8: | |
4101 if ( v22 == v5 ) | |
4102 { | |
4103 if ( uActiveCharacter ) | |
4104 pPlayers[uActiveCharacter]->PlaySound(15, 0); | |
4105 return 0; | |
4106 } | |
4107 v7 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v4->uItemID].pIconName, TEXTURE_16BIT_PALETTE); | |
4108 HIWORD(v8) = 0; | |
4109 v9 = v7 != -1 ? (int)&pIcons_LOD->pTextures[v7] : 0; | |
4110 v10 = (v7 != -1 ? pIcons_LOD->pTextures[v7].uTextureWidth : 24); | |
4111 if ( v10 < 14 ) | |
4112 v10 = 14; | |
4113 v11 = *(short *)(v9 + 26); | |
4114 v12 = ((v10 - 14) >> 5) + 1; | |
4115 if ( v11 < 14 ) | |
4116 v11 = 14; | |
4117 v13 = ((v11 - 14) >> 5) + 1; | |
4118 if ( !areWeLoadingTexture ) | |
4119 { | |
4120 ((Texture *)v9)->Release(); | |
4121 pIcons_LOD->_40F9C5(); | |
4122 } | |
4123 if ( v13 > 0 ) | |
4124 { | |
4125 v23 = 0; | |
4126 v20 = v13; | |
4127 do | |
4128 { | |
4129 if ( (signed int)v12 > 0 ) | |
4130 { | |
4131 v14 = &pChests[0].pInventoryIndices[v21 + v23 + 2662 * uChestID]; | |
4132 LOWORD(v8) = -1 - v21; | |
4133 v8 <<= 16; | |
4134 LOWORD(v8) = -1 - v21; | |
4135 memset32(v14, v8, v12 >> 1); | |
4136 v15 = (int)((char *)v14 + 4 * (v12 >> 1)); | |
4137 for ( i = v12 & 1; i; --i ) | |
4138 { | |
4139 *(short *)v15 = v8; | |
4140 v15 += 2; | |
4141 } | |
4142 } | |
4143 v23 += v19; | |
4144 --v20; | |
4145 } | |
4146 while ( v20 ); | |
4147 } | |
4148 pChests[0].pInventoryIndices[v21 + 2662 * uChestID] = v18 + 1; | |
4149 memcpy(&pChests[uChestID].mm7__vector_pItems[v18], Src, 0x24u); | |
4150 result = v21 + 1; | |
4151 } | |
4152 else | |
4153 { | |
4154 result = 1; | |
4155 } | |
4156 return result; | |
4157 } | |
4158 // 506128: using guessed type int areWeLoadingTexture; | |
4159 | |
4160 //----- (0042013E) -------------------------------------------------------- | |
4161 unsigned int Chest::PlaceItemAt(unsigned int a1, unsigned int uItemIdx, unsigned int uChestID) | |
4162 { | |
4163 int v3; // esi@1 | |
4164 unsigned int v4; // ebx@1 | |
4165 int uItemID; // edi@1 | |
4166 int v6; // edx@4 | |
4167 unsigned int v7; // eax@5 | |
4168 Texture *v8; // ecx@5 | |
4169 signed int v9; // eax@5 | |
4170 signed int v10; // edi@7 | |
4171 unsigned int v11; // ebx@7 | |
4172 int v12; // edi@9 | |
4173 int v13; // edx@12 | |
4174 void *v14; // edi@14 | |
4175 int v15; // edi@14 | |
4176 int i; // ecx@14 | |
4177 unsigned int result; // eax@18 | |
4178 __int16 v18; // [sp+Ch] [bp-10h]@1 | |
4179 int v19; // [sp+10h] [bp-Ch]@11 | |
4180 int v20; // [sp+14h] [bp-8h]@12 | |
4181 unsigned int v21; // [sp+18h] [bp-4h]@1 | |
4182 | |
4183 v3 = 5324 * uChestID; | |
4184 v21 = a1; | |
4185 v4 = 5324 * uChestID + 36 * uItemIdx; | |
4186 v18 = uItemIdx; | |
4187 uItemID = *(unsigned int *)((char *)&pChests[0].mm7__vector_pItems[0].uItemID + v4); | |
4188 pItemsTable->SetSpecialBonus((ItemGen *)((char *)pChests[0].mm7__vector_pItems + v4)); | |
4189 if ( uItemID >= 135 && uItemID <= 159 && !*(int *)((char *)&pChests[0].mm7__vector_pItems[0].uNumCharges + v4) ) | |
4190 { | |
4191 v6 = rand() % 21 + 10; | |
4192 *(int *)((char *)&pChests[0].mm7__vector_pItems[0].uNumCharges + v4) = v6; | |
4193 *(&pChests[0].mm7__vector_pItems[0].uMaxCharges + v4) = v6; | |
4194 } | |
4195 v7 = pIcons_LOD->LoadTexture(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); | |
4196 v8 = (Texture *)(v7 != -1 ? (int)&pIcons_LOD->pTextures[v7] : 0); | |
4197 v9 = (v7 != -1 ? pIcons_LOD->pTextures[v7].uTextureWidth : 24); | |
4198 if ( v9 < 14 ) | |
4199 v9 = 14; | |
4200 v10 = v8->uTextureHeight; | |
4201 v11 = ((v9 - 14) >> 5) + 1; | |
4202 if ( v10 < 14 ) | |
4203 v10 = 14; | |
4204 v12 = ((v10 - 14) >> 5) + 1; | |
4205 if ( !areWeLoadingTexture ) | |
4206 { | |
4207 v8->Release(); | |
4208 pIcons_LOD->_40F9C5(); | |
4209 } | |
4210 v19 = pChestWidthsByType[*(unsigned __int16 *)((char *)&pChests[0].uChestBitmapID + v3)]; | |
4211 if ( v12 > 0 ) | |
4212 { | |
4213 v13 = 0; | |
4214 v20 = v12; | |
4215 do | |
4216 { | |
4217 if ( (signed int)v11 > 0 ) | |
4218 { | |
4219 v14 = &pChests[0].pInventoryIndices[v21 + v13 + 2662 * uChestID]; | |
4220 LOWORD(v3) = -1 - v21; | |
4221 v3 <<= 16; | |
4222 LOWORD(v3) = -1 - v21; | |
4223 memset32(v14, v3, v11 >> 1); | |
4224 v15 = (int)((char *)v14 + 4 * (v11 >> 1)); | |
4225 for ( i = v11 & 1; i; --i ) | |
4226 { | |
4227 *(short *)v15 = v3; | |
4228 v15 += 2; | |
4229 } | |
4230 } | |
4231 v13 += v19; | |
4232 --v20; | |
4233 } | |
4234 while ( v20 ); | |
4235 } | |
4236 result = v21 + 2662 * uChestID; | |
4237 pChests[0].pInventoryIndices[result] = v18 + 1; | |
4238 return result; | |
4239 } | |
4240 // 506128: using guessed type int areWeLoadingTexture; | |
4241 | |
4242 //----- (00420284) -------------------------------------------------------- | |
4243 char *Chest::_420284(unsigned int uChestID) | |
4244 { | |
4245 int v1; // ebx@1 | |
4246 unsigned int v2; // esi@1 | |
4247 unsigned int v3; // esi@1 | |
4248 int uChestArea; // edi@1 | |
4249 int v5; // eax@2 | |
4250 int v6; // ebx@11 | |
4251 char *result; // eax@18 | |
4252 char Dst[144]; // [sp+Ch] [bp-A0h]@1 | |
4253 int v9; // [sp+9Ch] [bp-10h]@10 | |
4254 unsigned int v10; // [sp+A0h] [bp-Ch]@1 | |
4255 unsigned int v11; // [sp+A4h] [bp-8h]@8 | |
82 | 4256 ItemGen *v12; // [sp+A8h] [bp-4h]@9 |
0 | 4257 |
4258 v1 = 0; | |
4259 v2 = uChestID; | |
4260 v10 = uChestID; | |
4261 pRenderer->ClearZBuffer(0, 479); | |
4262 v3 = v2; | |
4263 uChestArea = pChestWidthsByType[pChests[v3].uChestBitmapID] * pChestHeightsByType[pChests[v3].uChestBitmapID]; | |
4264 memset(Dst, 0, 0x90u); | |
4265 if ( uChestArea > 0 ) | |
4266 { | |
4267 do | |
4268 { | |
4269 do | |
4270 v5 = (unsigned __int8)rand(); | |
4271 while ( v5 >= uChestArea ); | |
4272 while ( Dst[v5] ) | |
4273 { | |
4274 ++v5; | |
4275 if ( v5 == uChestArea ) | |
4276 v5 = 0; | |
4277 } | |
4278 Dst[v5] = v1++; | |
4279 } | |
4280 while ( v1 < uChestArea ); | |
4281 } | |
4282 v11 = 0; | |
4283 if ( uChestArea > 0 ) | |
4284 { | |
82 | 4285 v12 = pChests[v3].mm7__vector_pItems;//&pChests[v3].mm7__vector_pItems[0].uAttributes; |
0 | 4286 do |
4287 { | |
82 | 4288 v9 = v12->uItemID; |
0 | 4289 if ( v9 ) |
4290 { | |
4291 v6 = 0; | |
4292 while ( !Chest::CanPlaceItemAt((unsigned __int8)Dst[v6], v9, v10) ) | |
4293 { | |
4294 ++v6; | |
4295 if ( v6 >= uChestArea ) | |
82 | 4296 break; |
0 | 4297 } |
82 | 4298 if(v6<uChestArea) |
4299 { | |
4300 Chest::PlaceItemAt((unsigned __int8)Dst[v6], v11, v10); | |
4301 if ( pChests[v3].uFlags & 4 ) | |
4302 v12->uAttributes |= 1u; | |
4303 } | |
4304 } | |
0 | 4305 ++v11; |
82 | 4306 ++v12; |
0 | 4307 } |
4308 while ( (signed int)v11 < uChestArea ); | |
4309 } | |
4310 result = (char *)&pChests[v3].uFlags; | |
4311 pChests[v3].uFlags = pChests[v3].uFlags & 0xFFFB | 2; | |
4312 return result; | |
4313 } | |
4314 // 420284: using guessed type char Dst[144]; | |
4315 | |
4316 //----- (0042038D) -------------------------------------------------------- | |
4317 void __cdecl sub_42038D() | |
4318 { | |
4319 POINT *v0; // esi@2 | |
4320 int v1; // ecx@2 | |
4321 const char *v2; // eax@3 | |
4322 POINT v3; // [sp+0h] [bp-10h]@2 | |
4323 POINT a2; // [sp+8h] [bp-8h]@1 | |
4324 | |
4325 if ( pMouse->GetCursorPos(&a2)->y < 350 ) | |
4326 { | |
4327 v0 = pMouse->GetCursorPos(&a2); | |
4328 v1 = pRenderer->pActiveZBuffer[v0->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v3)->y]]; | |
4329 if ( v1 ) | |
4330 { | |
4331 auto _w = (ItemGen *)(&pOtherOverlayList->pOverlays[49].field_4 + 2662 * (unsigned int)pChestWindow->ptr_1C | |
4332 + 18 * *((short *)&pChests[0].mm7__vector_pItems[139].uExpireTime | |
4333 + v1 + 2662 * (unsigned int)pChestWindow->ptr_1C + 3)); | |
4334 v2 = _w->GetDisplayName(); | |
4335 sub_41C0B8_set_status_string(v2); | |
4336 } | |
4337 } | |
4338 } | |
4339 | |
4340 //----- (0042041E) -------------------------------------------------------- | |
4341 bool Chest::Open(unsigned int uChestID) | |
4342 { | |
4343 char *v1; // edi@5 | |
4344 unsigned int v2; // eax@8 | |
4345 GUIWindow *v3; // eax@15 | |
4346 int v5; // edx@16 | |
4347 int v6; // eax@16 | |
4348 ODMFace *v7; // eax@19 | |
4349 int v8; // edx@19 | |
4350 int v9; // edi@19 | |
4351 signed int v10; // ebx@19 | |
4352 int v11; // ecx@19 | |
4353 int v12; // eax@19 | |
4354 BLVFace *v13; // eax@20 | |
4355 int v14; // ebx@21 | |
4356 int v15; // edi@21 | |
4357 int v16; // ecx@22 | |
4358 __int64 v17; // qax@22 | |
4359 double v18; // st7@23 | |
4360 double v19; // st6@23 | |
4361 double v20; // st7@23 | |
4362 int v21; // ecx@26 | |
4363 char v22[12]; // ST4C_12@28 | |
4364 unsigned int *v23; // edi@28 | |
4365 unsigned __int16 v24; // di@28 | |
4366 signed int v25; // ecx@28 | |
4367 char *v26; // edx@29 | |
4368 unsigned __int16 v27; // ax@32 | |
4369 //LayingItem a1; // [sp+14h] [bp-B0h]@28 | |
4370 int v29; // [sp+84h] [bp-40h]@16 | |
4371 int v30; // [sp+88h] [bp-3Ch]@16 | |
4372 int v31; // [sp+8Ch] [bp-38h]@16 | |
4373 int v32; // [sp+90h] [bp-34h]@16 | |
4374 float v33; // [sp+94h] [bp-30h]@23 | |
4375 char *v34; // [sp+98h] [bp-2Ch]@5 | |
4376 int v35; // [sp+9Ch] [bp-28h]@16 | |
4377 Vec3_int_ pOut; // [sp+A0h] [bp-24h]@28 | |
4378 int a4; // [sp+ACh] [bp-18h]@1 | |
4379 int v38; // [sp+B0h] [bp-14h]@21 | |
4380 int sRotX; // [sp+B4h] [bp-10h]@23 | |
4381 float v40; // [sp+B8h] [bp-Ch]@23 | |
4382 float v41; // [sp+BCh] [bp-8h]@23 | |
4383 int sRotY; // [sp+C0h] [bp-4h]@8 | |
4384 | |
4385 a4 = uChestID; | |
4386 if ( (uChestID & 0x80000000u) != 0 || (signed int)uChestID >= 20 ) | |
4387 return 0; | |
4388 ++pIcons_LOD->uTexturePacksCount; | |
4389 if ( !pIcons_LOD->uNumPrevLoadedFiles ) | |
4390 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | |
4391 v1 = (char *)&pChests[uChestID].uFlags; | |
4392 v34 = v1; | |
4393 if ( !(*v1 & CHEST_ITEMS_PLACED) ) | |
4394 Chest::_420284(uChestID); | |
4395 if ( !uActiveCharacter ) | |
4396 return 0; | |
4397 *(float *)&sRotY = 0.0; | |
4398 v2 = pMapStats->GetMapInfo(pCurrentMapName); | |
4399 if ( !(*v1 & 1) || !v2 ) | |
4400 goto LABEL_12; | |
4401 if ( pPlayers[uActiveCharacter]->GetDisarmTrap() < 2 * pMapStats->pInfos[v2].field_2D ) | |
4402 { | |
4403 v29 = 811; | |
4404 v30 = 812; | |
4405 v31 = 813; | |
4406 v32 = 814; | |
4407 v5 = rand() % 4; | |
4408 v6 = dword_5B5920 >> 3; | |
4409 v35 = v5; | |
4410 if ( (dword_5B5920 & 7) == 5 ) | |
4411 { | |
4412 v16 = v6; | |
4413 v14 = pLevelDecorations[v6].vPosition.x; | |
4414 v38 = pLevelDecorations[v6].vPosition.y; | |
4415 v17 = pDecorationList->pDecorations[pLevelDecorations[v6].uDecorationDescID].uDecorationHeight; | |
4416 v15 = pLevelDecorations[v16].vPosition.z + (((signed int)v17 - HIDWORD(v17)) >> 1); | |
4417 } | |
4418 else | |
4419 { | |
4420 if ( (dword_5B5920 & 7) != 6 ) | |
4421 goto LABEL_12; | |
4422 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
4423 { | |
4424 v7 = &pOutdoor->pBModels[dword_5B5920 >> 9].pFaces[(dword_5B5920 >> 3) & 0x3F]; | |
4425 v8 = v7->pBoundingBox.y1; | |
4426 v9 = v7->pBoundingBox.z2; | |
4427 v10 = v7->pBoundingBox.x1 + v7->pBoundingBox.x2; | |
4428 v11 = v7->pBoundingBox.y2; | |
4429 v12 = v7->pBoundingBox.z1; | |
4430 } | |
4431 else | |
4432 { | |
4433 v13 = &pIndoor->pFaces[v6]; | |
4434 v8 = v13->pBounding.y1; | |
4435 v9 = v13->pBounding.z2; | |
4436 v10 = v13->pBounding.x1 + v13->pBounding.x2; | |
4437 v11 = v13->pBounding.y2; | |
4438 v12 = v13->pBounding.z1; | |
4439 } | |
4440 v14 = v10 >> 1; | |
4441 v38 = (v8 + v11) >> 1; | |
4442 v15 = (v12 + v9) >> 1; | |
4443 } | |
4444 v18 = (double)pParty->vPosition.x - (double)v14; | |
4445 *(float *)&a4 = v18; | |
4446 v19 = (double)pParty->vPosition.y - (double)v38; | |
4447 v33 = v19; | |
4448 v41 = (double)pParty->sEyelevel + (double)pParty->vPosition.z - (double)v15; | |
4449 *(float *)&sRotY = v19 * v19; | |
4450 *(float *)&sRotX = v18 * v18; | |
4451 v20 = sqrt(v41 * v41 + *(float *)&sRotX + *(float *)&sRotY); | |
4452 v40 = v20; | |
4453 if ( v20 <= 1.0 ) | |
4454 { | |
4455 *(float *)&sRotX = 0.0; | |
4456 *(float *)&sRotY = 0.0; | |
4457 } | |
4458 else | |
4459 { | |
4460 sRotY = (signed __int64)sqrt(*(float *)&sRotX + *(float *)&sRotY); | |
4461 sRotX = stru_5C6E00->Atan2((signed __int64)*(float *)&a4, (signed __int64)v33); | |
4462 sRotY = stru_5C6E00->Atan2(sRotY, (signed __int64)v41); | |
4463 } | |
4464 v21 = 256; | |
4465 if ( v40 < 256.0 ) | |
4466 v21 = (signed __int64)v40 / 4; | |
4467 *(int *)&v22[8] = v15; | |
4468 *(_QWORD *)v22 = __PAIR__(v38, v14); | |
4469 Vec3_int_::Rotate(v21, sRotX, sRotY, *(Vec3_int_ *)v22, &pOut.x, &pOut.z, &pOut.y); | |
4470 v23 = (unsigned int *)(&v29 + v35); | |
4471 sub_42F7EB_DropItemAt(*v23, pOut.x, pOut.z, pOut.y, 0, 1, 0, 0x30u, 0); | |
4472 | |
4473 LayingItem a1; // [sp+14h] [bp-B0h]@28 | |
4474 //LayingItem::LayingItem(&a1); | |
4475 | |
4476 a1.stru_24.Reset(); | |
4477 v24 = *(short *)v23; | |
4478 v25 = 0; | |
4479 a1.field_50 = 0; | |
4480 a1.field_4C = 0; | |
4481 a1.field_48 = 0; | |
4482 a1.field_54 = 0; | |
4483 a1.uItemType = v24; | |
4484 if ( (signed int)pObjectList->uNumObjects <= 0 ) | |
4485 { | |
4486 LABEL_32: | |
4487 v27 = 0; | |
4488 } | |
4489 else | |
4490 { | |
4491 v26 = (char *)&pObjectList->pObjects->uObjectID; | |
4492 while ( v24 != *(short *)v26 ) | |
4493 { | |
4494 ++v25; | |
4495 v26 += 56; | |
4496 if ( v25 >= (signed int)pObjectList->uNumObjects ) | |
4497 goto LABEL_32; | |
4498 } | |
4499 v27 = v25; | |
4500 } | |
4501 a1.uObjectDescID = v27; | |
4502 a1.vPosition.y = pOut.z; | |
4503 a1.vPosition.x = pOut.x; | |
4504 a1.vPosition.z = pOut.y; | |
4505 a1.uSoundID = 0; | |
4506 a1.uAttributes = 48; | |
4507 a1.uSectorID = pIndoor->GetSector(pOut.x, pOut.z, pOut.y); | |
4508 a1.uSpriteFrameID = 0; | |
4509 a1.field_58 = 0; | |
4510 a1.field_5C = 0; | |
4511 a1.uFacing = 0; | |
4512 a1.Create(0, 0, 0, 0); | |
4513 pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); | |
4514 a1._438E35(); | |
4515 *v34 &= 0xFEu; | |
4516 if ( uActiveCharacter && !qword_A750D8 && !dword_507CD8 ) | |
4517 { | |
4518 qword_A750D8 = 256i64; | |
4519 word_A750E0 = 5; | |
4520 word_A750E2 = uActiveCharacter; | |
4521 } | |
4522 pIcons_LOD->_4114F2(); | |
4523 dword_507CD8 = 0; | |
4524 return 0; | |
4525 } | |
4526 *v1 &= 0xFEu; | |
4527 sRotY = 1; | |
4528 LABEL_12: | |
4529 pAudioPlayer->StopChannels(-1, -1); | |
4530 pAudioPlayer->PlaySound((SoundID)208, 0, 0, -1, 0, 0, 0, 0); | |
4531 if ( *(float *)&sRotY != 0.0 ) | |
4532 { | |
4533 if ( !dword_507CD8 ) | |
4534 pPlayers[uActiveCharacter]->PlaySound(4, 0); | |
4535 } | |
4536 dword_507CD8 = 0; | |
4537 v3 = GUIWindow::Create(0, 0, 640u, 480u, WINDOW_Chest, a4, 0); | |
4538 pGUIWindow_CurrentMenu = v3; | |
4539 pChestWindow = v3; | |
4540 pBtn_ExitCancel = v3->CreateButton( | |
4541 0x1D7u, | |
4542 0x1BDu, | |
4543 0xA9u, | |
4544 0x23u, | |
4545 1, | |
4546 0, | |
4547 0x71u, | |
4548 0, | |
4549 0, | |
4550 pGlobalTXT_LocalizationStrings[79],// Exit | |
4551 (Texture *)(uTextureID_506438 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_506438] : 0), | |
4552 0); | |
4553 pChestWindow->CreateButton(7u, 8u, 460u, 343u, 1, 0, 0xCu, 0, 0, "", 0); | |
4554 pCurrentScreen = 10; | |
4555 pEventTimer->Pause(); | |
4556 return 1; | |
4557 } | |
4558 | |
4559 //----- (0042092D) -------------------------------------------------------- | |
4560 void Chest::DrawChestUI(unsigned int uChestID) | |
4561 { | |
4562 Render *v1; // edi@1 | |
4563 unsigned int v2; // ebx@1 | |
4564 unsigned int v3; // ebx@1 | |
4565 int v4; // eax@1 | |
4566 unsigned int v5; // eax@1 | |
4567 int v6; // ecx@3 | |
4568 unsigned int v7; // eax@4 | |
4569 Texture *v8; // esi@4 | |
4570 signed int v9; // ecx@4 | |
4571 signed int v10; // edx@4 | |
4572 signed int v11; // eax@4 | |
4573 int v12; // eax@6 | |
4574 int v13; // eax@6 | |
4575 unsigned int v14; // ST34_4@8 | |
4576 int v15; // edi@8 | |
4577 int *v16; // [sp+Ch] [bp-28h]@1 | |
4578 int v17; // [sp+10h] [bp-24h]@4 | |
4579 int v18; // [sp+14h] [bp-20h]@1 | |
4580 signed int v19; // [sp+18h] [bp-1Ch]@1 | |
4581 int v20; // [sp+1Ch] [bp-18h]@1 | |
4582 signed int v21; // [sp+20h] [bp-14h]@1 | |
4583 char *v22; // [sp+2Ch] [bp-8h]@2 | |
4584 signed int v23; // [sp+30h] [bp-4h]@1 | |
4585 | |
4586 v1 = pRenderer; | |
4587 v2 = uChestID; | |
4588 v16 = pRenderer->pActiveZBuffer; | |
4589 pRenderer->ClearZBuffer(0, 479); | |
4590 v3 = v2; | |
4591 v4 = pChests[v3].uChestBitmapID; | |
4592 v20 = pChestSmthn1ByType[v4]; | |
4593 v18 = pChestSmthn2ByType[v4]; | |
4594 v21 = pChestWidthsByType[v4]; | |
4595 v19 = pChestHeightsByType[v4]; | |
4596 sprintf(pTmpBuf, "chest%02d", pChestList->pChests[pChests[v3].uChestBitmapID].uTextureID); | |
4597 v5 = pIcons_LOD->LoadTexture(pTmpBuf, TEXTURE_16BIT_PALETTE); | |
4598 pRenderer->DrawTextureIndexed(8u, 8u, (Texture *)(v5 != -1 ? (int)&pIcons_LOD->pTextures[v5] : 0)); | |
4599 v23 = 0; | |
4600 if ( v21 * v19 > 0 ) | |
4601 { | |
4602 v22 = (char *)pChests[v3].pInventoryIndices; | |
4603 do | |
4604 { | |
4605 v6 = *(short *)v22; | |
4606 if ( v6 > 0 ) | |
4607 { | |
4608 v17 = v18 + 32 * v23 / v19; | |
4609 v7 = pIcons_LOD->LoadTexture( | |
4610 pItemsTable->pItems[*(int *)((char *)&pOtherOverlayList->pOverlays[49].field_4 + 36 * v6 + v3 * 5324)].pIconName, | |
4611 TEXTURE_16BIT_PALETTE); | |
4612 v8 = (Texture *)(v7 != -1 ? &pIcons_LOD->pTextures[v7] : 0); | |
4613 v9 = (v7 != -1 ? pIcons_LOD->pTextures[v7].uTextureWidth : 24); | |
4614 v10 = (v7 != -1 ? pIcons_LOD->pTextures[v7].uTextureHeight : 26); | |
4615 v11 = (v7 != -1 ? pIcons_LOD->pTextures[v7].uTextureWidth : 24); | |
4616 if ( v9 < 14 ) | |
4617 v11 = 14; | |
4618 v12 = v11 - 14; | |
4619 LOBYTE(v12) = v12 & 0xE0; | |
4620 v13 = v12 + 32; | |
4621 if ( (signed int)v8->uTextureHeight < 14 ) | |
4622 v10 = 14; | |
4623 v14 = v20 + 32 * v23 % v21 + ((v13 - v9) >> 1); | |
4624 v15 = v17 + ((((v10 - 14) & 0xFFFFFFE0) - v8->uTextureHeight + 32) >> 1); | |
4625 pRenderer->DrawTextureTransparent( | |
4626 v14, | |
4627 v17 + ((((v10 - 14) & 0xFFFFFFE0) - v8->uTextureHeight + 32) >> 1), | |
4628 v8); | |
4629 sub_40F92A(&v16[v14 + pSRZBufferLineOffsets[v15]], v8, v23 + 1); | |
4630 v1 = pRenderer; | |
4631 } | |
4632 ++v23; | |
4633 v22 += 2; | |
4634 } | |
4635 while ( v23 < v21 * v19 ); | |
4636 } | |
24 | 4637 pRenderer->DrawTextureIndexed(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, |
0 | 4638 (Texture *)(uTextureID_506438 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_506438] : 0)); |
4639 } | |
4640 | |
4641 //----- (00420B13) -------------------------------------------------------- | |
4642 void __fastcall sub_420B13(int a1, int a2) | |
4643 { | |
4644 void *v2; // eax@1 | |
4645 ItemGen *v3; // ebx@1 | |
4646 unsigned int v4; // eax@1 | |
4647 Texture *v5; // ecx@1 | |
4648 signed int v6; // eax@1 | |
4649 signed int v7; // edi@3 | |
4650 signed int v8; // eax@3 | |
4651 int v9; // edi@3 | |
4652 int v10; // eax@5 | |
4653 int v11; // esi@8 | |
4654 unsigned int v12; // ecx@10 | |
4655 void *v13; // edi@10 | |
4656 unsigned __int8 v14; // cf@10 | |
4657 int v15; // edi@10 | |
4658 int i; // ecx@10 | |
4659 int v17; // [sp+Ch] [bp-14h]@1 | |
4660 int v18; // [sp+10h] [bp-10h]@3 | |
4661 int v19; // [sp+14h] [bp-Ch]@1 | |
4662 void *v20; // [sp+18h] [bp-8h]@1 | |
4663 int v21; // [sp+1Ch] [bp-4h]@5 | |
4664 int v22; // [sp+1Ch] [bp-4h]@8 | |
4665 | |
4666 v19 = a2; | |
4667 v2 = pChestWindow->ptr_1C; | |
4668 v20 = v2; | |
4669 v2 = (void *)(5324 * (int)v2); | |
4670 v3 = (ItemGen *)((char *)v2 + 36 * a1 + (int)((char *)pChests + 4)); | |
4671 v17 = pChestWidthsByType[*(short *)((char *)v2 + (int)pChests)]; | |
4672 v4 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v3->uItemID].pIconName, TEXTURE_16BIT_PALETTE); | |
4673 v5 = (Texture *)(v4 != -1 ? (int)&pIcons_LOD->pTextures[v4] : 0); | |
4674 v6 = (v4 != -1 ? pIcons_LOD->pTextures[v4].uTextureWidth : 24); | |
4675 if ( v6 < 14 ) | |
4676 v6 = 14; | |
4677 v7 = v6 - 14; | |
4678 v8 = v5->uTextureHeight; | |
4679 v9 = (v7 >> 5) + 1; | |
4680 v18 = v9; | |
4681 if ( v8 < 14 ) | |
4682 v8 = 14; | |
4683 v10 = ((v8 - 14) >> 5) + 1; | |
4684 v21 = v10; | |
4685 if ( !areWeLoadingTexture ) | |
4686 { | |
4687 v5->Release(); | |
4688 pIcons_LOD->_40F9C5(); | |
4689 v10 = v21; | |
4690 } | |
4691 if ( v10 > 0 ) | |
4692 { | |
4693 v11 = 0; | |
4694 v22 = v10; | |
4695 do | |
4696 { | |
4697 if ( v9 > 0 ) | |
4698 { | |
4699 v12 = v9; | |
4700 v13 = &pChests[0].pInventoryIndices[v19 + v11 + 2662 * (int)v20]; | |
4701 v14 = v12 & 1; | |
4702 v12 >>= 1; | |
4703 memset(v13, 0, 4 * v12); | |
4704 v15 = (int)((char *)v13 + 4 * v12); | |
4705 for ( i = v14; i; --i ) | |
4706 { | |
4707 *(short *)v15 = 0; | |
4708 v15 += 2; | |
4709 } | |
4710 v9 = v18; | |
4711 } | |
4712 v11 += v17; | |
4713 --v22; | |
4714 } | |
4715 while ( v22 ); | |
4716 } | |
4717 v3->Reset(); | |
4718 } | |
4719 // 506128: using guessed type int areWeLoadingTexture; | |
4720 | |
4721 //----- (00420C05) -------------------------------------------------------- | |
4722 void __fastcall party_finds_gold(unsigned int uNumGold, int _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal) | |
4723 { | |
4724 unsigned int v2; // edi@1 | |
4725 int v3; // ebp@1 | |
4726 unsigned int v4; // esi@1 | |
4727 int v5; // ecx@6 | |
4728 NPCData *v6; // eax@6 | |
4729 signed int v7; // edx@8 | |
4730 signed int v8; // ebx@10 | |
4731 char *v9; // edi@11 | |
4732 signed int v10; // ecx@17 | |
4733 int v11; // eax@21 | |
4734 NPCData *v12; // ecx@21 | |
4735 unsigned int v13; // ecx@23 | |
4736 signed int v14; // [sp+Ch] [bp-4h]@6 | |
4737 | |
4738 v2 = 0; | |
4739 v3 = 0; | |
4740 v4 = uNumGold; | |
4741 if ( _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal ) | |
4742 { | |
4743 if ( _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal == 1 ) | |
4744 { | |
4745 sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[467], uNumGold);// You found %lu gold! | |
4746 } | |
4747 else | |
4748 { | |
4749 if ( _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal == 2 ) | |
4750 pTmpBuf2[0] = 0; | |
4751 } | |
4752 } | |
4753 else | |
4754 { | |
4755 v14 = 0; | |
4756 v5 = 0; | |
4757 v6 = pParty->pHirelings; | |
4758 do | |
4759 { | |
4760 if ( v6->pName ) | |
4761 { | |
4762 v7 = v14++; | |
4763 pTmpBuf[v7] = v5; | |
4764 } | |
4765 ++v6; | |
4766 ++v5; | |
4767 } | |
4768 while ( (signed int)v6 < (signed int)&pParty->pPickedItem ); | |
4769 v8 = 0; | |
4770 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
4771 { | |
4772 v9 = (char *)pNPCStats->pNewNPCData; | |
4773 do | |
4774 { | |
4775 if ( v9[8] & 0x80 | |
4776 && (!pParty->pHirelings[0].pName || strcmp(*(const char **)v9, pParty->pHirelings[0].pName)) | |
4777 && (!pParty->pHirelings[1].pName || strcmp(*(const char **)v9, pParty->pHirelings[1].pName)) ) | |
4778 { | |
4779 v10 = v14++; | |
4780 pTmpBuf[v10] = v8 + 2; | |
4781 } | |
4782 ++v8; | |
4783 v9 += 76; | |
4784 } | |
4785 while ( v8 < (signed int)pNPCStats->uNumNewNPCs ); | |
4786 v2 = 0; | |
4787 } | |
4788 if ( v14 > 0 ) | |
4789 { | |
4790 do | |
4791 { | |
4792 v11 = (unsigned __int8)pTmpBuf[v2]; | |
4793 v12 = &pNPCStats->pNPCData[v11 + 499]; | |
33 | 4794 if ( (unsigned __int8)pTmpBuf[v2] < 2 ) |
0 | 4795 v12 = &pParty->pHirelings[v11]; |
4796 v13 = v12->uProfession; | |
4797 if ( v13 ) | |
4798 v3 += *(&pNPCStats->field_13A58 + 5 * v13); | |
4799 ++v2; | |
4800 } | |
4801 while ( (signed int)v2 < v14 ); | |
4802 } | |
4803 if ( CheckHiredNPCSpeciality(0x1Fu) ) | |
4804 v4 += (signed int)(10 * v4) / 100; | |
4805 if ( CheckHiredNPCSpeciality(0x20u) ) | |
4806 v4 += (signed int)(20 * v4) / 100; | |
4807 if ( CheckHiredNPCSpeciality(0x2Du) ) | |
4808 v4 += (signed int)(10 * v4) / 100; | |
4809 if ( v3 ) | |
4810 { | |
4811 v3 = (signed int)(v4 * v3 / 100) / 100; | |
4812 if ( v3 < 1 ) | |
4813 v3 = 1; | |
4814 sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[466], v4, v3);// You found %lu gold (followers take %lu)! | |
4815 } | |
4816 else | |
4817 { | |
4818 sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[467], v4);// You found %lu gold! | |
4819 } | |
4820 v2 = 0; | |
4821 } | |
4822 pParty->uNumGold += v4 - v3; | |
4823 pUIAnim_Gold->uAnimTime = v2; | |
4824 pUIAnim_Gold->uAnimLength = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Gold->uIconID].uAnimLength; | |
4825 if ( pTmpBuf2[0] ) | |
4826 ShowStatusBarString(pTmpBuf2, 2u); | |
4827 pAudioPlayer->PlaySound(SOUND_GoldReceived, v2, v2, -1, v2, v2, v2, v2); | |
4828 } | |
4829 | |
4830 //----- (00420E01) -------------------------------------------------------- | |
4831 void __cdecl sub_420E01() | |
4832 { | |
4833 void *v0; // edi@1 | |
4834 POINT *v1; // esi@2 | |
4835 int v2; // eax@2 | |
4836 int v3; // ebx@4 | |
4837 int v4; // esi@6 | |
4838 int v5; // ecx@6 | |
4839 //LayingItem v6; // [sp+Ch] [bp-80h]@1 | |
4840 char v7; // [sp+7Ch] [bp-10h]@2 | |
4841 POINT a2; // [sp+84h] [bp-8h]@2 | |
4842 | |
4843 LayingItem v6; // [sp+Ch] [bp-80h]@1 | |
4844 //LayingItem::LayingItem(&v6); | |
4845 | |
4846 v0 = pGUIWindow_CurrentMenu->ptr_1C; | |
4847 if ( pParty->pPickedItem.uItemID ) | |
4848 { | |
4849 if ( Chest::_41FFA2(-1, &pParty->pPickedItem, (unsigned int)pGUIWindow_CurrentMenu->ptr_1C) ) | |
4850 pMouse->RemoveHoldingItem(); | |
4851 } | |
4852 else | |
4853 { | |
4854 v1 = pMouse->GetCursorPos(&a2); | |
4855 v2 = pRenderer->pActiveZBuffer[v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v7)->y]] & 0xFFFF; | |
4856 if ( v2 ) | |
4857 { | |
4858 if ( v2 ) | |
4859 v3 = v2 - 1; | |
4860 else | |
4861 v3 = -1; | |
4862 v4 = pChests[0].pInventoryIndices[v3 + 2662 * (int)v0] - 1; | |
4863 v5 = 5324 * (int)v0 + 36 * v4; | |
4864 if ( pItemsTable->pItems[*(unsigned int *)((char *)&pChests[0].mm7__vector_pItems[0].uItemID + v5)].uEquipType == 18 ) | |
4865 { | |
4866 party_finds_gold(*(int *)((char *)&pChests[0].mm7__vector_pItems[0].uAdditionalValue + v5), 0); | |
4867 viewparams->bRedrawGameUI = 1; | |
4868 } | |
4869 else | |
4870 { | |
4871 pParty->SetHoldingItem((ItemGen *)((char *)pChests[0].mm7__vector_pItems + v5)); | |
4872 } | |
4873 sub_420B13(v4, v3); | |
4874 } | |
4875 } | |
4876 } | |
4877 | |
4878 //----- (00420EFF) -------------------------------------------------------- | |
4879 void __cdecl GameUI_WritePointedObjectStatusString() | |
4880 { | |
4881 int v1; // ebx@6 | |
8 | 4882 GUIWindow *pWindow; // edi@7 |
4883 GUIButton *pButton; // ecx@11 | |
4884 Player *pPlayer; // eax@19 | |
0 | 4885 char v5; // cl@19 |
4886 unsigned int v6; // eax@19 | |
4887 int v7; // ecx@19 | |
4888 __int16 v8; // fps@23 | |
4889 unsigned __int8 v9; // c0@23 | |
4890 unsigned __int8 v10; // c3@23 | |
8 | 4891 enum UIMessageType pMessageType1; // esi@24 |
0 | 4892 int v12; // edx@25 |
4893 char *v13; // ecx@28 | |
4894 int v14; // eax@41 | |
8 | 4895 ItemGen *pItemGen; // ecx@44 |
0 | 4896 int v16; // ecx@46 |
4897 const char *v17; // eax@49 | |
4898 signed int v18; // eax@55 | |
4899 signed int v19; // ecx@63 | |
4900 BLVFace *pFace; // eax@69 | |
4901 __int16 v21; // ax@70 | |
4902 const char *v22; // eax@72 | |
4903 LevelDecoration *v23; // ecx@75 | |
4904 LevelDecoration *v24; // esi@75 | |
4905 __int16 v25; // ax@75 | |
4906 const char *v26; // ecx@79 | |
4907 Actor *pActor; // ecx@82 | |
4908 char *v28; // esi@82 | |
4909 int v29; // eax@82 | |
4910 signed int v30; // ecx@88 | |
4911 const char *v31; // eax@91 | |
4912 __int16 v32; // fps@109 | |
14 | 4913 //unsigned __int8 v33; // c0@109 |
4914 //unsigned __int8 v34; // c3@109 | |
8 | 4915 enum UIMessageType pMessageType2; // esi@110 |
0 | 4916 int v36; // edx@111 |
8 | 4917 enum UIMessageType pMessageType3; // edx@117 |
0 | 4918 int v38; // ecx@118 |
4919 const char *v39; // [sp-8h] [bp-E8h]@20 | |
4920 char *v40; // [sp-8h] [bp-E8h]@83 | |
4921 int v41; // [sp-4h] [bp-E4h]@20 | |
4922 char Str1[200]; // [sp+Ch] [bp-D4h]@129 | |
4923 unsigned int pX; // [sp+D4h] [bp-Ch]@1 | |
4924 unsigned int pY; // [sp+D8h] [bp-8h]@1 | |
4925 unsigned int v45; // [sp+DCh] [bp-4h]@21 | |
4926 | |
4927 v13 = nullptr; | |
4928 | |
4929 pMouse->uPointingObjectID = 0; | |
4930 pMouse->GetClickPos(&pX, &pY); | |
14 | 4931 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 ) |
0 | 4932 return; |
4933 if ( !pCurrentScreen ) | |
4934 { | |
4935 if ( (signed int)pX > 467 || (signed int)pY > 351 ) | |
4936 goto _click_on_game_ui; | |
4937 if ( pRenderer->pRenderD3D ) | |
4938 { | |
4939 v18 = pGame->pVisInstance->get_picked_object_zbuf_val(); | |
4940 if ( (signed int)pX < (signed int)pViewport->uScreenX | |
4941 || (signed int)pX > (signed int)pViewport->uScreenZ | |
4942 || (signed int)pY < (signed int)pViewport->uScreenY | |
4943 || (signed int)pY > (signed int)pViewport->uScreenW ) | |
4944 v18 = -1; | |
4945 if ( v18 == -1 ) | |
8 | 4946 //goto LABEL_61; |
4947 { | |
4948 pMouse->uPointingObjectID = 0; | |
4949 if ( pMouse->uPointingObjectID == 0 ) | |
4950 { | |
4951 if ( uLastPointedObjectID != 0 ) | |
4952 { | |
4953 pStatusBarString[0] = 0; | |
4954 bForceDrawStatusBar = 1; | |
4955 } | |
4956 } | |
4957 uLastPointedObjectID = pMouse->uPointingObjectID; | |
4958 return; | |
4959 } | |
0 | 4960 } |
4961 else | |
4962 { | |
4963 v18 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]]; | |
4964 } | |
4965 pMouse->uPointingObjectID = (unsigned __int16)v18; | |
4966 v19 = (signed int)(unsigned __int16)v18 >> 3; | |
4967 if ( (v18 & 7) == OBJECT_Item ) | |
4968 { | |
4969 v30 = v19; | |
4970 if ( pObjectList->pObjects[pLayingItems[v30].uObjectDescID].uFlags & 0x10 ) | |
8 | 4971 //goto LABEL_73; |
4972 { | |
4973 pMouse->uPointingObjectID = 0; | |
4974 //goto LABEL_50; | |
4975 uLastPointedObjectID = 1; | |
4976 if ( pMouse->uPointingObjectID == 0 ) | |
4977 { | |
4978 if ( uLastPointedObjectID != 0 ) | |
4979 { | |
4980 pStatusBarString[0] = 0; | |
4981 bForceDrawStatusBar = 1; | |
4982 } | |
4983 } | |
4984 uLastPointedObjectID = pMouse->uPointingObjectID; | |
4985 return; | |
4986 } | |
0 | 4987 if ( v18 >= (signed int)0x2000000u || pParty->pPickedItem.uItemID ) |
4988 { | |
4989 v22 = pLayingItems[v30].stru_24.GetDisplayName(); | |
8 | 4990 //LABEL_93: |
0 | 4991 v26 = v22; |
8 | 4992 //goto LABEL_87; |
4993 sub_41C0B8_set_status_string(v26); | |
4994 if ( pMouse->uPointingObjectID == 0 ) | |
4995 { | |
4996 if ( uLastPointedObjectID != 0 ) | |
4997 { | |
4998 pStatusBarString[0] = 0; | |
4999 bForceDrawStatusBar = 1; | |
5000 } | |
5001 } | |
5002 uLastPointedObjectID = pMouse->uPointingObjectID; | |
5003 return; | |
0 | 5004 } |
5005 v31 = pLayingItems[v30].stru_24.GetDisplayName(); | |
5006 v28 = pTmpBuf; | |
5007 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[470], v31);// "Get %s" | |
5008 } | |
5009 else | |
5010 { | |
5011 if ( (v18 & 7) != OBJECT_Actor ) | |
5012 { | |
5013 if ( (v18 & 7) == OBJECT_Decoration ) | |
5014 { | |
5015 v23 = &pLevelDecorations[v19]; | |
5016 v24 = v23; | |
5017 v25 = v23->field_16_event_id; | |
5018 if ( !v25 ) | |
5019 { | |
5020 if ( v23->IsInteractive() ) | |
5021 v26 = pNPCTopics[stru_5E4C90._decor_events[v24->_idx_in_stru123 - 75] + 379].pTopic; | |
5022 else | |
5023 v26 = pDecorationList->pDecorations[v24->uDecorationDescID].field_20; | |
8 | 5024 //goto LABEL_87; |
5025 sub_41C0B8_set_status_string(v26); | |
5026 if ( pMouse->uPointingObjectID == 0 ) | |
5027 { | |
5028 if ( uLastPointedObjectID != 0 ) | |
5029 { | |
5030 pStatusBarString[0] = 0; | |
5031 bForceDrawStatusBar = 1; | |
5032 } | |
5033 } | |
5034 uLastPointedObjectID = pMouse->uPointingObjectID; | |
5035 return; | |
0 | 5036 } |
5037 v22 = _444732_GetEventHintString(v25); | |
5038 if ( !v22 ) | |
8 | 5039 //goto _return; |
5040 { | |
5041 if ( pMouse->uPointingObjectID == 0 ) | |
5042 { | |
5043 if ( uLastPointedObjectID != 0 ) | |
5044 { | |
5045 pStatusBarString[0] = 0; | |
5046 bForceDrawStatusBar = 1; | |
5047 } | |
5048 } | |
5049 uLastPointedObjectID = pMouse->uPointingObjectID; | |
5050 return; | |
5051 } | |
5052 //goto LABEL_93; | |
5053 v26 = v22; | |
5054 //goto LABEL_87; | |
5055 sub_41C0B8_set_status_string(v26); | |
5056 if ( pMouse->uPointingObjectID == 0 ) | |
5057 { | |
5058 if ( uLastPointedObjectID != 0 ) | |
5059 { | |
5060 pStatusBarString[0] = 0; | |
5061 bForceDrawStatusBar = 1; | |
5062 } | |
5063 } | |
5064 uLastPointedObjectID = pMouse->uPointingObjectID; | |
5065 return; | |
0 | 5066 } |
5067 if ( (v18 & 7) == 6 ) // bmodel | |
5068 { | |
5069 if ( v18 < (signed int)0x2000000u ) | |
5070 { | |
5071 if ( uCurrentlyLoadedLevelType != LEVEL_Indoor) | |
5072 { | |
5073 v21 = pOutdoor->pBModels[(signed int)(unsigned __int16)v18 >> 9].pFaces[v19 & 0x3F].sCogTriggeredID; | |
8 | 5074 //goto LABEL_71; |
5075 if ( !v21 || (v22 = _444732_GetEventHintString(v21)) == 0 ) | |
5076 //goto LABEL_73; | |
5077 { | |
5078 pMouse->uPointingObjectID = 0; | |
5079 //goto LABEL_50; | |
5080 uLastPointedObjectID = 1; | |
5081 if ( pMouse->uPointingObjectID == 0 ) | |
5082 { | |
5083 if ( uLastPointedObjectID != 0 ) | |
5084 { | |
5085 pStatusBarString[0] = 0; | |
5086 bForceDrawStatusBar = 1; | |
5087 } | |
5088 } | |
5089 uLastPointedObjectID = pMouse->uPointingObjectID; | |
5090 return; | |
5091 } | |
5092 //goto LABEL_93; | |
5093 v26 = v22; | |
5094 //goto LABEL_87; | |
5095 sub_41C0B8_set_status_string(v26); | |
5096 if ( pMouse->uPointingObjectID == 0 ) | |
5097 { | |
5098 if ( uLastPointedObjectID != 0 ) | |
5099 { | |
5100 pStatusBarString[0] = 0; | |
5101 bForceDrawStatusBar = 1; | |
5102 } | |
5103 } | |
5104 uLastPointedObjectID = pMouse->uPointingObjectID; | |
5105 return; | |
0 | 5106 } |
5107 pFace = &pIndoor->pFaces[v19]; | |
5108 if ( BYTE3(pFace->uAttributes) & 6 ) | |
5109 { | |
5110 v21 = pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID; | |
8 | 5111 //LABEL_71: |
0 | 5112 if ( !v21 || (v22 = _444732_GetEventHintString(v21)) == 0 ) |
8 | 5113 //goto LABEL_73; |
5114 { | |
5115 pMouse->uPointingObjectID = 0; | |
5116 //goto LABEL_50; | |
5117 uLastPointedObjectID = 1; | |
5118 if ( pMouse->uPointingObjectID == 0 ) | |
5119 { | |
5120 if ( uLastPointedObjectID != 0 ) | |
5121 { | |
5122 pStatusBarString[0] = 0; | |
5123 bForceDrawStatusBar = 1; | |
5124 } | |
5125 } | |
5126 uLastPointedObjectID = pMouse->uPointingObjectID; | |
5127 return; | |
5128 } | |
5129 //goto LABEL_93; | |
5130 v26 = v22; | |
5131 //goto LABEL_87; | |
5132 sub_41C0B8_set_status_string(v26); | |
5133 if ( pMouse->uPointingObjectID == 0 ) | |
5134 { | |
5135 if ( uLastPointedObjectID != 0 ) | |
5136 { | |
5137 pStatusBarString[0] = 0; | |
5138 bForceDrawStatusBar = 1; | |
5139 } | |
5140 } | |
5141 uLastPointedObjectID = pMouse->uPointingObjectID; | |
5142 return; | |
0 | 5143 } |
5144 } | |
8 | 5145 //LABEL_73: |
0 | 5146 pMouse->uPointingObjectID = 0; |
8 | 5147 //goto LABEL_50; |
5148 uLastPointedObjectID = 1; | |
5149 if ( pMouse->uPointingObjectID == 0 ) | |
5150 { | |
5151 if ( uLastPointedObjectID != 0 ) | |
5152 { | |
5153 pStatusBarString[0] = 0; | |
5154 bForceDrawStatusBar = 1; | |
5155 } | |
5156 } | |
5157 uLastPointedObjectID = pMouse->uPointingObjectID; | |
5158 return; | |
0 | 5159 } |
8 | 5160 //LABEL_61: |
0 | 5161 pMouse->uPointingObjectID = 0; |
8 | 5162 //goto _return; |
5163 if ( pMouse->uPointingObjectID == 0 ) | |
5164 { | |
5165 if ( uLastPointedObjectID != 0 ) | |
5166 { | |
5167 pStatusBarString[0] = 0; | |
5168 bForceDrawStatusBar = 1; | |
5169 } | |
5170 } | |
5171 uLastPointedObjectID = pMouse->uPointingObjectID; | |
5172 return; | |
0 | 5173 } |
5174 if ( v18 >= 335544320 ) | |
8 | 5175 //goto LABEL_61; |
5176 { | |
5177 pMouse->uPointingObjectID = 0; | |
5178 if ( pMouse->uPointingObjectID == 0 ) | |
5179 { | |
5180 if ( uLastPointedObjectID != 0 ) | |
5181 { | |
5182 pStatusBarString[0] = 0; | |
5183 bForceDrawStatusBar = 1; | |
5184 } | |
5185 } | |
5186 uLastPointedObjectID = pMouse->uPointingObjectID; | |
5187 return; | |
5188 } | |
0 | 5189 pActor = &pActors[v19]; |
5190 v28 = pTmpBuf; | |
5191 v29 = pActor->dword_000334_unique_name; | |
5192 if ( v29 ) | |
5193 v40 = (char *)*(&pMonsterStats->pPlacement.uNumStrings + v29); | |
5194 else | |
5195 v40 = pMonsterStats->pInfos[pActor->pMonsterInfo.uID].pName; | |
5196 strncpy(pTmpBuf, v40, 0x7D0u); | |
5197 } | |
5198 v26 = v28; | |
8 | 5199 //LABEL_87: |
0 | 5200 sub_41C0B8_set_status_string(v26); |
8 | 5201 //goto _return; |
5202 if ( pMouse->uPointingObjectID == 0 ) | |
5203 { | |
5204 if ( uLastPointedObjectID != 0 ) | |
5205 { | |
5206 pStatusBarString[0] = 0; | |
5207 bForceDrawStatusBar = 1; | |
5208 } | |
5209 } | |
5210 uLastPointedObjectID = pMouse->uPointingObjectID; | |
5211 return; | |
0 | 5212 } |
5213 v1 = uNumVisibleWindows; | |
5214 if ( uNumVisibleWindows <= 0 ) | |
5215 { | |
5216 LABEL_38: | |
17 | 5217 if ( pCurrentScreen == 10 ) // ChestScreen |
0 | 5218 { |
5219 sub_42038D(); | |
8 | 5220 //goto _return; |
5221 if ( pMouse->uPointingObjectID == 0 ) | |
5222 { | |
5223 if ( uLastPointedObjectID != 0 ) | |
5224 { | |
5225 pStatusBarString[0] = 0; | |
5226 bForceDrawStatusBar = 1; | |
5227 } | |
5228 } | |
5229 uLastPointedObjectID = pMouse->uPointingObjectID; | |
5230 return; | |
0 | 5231 } |
17 | 5232 if ( pCurrentScreen == 13 ) // HouseScreen |
0 | 5233 { |
5234 if ( dword_F8B19C != 2 | |
5235 || (v16 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]], v16 == 0) | |
5236 || v16 == -65536 ) | |
8 | 5237 //goto _return; |
5238 { | |
5239 if ( pMouse->uPointingObjectID == 0 ) | |
5240 { | |
5241 if ( uLastPointedObjectID != 0 ) | |
5242 { | |
5243 pStatusBarString[0] = 0; | |
5244 bForceDrawStatusBar = 1; | |
5245 } | |
5246 } | |
5247 uLastPointedObjectID = pMouse->uPointingObjectID; | |
5248 return; | |
5249 } | |
5250 pItemGen = (ItemGen *)((char *)&pParty->pPickedItem + 36 * (v16 + 12 * (unsigned int)ptr_507BC0->ptr_1C) + 4); | |
5251 //LABEL_49: | |
5252 v17 = pItemGen->GetDisplayName(); | |
0 | 5253 sub_41C0B8_set_status_string(v17); |
8 | 5254 //LABEL_50: |
0 | 5255 uLastPointedObjectID = 1; |
8 | 5256 //_return: |
0 | 5257 if ( pMouse->uPointingObjectID == 0 ) |
5258 { | |
5259 if ( uLastPointedObjectID != 0 ) | |
5260 { | |
5261 pStatusBarString[0] = 0; | |
5262 bForceDrawStatusBar = 1; | |
5263 } | |
5264 } | |
5265 uLastPointedObjectID = pMouse->uPointingObjectID; | |
5266 return; | |
5267 } | |
5268 if ( (signed int)pY < 350 ) | |
5269 { | |
5270 v14 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]]; | |
5271 if ( v14 == 0 || v14 == -65536 || (unsigned int)v14 >= 0x1388 ) | |
8 | 5272 //goto _return; |
5273 { | |
5274 if ( pMouse->uPointingObjectID == 0 ) | |
5275 { | |
5276 if ( uLastPointedObjectID != 0 ) | |
5277 { | |
5278 pStatusBarString[0] = 0; | |
5279 bForceDrawStatusBar = 1; | |
5280 } | |
5281 } | |
5282 uLastPointedObjectID = pMouse->uPointingObjectID; | |
5283 return; | |
5284 } | |
5285 pItemGen = (ItemGen *)&pPlayers[uActiveCharacter]->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v14 + 5]; | |
5286 //goto LABEL_49; | |
5287 v17 = pItemGen->GetDisplayName(); | |
5288 sub_41C0B8_set_status_string(v17); | |
5289 uLastPointedObjectID = 1; | |
5290 if ( pMouse->uPointingObjectID == 0 ) | |
5291 { | |
5292 if ( uLastPointedObjectID != 0 ) | |
5293 { | |
5294 pStatusBarString[0] = 0; | |
5295 bForceDrawStatusBar = 1; | |
5296 } | |
5297 } | |
5298 uLastPointedObjectID = pMouse->uPointingObjectID; | |
5299 return; | |
0 | 5300 } |
5301 _click_on_game_ui: | |
5302 if ( (signed int)pX >= (signed int)pWindowList[0].uFrameX | |
5303 && (signed int)pX <= (signed int)pWindowList[0].uFrameZ | |
5304 && (signed int)pY >= (signed int)pWindowList[0].uFrameY | |
5305 && (signed int)pY <= (signed int)pWindowList[0].uFrameW ) | |
5306 { | |
8 | 5307 for ( pButton = pWindowList[0].pControlsHead; pButton != (GUIButton *)0; pButton = pButton->pNext ) |
5308 { | |
5309 if ( pButton->uButtonType == 1 ) | |
0 | 5310 { |
8 | 5311 if ( (signed int)pX >= (signed int)pButton->uX |
5312 && (signed int)pX <= (signed int)pButton->uZ | |
5313 && (signed int)pY >= (signed int)pButton->uY | |
5314 && (signed int)pY <= (signed int)pButton->uW ) | |
0 | 5315 { |
8 | 5316 pMessageType3 = (UIMessageType)pButton->field_1C; |
17 | 5317 if ( pMessageType3 == 0 ) // For books |
8 | 5318 //goto LABEL_28; |
5319 { | |
5320 v13 = pButton->pButtonName; | |
5321 sub_41C0B8_set_status_string(v13); | |
5322 uLastPointedObjectID = 1; | |
5323 return; | |
5324 } | |
5325 v38 = pButton->uControlParam; | |
0 | 5326 if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
5327 { | |
8 | 5328 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = pMessageType3; |
0 | 5329 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v38; |
5330 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
5331 ++pMessageQueue_50CBD0->uNumMessages; | |
5332 } | |
8 | 5333 //goto LABEL_131; |
0 | 5334 uLastPointedObjectID = 1; |
5335 return; | |
5336 } | |
5337 } | |
5338 else | |
5339 { | |
8 | 5340 if ( pButton->uButtonType == 2 ) |
0 | 5341 { |
8 | 5342 v45 = pX - pButton->uX; |
5343 v45 = pY - pButton->uY; | |
5344 | |
5345 if (pX >= pButton->uX && pX <= pButton->uZ && | |
5346 pY >= pButton->uY && pY <= pButton->uW) | |
5347 if ( (double)(signed int)pButton->uWidth != 0.0 ) | |
0 | 5348 { |
8 | 5349 if ( (double)(signed int)pButton->uHeight != 0.0 ) |
0 | 5350 { |
8 | 5351 //UNDEF(v32); |
14 | 5352 //if ( v33 | v34 ) |
5353 //{ | |
8 | 5354 pMessageType2 = (UIMessageType)pButton->field_1C; |
5355 if ( pMessageType2 != 0 ) | |
5356 { | |
5357 v36 = pButton->uControlParam; | |
5358 if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
5359 { | |
5360 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = pMessageType2; | |
5361 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v36; | |
5362 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
5363 //goto LABEL_27; | |
5364 ++pMessageQueue_50CBD0->uNumMessages; | |
5365 v13 = pButton->pButtonName; | |
5366 sub_41C0B8_set_status_string(v13); | |
5367 uLastPointedObjectID = 1; | |
5368 return; | |
5369 } | |
5370 } | |
5371 //goto LABEL_28; | |
5372 v13 = pButton->pButtonName; | |
5373 sub_41C0B8_set_status_string(v13); | |
5374 uLastPointedObjectID = 1; | |
5375 return; | |
14 | 5376 //} |
0 | 5377 } |
5378 } | |
5379 } | |
8 | 5380 else |
0 | 5381 { |
8 | 5382 if ( pButton->uButtonType == 3 |
5383 && (signed int)pX >= (signed int)pButton->uX | |
5384 && (signed int)pX <= (signed int)pButton->uZ | |
5385 && (signed int)pY >= (signed int)pButton->uY | |
5386 && (signed int)pY <= (signed int)pButton->uW ) | |
5387 //goto LABEL_19; | |
0 | 5388 { |
8 | 5389 pPlayer = pPlayers[uActiveCharacter]; |
5390 v5 = LOBYTE(pPlayer->pActiveSkills[pButton->uControlParam]); | |
5391 v6 = pPlayer->uSkillPoints; | |
0 | 5392 v7 = (v5 & 0x3F) + 1; |
5393 if ( v6 < v7 ) | |
5394 { | |
5395 v41 = v7 - v6; | |
5396 v39 = pGlobalTXT_LocalizationStrings[469];// "You need %d more Skill Points to advance here" | |
5397 } | |
5398 else | |
5399 { | |
5400 v41 = v7; | |
5401 v39 = pGlobalTXT_LocalizationStrings[468];// "Clicking here will spend %d Skill Points" | |
5402 } | |
5403 sprintf(Str1, v39, v41); | |
5404 v13 = Str1; | |
8 | 5405 //goto _set_status_and_ret; |
5406 sub_41C0B8_set_status_string(v13); | |
5407 uLastPointedObjectID = 1; | |
5408 return; | |
0 | 5409 } |
5410 } | |
5411 } | |
5412 } | |
5413 } | |
8 | 5414 pMouse->uPointingObjectID = sub_46A99B(); |
5415 //goto _return; | |
5416 if ( pMouse->uPointingObjectID == 0 ) | |
5417 { | |
5418 if ( uLastPointedObjectID != 0 ) | |
5419 { | |
5420 pStatusBarString[0] = 0; | |
5421 bForceDrawStatusBar = 1; | |
5422 } | |
5423 } | |
5424 uLastPointedObjectID = pMouse->uPointingObjectID; | |
5425 return; | |
5426 } | |
5427 while ( 1 ) // some other fullscreen ui | |
5428 { | |
5429 pWindow = &pWindowList[pVisibleWindowsIdxs[v1] - 1]; | |
5430 if ( (signed int)pX >= (signed int)pWindow->uFrameX | |
5431 && (signed int)pX <= (signed int)pWindow->uFrameZ | |
5432 && (signed int)pY >= (signed int)pWindow->uFrameY | |
5433 && (signed int)pY <= (signed int)pWindow->uFrameW ) | |
5434 { | |
5435 for ( pButton = pWindow->pControlsHead; ; pButton = pButton->pNext ) | |
5436 { | |
5437 if ( !pButton ) | |
5438 break; | |
5439 if ( pButton->uButtonType == 1 ) | |
5440 { | |
5441 if ( (signed int)pX >= (signed int)pButton->uX | |
5442 && (signed int)pX <= (signed int)pButton->uZ | |
5443 && (signed int)pY >= (signed int)pButton->uY | |
5444 && (signed int)pY <= (signed int)pButton->uW ) | |
5445 { | |
5446 //LABEL_24: | |
5447 pMessageType1 = (UIMessageType)pButton->field_1C; | |
5448 if ( pMessageType1 ) | |
5449 { | |
5450 v12 = pButton->uControlParam; | |
5451 if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
5452 { | |
5453 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = pMessageType1; | |
5454 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v12; | |
5455 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
5456 //LABEL_27: | |
5457 ++pMessageQueue_50CBD0->uNumMessages; | |
5458 } | |
5459 } | |
5460 //LABEL_28: | |
5461 v13 = pButton->pButtonName; | |
5462 //_set_status_and_ret: | |
5463 sub_41C0B8_set_status_string(v13); | |
5464 //LABEL_131: | |
5465 uLastPointedObjectID = 1; | |
5466 return; | |
5467 } | |
5468 } | |
5469 else | |
5470 { | |
5471 if ( pButton->uButtonType == 2 ) | |
5472 { | |
5473 v45 = pX - pButton->uX; | |
5474 v45 = pY - pButton->uY; | |
5475 if ( (double)(signed int)pButton->uWidth != 0.0 ) | |
5476 { | |
5477 if ( (double)(signed int)pButton->uHeight != 0.0 ) | |
5478 { | |
5479 //UNDEF(v8); | |
14 | 5480 //if ( v9 | v10 ) |
8 | 5481 //goto LABEL_24; |
14 | 5482 //{ |
8 | 5483 pMessageType1 = (UIMessageType)pButton->field_1C; |
5484 if ( pMessageType1 ) | |
5485 { | |
5486 v12 = pButton->uControlParam; | |
5487 if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
5488 { | |
5489 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = pMessageType1; | |
5490 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v12; | |
5491 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
5492 ++pMessageQueue_50CBD0->uNumMessages; | |
5493 } | |
5494 } | |
5495 v13 = pButton->pButtonName; | |
5496 sub_41C0B8_set_status_string(v13); | |
5497 uLastPointedObjectID = 1; | |
5498 return; | |
14 | 5499 //} |
8 | 5500 } |
5501 } | |
5502 } | |
5503 else // click on skill | |
5504 { | |
5505 if ( pButton->uButtonType == 3 | |
5506 && (signed int)pX >= (signed int)pButton->uX | |
5507 && (signed int)pX <= (signed int)pButton->uZ | |
5508 && (signed int)pY >= (signed int)pButton->uY | |
5509 && (signed int)pY <= (signed int)pButton->uW ) | |
5510 { | |
5511 //LABEL_19: | |
5512 pPlayer = pPlayers[uActiveCharacter]; | |
5513 v5 = LOBYTE(pPlayer->pActiveSkills[pButton->uControlParam]); | |
5514 v6 = pPlayer->uSkillPoints; | |
5515 v7 = (v5 & 0x3F) + 1; | |
5516 if ( v6 < v7 ) | |
5517 { | |
5518 v41 = v7 - v6; | |
5519 v39 = pGlobalTXT_LocalizationStrings[469];// "You need %d more Skill Points to advance here" | |
5520 } | |
5521 else | |
5522 { | |
5523 v41 = v7; | |
5524 v39 = pGlobalTXT_LocalizationStrings[468];// "Clicking here will spend %d Skill Points" | |
5525 } | |
5526 sprintf(Str1, v39, v41); | |
5527 v13 = Str1; | |
5528 //goto _set_status_and_ret; | |
5529 sub_41C0B8_set_status_string(v13); | |
5530 uLastPointedObjectID = 1; | |
5531 return; | |
5532 } | |
5533 } | |
5534 } | |
5535 } | |
5536 } | |
5537 if ( pWindow->uFrameHeight == 480 ) | |
0 | 5538 break; |
5539 --v1; | |
5540 if ( v1 <= 0 ) | |
5541 { | |
5542 goto LABEL_38; | |
5543 } | |
5544 } | |
5545 } | |
5546 | |
5547 | |
5548 //----- (00421626) -------------------------------------------------------- | |
5549 GUIWindow *GameUI_InitializeCharacterWindow(unsigned int _this) | |
5550 { | |
5551 unsigned int v1; // edi@1 | |
11 | 5552 GUIWindow *pWindow; // edi@3 |
0 | 5553 |
5554 ++pIcons_LOD->uTexturePacksCount; | |
5555 v1 = _this; | |
5556 if ( !pIcons_LOD->uNumPrevLoadedFiles ) | |
5557 pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; | |
5558 pEventTimer->Pause(); | |
5559 pAudioPlayer->StopChannels(-1, -1); | |
5560 bRingsShownInCharScreen = 0; | |
5561 CharacterUI_LoadPaperdollTextures(); | |
5562 pCurrentScreen = v1; | |
11 | 5563 pWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_CharacterRecord, uActiveCharacter, 0); |
5564 pCharacterScreen_StatsBtn = pWindow->CreateButton(pViewport->uViewportX + 12, pViewport->uViewportY + 308, | |
0 | 5565 (papredoll_dbrds[9] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[9]].uTextureWidth : 24), |
5566 (papredoll_dbrds[9] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[9]].uTextureHeight : 26), | |
11 | 5567 1, 0, 0x73u, 0, 0x53u, pGlobalTXT_LocalizationStrings[216],// Stats |
0 | 5568 (Texture *)(papredoll_dbrds[10] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[10]] : 0), |
11 | 5569 papredoll_dbrds[9] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[9]] : 0, 0); |
5570 pCharacterScreen_SkillsBtn = pWindow->CreateButton(pViewport->uViewportX + 102, pViewport->uViewportY + 308, | |
0 | 5571 (papredoll_dbrds[7] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[7]].uTextureWidth : 24), |
5572 (papredoll_dbrds[7] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[7]].uTextureHeight : 26), | |
11 | 5573 1, 0, 0x72u, 0, 0x4Bu, pGlobalTXT_LocalizationStrings[205],//Skills |
0 | 5574 (Texture *)(papredoll_dbrds[8] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[8]] : 0), |
11 | 5575 papredoll_dbrds[7] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[7]] : 0, 0); |
5576 pCharacterScreen_InventoryBtn = pWindow->CreateButton(pViewport->uViewportX + 192, pViewport->uViewportY + 308, | |
0 | 5577 (papredoll_dbrds[5] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[5]].uTextureWidth : 24), |
5578 (papredoll_dbrds[5] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[5]].uTextureHeight : 26), | |
11 | 5579 1, 0, 0x74u, 0, 0x49u, pGlobalTXT_LocalizationStrings[120], //Inventory |
0 | 5580 (Texture *)(papredoll_dbrds[6] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[6]] : 0), |
11 | 5581 papredoll_dbrds[5] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[5]] : 0, 0); |
5582 pCharacterScreen_AwardsBtn = pWindow->CreateButton(pViewport->uViewportX + 282, pViewport->uViewportY + 308, | |
0 | 5583 (papredoll_dbrds[3] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[3]].uTextureWidth : 24), |
5584 (papredoll_dbrds[3] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[3]].uTextureHeight : 26), | |
11 | 5585 1, 0, 0x75u, 0, 0x41u, pGlobalTXT_LocalizationStrings[22], //Awards |
0 | 5586 (Texture *)(papredoll_dbrds[4] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[4]] : 0), |
11 | 5587 papredoll_dbrds[3] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[3]] : 0, 0); |
5588 pCharacterScreen_ExitBtn = pWindow->CreateButton(pViewport->uViewportX + 371, pViewport->uViewportY + 308, | |
0 | 5589 (papredoll_dbrds[1] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[1]].uTextureWidth : 24), |
5590 (papredoll_dbrds[1] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[1]].uTextureHeight : 26), | |
11 | 5591 1, 0, 0xA8u, 0, 0, pGlobalTXT_LocalizationStrings[79],//Exit |
0 | 5592 (Texture *)(papredoll_dbrds[2] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[2]] : 0), |
11 | 5593 papredoll_dbrds[1] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[1]] : 0, 0); |
5594 pWindow->CreateButton(0, 0, 0x1DCu, 0x159u, 1, 122, 0x78u, 0, 0, "", 0); | |
5595 pCharacterScreen_DetalizBtn = pWindow->CreateButton(0x258u, 0x12Cu, 0x1Eu, 0x1Eu, 1, 0, 0x55u, 0, 0, pGlobalTXT_LocalizationStrings[64], 0); | |
5596 pCharacterScreen_DollBtn = pWindow->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, 1, 0, 0x85u, 0, 0, "", 0); | |
5597 pWindow->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 1u, 0x31u, "", 0); | |
5598 pWindow->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 2u, 0x32u, "", 0); | |
5599 pWindow->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 3u, 0x33u, "", 0); | |
5600 pWindow->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 4u, 0x34u, "", 0); | |
5601 pWindow->CreateButton(0, 0, 0, 0, 1, 0, 0xB0u, 0, 9u, "", 0); | |
0 | 5602 sub_419100(); |
11 | 5603 return pWindow; |
0 | 5604 } |
5605 | |
5606 | |
5607 | |
5608 //----- (004219BE) -------------------------------------------------------- | |
5609 GUIWindow *stru277::sub_4219BE() | |
5610 { | |
5611 int v1; // esi@1 | |
5612 GUIWindow *v2; // ebx@1 | |
5613 | |
5614 auto a4 = this; | |
5615 v1 = (int)a4; | |
5616 pEventTimer->Pause(); | |
5617 pAudioPlayer->StopChannels(-1, -1); | |
5618 bRingsShownInCharScreen = 0; | |
5619 CharacterUI_LoadPaperdollTextures(); | |
5620 pCurrentScreen = 23; | |
5621 v2 = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|WINDOW_Options), v1, 0); | |
5622 pCharacterScreen_ExitBtn = v2->CreateButton( | |
5623 394u, | |
5624 318u, | |
5625 75u, | |
5626 33u, | |
5627 1, | |
5628 0, | |
5629 0xA8u, | |
5630 0, | |
5631 0, | |
5632 pGlobalTXT_LocalizationStrings[79], | |
5633 (Texture *)(papredoll_dbrds[2] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[2]] : 0), | |
5634 papredoll_dbrds[1] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[1]] : 0, | |
5635 0); | |
5636 v2->CreateButton(0, 0, 0x1DCu, 0x159u, 1, 122, 0x78u, 0, 0, "", 0); | |
5637 pCharacterScreen_DollBtn = v2->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, 1, 0, 0x85u, 0, 0, "", 0); | |
5638 v2->CreateButton(61u, 424u, 0x1Fu, 0, 2, 94, 0x6Eu, 1u, 0x31u, "", 0); | |
5639 v2->CreateButton(177u, 424u, 0x1Fu, 0, 2, 94, 0x6Eu, 2u, 0x32u, "", 0); | |
5640 v2->CreateButton(292u, 424u, 0x1Fu, 0, 2, 94, 0x6Eu, 3u, 0x33u, "", 0); | |
5641 v2->CreateButton(407u, 424u, 0x1Fu, 0, 2, 94, 0x6Eu, 4u, 0x34u, "", 0); | |
5642 return v2; | |
5643 } | |
5644 | |
5645 | |
5646 //----- (00421B2C) -------------------------------------------------------- | |
5647 bool __cdecl sub_421B2C_PlaceInInventory_or_DropPickedItem() | |
5648 { | |
5649 unsigned int v0; // eax@2 | |
5650 Texture *v1; // ebx@2 | |
5651 int v2; // eax@3 | |
5652 Player *v3; // esi@5 | |
5653 int v4; // eax@6 | |
5654 unsigned __int16 v5; // dx@11 | |
5655 signed int v6; // eax@11 | |
5656 char *v7; // edi@12 | |
5657 __int16 v8; // ax@16 | |
5658 LayingItem a1; // [sp+4h] [bp-78h]@11 | |
5659 int v11; // [sp+74h] [bp-8h]@2 | |
5660 int v12; // [sp+78h] [bp-4h]@5 | |
5661 | |
5662 if ( !pParty->pPickedItem.uItemID ) | |
5663 return 1; | |
5664 v0 = pIcons_LOD->LoadTexture( | |
5665 pItemsTable->pItems[pParty->pPickedItem.uItemID].pIconName, | |
5666 TEXTURE_16BIT_PALETTE); | |
5667 v1 = (Texture *)(v0 != -1 ? (int)&pIcons_LOD->pTextures[v0] : 0); | |
5668 v11 = areWeLoadingTexture; | |
5669 if ( uActiveCharacter | |
5670 && (v2 = pPlayers[uActiveCharacter]->AddItem(0xFFFFFFFFu, pParty->pPickedItem.uItemID)) != 0 ) | |
5671 { | |
5672 memcpy(&pPlayers[uActiveCharacter]->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v2 + 5], &pParty->pPickedItem, 0x24u); | |
5673 } | |
5674 else | |
5675 { | |
5676 v12 = 0; | |
5677 v3 = pParty->pPlayers; | |
5678 while ( 1 ) | |
5679 { | |
5680 v4 = v3->AddItem(0xFFFFFFFFu, pParty->pPickedItem.uItemID); | |
5681 if ( v4 ) | |
5682 break; | |
5683 ++v12; | |
5684 ++v3; | |
5685 if ( (signed int)v3 >= (signed int)pParty->pHirelings ) | |
5686 goto LABEL_10; | |
5687 } | |
5688 memcpy(&pParty->pPlayers[v12].spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v4 + 5], &pParty->pPickedItem, 0x24u); | |
5689 pMouse->RemoveHoldingItem(); | |
5690 LABEL_10: | |
5691 if ( v12 != 4 ) | |
5692 goto LABEL_18; | |
5693 v5 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSpriteID; | |
5694 v6 = 0; | |
5695 a1.uItemType = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSpriteID; | |
5696 if ( (signed int)pObjectList->uNumObjects <= 0 ) | |
5697 { | |
5698 LABEL_15: | |
5699 LOWORD(v6) = 0; | |
5700 } | |
5701 else | |
5702 { | |
5703 v7 = (char *)&pObjectList->pObjects->uObjectID; | |
5704 while ( v5 != *(short *)v7 ) | |
5705 { | |
5706 ++v6; | |
5707 v7 += 56; | |
5708 if ( v6 >= (signed int)pObjectList->uNumObjects ) | |
5709 goto LABEL_15; | |
5710 } | |
5711 } | |
5712 a1.field_58 = 4; | |
5713 a1.uObjectDescID = v6; | |
5714 a1.vPosition.y = pParty->vPosition.y; | |
5715 a1.vPosition.x = pParty->vPosition.x; | |
5716 a1.vPosition.z = pParty->sEyelevel + pParty->vPosition.z; | |
5717 a1.uSoundID = 0; | |
5718 a1.uFacing = 0; | |
5719 a1.uAttributes = 8; | |
5720 v8 = pIndoor->GetSector( | |
5721 pParty->vPosition.x, | |
5722 pParty->vPosition.y, | |
5723 pParty->sEyelevel + pParty->vPosition.z); | |
5724 a1.uSpriteFrameID = 0; | |
5725 a1.uSectorID = v8; | |
5726 memcpy(&a1.stru_24, &pParty->pPickedItem, sizeof(a1.stru_24)); | |
5727 a1.Create(pParty->sRotationY, 184, 200, 0); | |
5728 } | |
5729 pMouse->RemoveHoldingItem(); | |
5730 LABEL_18: | |
5731 if ( !v11 ) | |
5732 { | |
5733 v1->Release(); | |
5734 pIcons_LOD->_40F9C5(); | |
5735 } | |
5736 return 1; | |
5737 } | |
5738 | |
5739 | |
5740 //----- (00421D00) -------------------------------------------------------- | |
5741 void __fastcall GameUI_OnPlayerPortraitLeftClick(unsigned int uPlayerID) | |
5742 { | |
5743 unsigned int v1; // esi@1 | |
5744 int v2; // eax@2 | |
5745 Player *v3; // ecx@2 | |
5746 Player *v4; // ecx@5 | |
5747 unsigned int v5; // [sp-4h] [bp-10h]@21 | |
5748 | |
5749 v1 = uPlayerID; | |
5750 if ( pParty->pPickedItem.uItemID ) | |
5751 { | |
5752 v2 = pPlayers[uPlayerID]->AddItem(0xFFFFFFFFu, pParty->pPickedItem.uItemID); | |
5753 v3 = pPlayers[v1]; | |
5754 if ( v2 ) | |
5755 { | |
5756 memcpy(&v3->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v2 + 5], &pParty->pPickedItem, 0x24u); | |
5757 viewparams->bRedrawGameUI = 1; | |
5758 pMouse->RemoveHoldingItem(); | |
5759 return; | |
5760 } | |
5761 if ( v3->CanAct() ) | |
5762 { | |
5763 v4 = pPlayers[v1]; | |
5764 } | |
5765 else | |
5766 { | |
5767 if ( !pPlayers[uActiveCharacter]->CanAct() ) | |
5768 goto LABEL_9; | |
5769 v4 = pPlayers[uActiveCharacter]; | |
5770 } | |
5771 v4->PlaySound(15, 0); | |
5772 } | |
5773 LABEL_9: | |
5774 if ( !pCurrentScreen ) | |
5775 { | |
5776 viewparams->bRedrawGameUI = 1; | |
5777 if ( uActiveCharacter != v1 ) | |
11 | 5778 //goto LABEL_27; |
5779 { | |
5780 if ( pPlayers[v1]->uTimeToRecovery ) | |
5781 return; | |
5782 uActiveCharacter = v1; | |
5783 return; | |
5784 } | |
0 | 5785 v5 = 7; |
11 | 5786 //LABEL_22: |
0 | 5787 pGUIWindow_CurrentMenu = GameUI_InitializeCharacterWindow(v5); |
5788 return; | |
5789 } | |
5790 if ( pCurrentScreen == 8 ) | |
5791 return; | |
5792 if ( pCurrentScreen == 10 ) | |
5793 { | |
11 | 5794 //LABEL_23: |
0 | 5795 viewparams->bRedrawGameUI = 1; |
5796 if ( uActiveCharacter == v1 ) | |
5797 { | |
5798 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; | |
5799 pCurrentScreen = 15; | |
11 | 5800 //goto LABEL_28; |
5801 uActiveCharacter = v1; | |
5802 return; | |
5803 } | |
5804 //LABEL_27: | |
0 | 5805 if ( pPlayers[v1]->uTimeToRecovery ) |
5806 return; | |
11 | 5807 //goto LABEL_28; |
5808 uActiveCharacter = v1; | |
5809 return; | |
0 | 5810 } |
5811 if ( pCurrentScreen != 13 ) | |
5812 { | |
5813 if ( pCurrentScreen == 14 ) | |
5814 { | |
11 | 5815 //LABEL_28: |
0 | 5816 uActiveCharacter = v1; |
5817 return; | |
5818 } | |
5819 if ( pCurrentScreen != 15 ) | |
5820 { | |
5821 viewparams->bRedrawGameUI = 1; | |
5822 uActiveCharacter = v1; | |
5823 if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 102 ) | |
5824 sub_419100(); | |
5825 return; | |
5826 } | |
11 | 5827 //goto LABEL_23; |
5828 viewparams->bRedrawGameUI = 1; | |
5829 if ( uActiveCharacter == v1 ) | |
5830 { | |
5831 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; | |
5832 pCurrentScreen = 15; | |
5833 //goto LABEL_28; | |
5834 uActiveCharacter = v1; | |
5835 return; | |
5836 } | |
5837 //LABEL_27: | |
5838 if ( pPlayers[v1]->uTimeToRecovery ) | |
5839 return; | |
5840 //goto LABEL_28; | |
5841 uActiveCharacter = v1; | |
5842 return; | |
0 | 5843 } |
5844 if ( ptr_507BC0->field_40 == 1 ) | |
5845 return; | |
5846 viewparams->bRedrawGameUI = 1; | |
5847 if ( uActiveCharacter != v1 ) | |
11 | 5848 //goto LABEL_28; |
5849 uActiveCharacter = v1; | |
5850 return; | |
0 | 5851 if ( dword_F8B19C == 2 || dword_F8B19C == 6 ) |
5852 { | |
5853 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; | |
5854 v5 = 14; | |
11 | 5855 //goto LABEL_22; |
5856 pGUIWindow_CurrentMenu = GameUI_InitializeCharacterWindow(v5); | |
5857 return; | |
0 | 5858 } |
5859 } | |
5860 // 4E28F8: using guessed type int pCurrentScreen; | |
5861 // F8B19C: using guessed type int dword_F8B19C; | |
5862 | |
5863 //----- (00421EA6) -------------------------------------------------------- | |
5864 void __cdecl sub_421EA6_OnInventoryLeftClick() | |
5865 { | |
5866 Player *v0; // ebx@1 | |
5867 signed int v1; // eax@2 | |
5868 signed int v2; // ecx@2 | |
5869 int v3; // eax@2 | |
5870 char v4; // sf@2 | |
5871 int v5; // eax@2 | |
5872 unsigned int v6; // eax@7 | |
5873 unsigned int v7; // esi@12 | |
5874 unsigned int v8; // eax@12 | |
5875 unsigned int v9; // eax@16 | |
5876 unsigned int v10; // eax@18 | |
5877 ItemGen this_; // [sp+Ch] [bp-3Ch]@1 | |
5878 POINT a2; // [sp+30h] [bp-18h]@4 | |
5879 unsigned int v13; // [sp+38h] [bp-10h]@13 | |
5880 unsigned int pY; // [sp+3Ch] [bp-Ch]@2 | |
5881 unsigned int pX; // [sp+40h] [bp-8h]@2 | |
5882 int a4; // [sp+44h] [bp-4h]@2 | |
5883 | |
5884 v0 = pPlayers[uActiveCharacter]; | |
5885 if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] != 103 | |
5886 || (pMouse->GetClickPos(&pX, &pY), | |
5887 v1 = pY - 17, | |
5888 v2 = pX - 14, | |
5889 pY = v1, | |
5890 pX = v2, | |
5891 v3 = 14 * (v1 >> 5), | |
5892 v2 >>= 5, | |
5893 v4 = v2 + v3 < 0, | |
5894 v5 = v2 + v3, | |
5895 a4 = v5, | |
5896 v4) | |
5897 || v5 > 126 | |
5898 || pMouse->GetCursorPos(&a2)->x >= 462 | |
5899 || pMouse->GetCursorPos(&a2)->x < 14 ) | |
5900 return; | |
5901 if ( unk_50C9A0 ) | |
5902 { | |
5903 v6 = v0->GetItemIDAtInventoryIndex(&a4); | |
5904 if ( v6 ) | |
5905 { | |
5906 *((char *)pGUIWindow_Settings->ptr_1C + 8) &= 0x7Fu; | |
5907 *((short *)pGUIWindow_Settings->ptr_1C + 2) = uActiveCharacter - 1; | |
5908 *((int *)pGUIWindow_Settings->ptr_1C + 3) = v6 - 1; | |
5909 *((short *)pGUIWindow_Settings->ptr_1C + 3) = a4; | |
5910 ptr_50C9A4 = (ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v6 + 5]; | |
5911 unk_50C9A0 = 0; | |
5912 if ( pMessageQueue_50CBD0->uNumMessages ) | |
5913 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
5914 pMouse->SetCursorBitmap("MICON1"); | |
5915 dword_50C9D0 = 113; | |
5916 dword_50C9D4 = 0; | |
5917 dword_50C9D8 = 256; | |
5918 } | |
5919 return; | |
5920 } | |
5921 if ( ptr_50C9A4 ) | |
5922 return; | |
5923 v7 = pParty->pPickedItem.uItemID; | |
5924 v8 = v0->GetItemIDAtInventoryIndex(&a4); | |
5925 if ( !v7 ) | |
5926 { | |
5927 if ( !v8 ) | |
5928 return; | |
5929 memcpy(&pParty->pPickedItem, &v0->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v8 + 5], sizeof(pParty->pPickedItem)); | |
5930 v0->RemoveItemAtInventoryIndex(a4); | |
5931 v9 = pParty->pPickedItem.uItemID; | |
5932 goto LABEL_24; | |
5933 } | |
5934 v13 = v8; | |
5935 if ( v8 ) | |
5936 { | |
5937 a2.y = (LONG)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v8 + 5]; | |
5938 memcpy(&this_, (const void *)a2.y, sizeof(this_)); | |
5939 v0->RemoveItemAtInventoryIndex(a4); | |
5940 pX = v0->AddItem2(a4, &pParty->pPickedItem); | |
5941 if ( !pX ) | |
5942 { | |
5943 pX = v0->AddItem2(0xFFFFFFFFu, &pParty->pPickedItem); | |
5944 if ( !pX ) | |
5945 { | |
5946 v0->_49298B(&this_, v13 - 1, a4); | |
5947 memcpy((void *)a2.y, &this_, sizeof(ItemGen)); | |
5948 return; | |
5949 } | |
5950 } | |
5951 v9 = this_.uItemID; | |
5952 memcpy(&pParty->pPickedItem, &this_, sizeof(pParty->pPickedItem)); | |
5953 LABEL_24: | |
5954 pMouse->SetCursorBitmap(pItemsTable->pItems[v9].pIconName); | |
5955 return; | |
5956 } | |
5957 v10 = v0->AddItem(a4, v7); | |
5958 pX = v10; | |
5959 if ( v10 || (v10 = v0->AddItem(0xFFFFFFFFu, pParty->pPickedItem.uItemID), (pX = v10) != 0) ) | |
5960 { | |
5961 memcpy(&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v10 + 5], &pParty->pPickedItem, 0x24u); | |
5962 pMouse->RemoveHoldingItem(); | |
5963 } | |
5964 } | |
5965 | |
5966 | |
5967 //----- (0042213C) -------------------------------------------------------- | |
5968 void __cdecl OnGameViewportClick() | |
5969 { | |
5970 signed int v0; // ebx@2 | |
5971 POINT *v1; // esi@3 | |
5972 signed int v2; // eax@9 | |
5973 BLVFace *v3; // eax@10 | |
5974 unsigned int v4; // eax@11 | |
5975 unsigned __int16 v5; // dx@14 | |
5976 signed int v6; // eax@14 | |
5977 char *v7; // esi@15 | |
5978 int *v8; // eax@19 | |
5979 int v9; // eax@19 | |
5980 unsigned int v10; // eax@19 | |
5981 int v11; // ecx@21 | |
5982 ODMFace *v12; // eax@22 | |
5983 LevelDecoration *v13; // esi@24 | |
5984 __int16 v14; // ax@25 | |
5985 int v15; // ecx@29 | |
5986 signed int v16; // edx@30 | |
5987 Actor *v17; // esi@30 | |
5988 int v18; // ebx@47 | |
5989 unsigned __int16 v19; // ax@50 | |
5990 const char *v20; // eax@51 | |
5991 signed int v21; // eax@58 | |
5992 ItemGen *v22; // esi@62 | |
5993 unsigned int v23; // eax@62 | |
5994 LayingItem a1; // [sp+Ch] [bp-80h]@1 | |
5995 POINT v25; // [sp+7Ch] [bp-10h]@3 | |
5996 POINT a2; // [sp+84h] [bp-8h]@3 | |
5997 | |
5998 if ( pRenderer->pRenderD3D ) | |
5999 { | |
6000 v0 = pGame->pVisInstance->get_picked_object_zbuf_val(); | |
6001 } | |
6002 else | |
6003 { | |
6004 v1 = pMouse->GetCursorPos(&a2); | |
6005 v0 = pRenderer->pActiveZBuffer[v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v25)->y]]; | |
6006 } | |
6007 if ( (v0 & 7) == 2 ) | |
6008 { | |
6009 a2.y = (signed int)(unsigned __int16)v0 >> 3; | |
6010 v21 = (signed int)(unsigned __int16)v0 >> 3; | |
6011 if ( !(pObjectList->pObjects[pLayingItems[v21].uObjectDescID].uFlags & 0x10) | |
6012 && a2.y < 1000 | |
6013 && pLayingItems[v21].uObjectDescID | |
6014 && (unsigned int)v0 < 0x2000000 ) | |
6015 { | |
6016 v22 = &pLayingItems[v21].stru_24; | |
6017 v23 = pLayingItems[v21].stru_24.uItemID; | |
6018 if ( pItemsTable->pItems[v23].uEquipType == 18 ) | |
6019 { | |
6020 party_finds_gold(v22->uAdditionalValue, 0); | |
6021 viewparams->bRedrawGameUI = 1; | |
6022 } | |
6023 else | |
6024 { | |
6025 sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[v23].pUnidentifiedName); | |
6026 ShowStatusBarString(pTmpBuf2, 2u); | |
6027 if ( v22->uItemID == 506 ) | |
6028 _449B7E_toggle_bit(pParty->_award_bits, 184, 1u); | |
6029 if ( v22->uItemID == 455 ) | |
6030 _449B7E_toggle_bit(pParty->_award_bits, 185, 1u); | |
6031 if ( !pParty->AddItem(v22) ) | |
6032 pParty->SetHoldingItem(v22); | |
6033 } | |
6034 LayingItem::_42F933(a2.y); | |
6035 return; | |
6036 } | |
6037 goto LABEL_13; | |
6038 } | |
6039 if ( (v0 & 7) != 3 ) | |
6040 { | |
6041 if ( (v0 & 7) == 5 ) | |
6042 { | |
6043 v13 = &pLevelDecorations[(signed int)(unsigned __int16)v0 >> 3]; | |
6044 if ( (signed int)(((unsigned int)v0 >> 16) - pDecorationList->pDecorations[v13->uDecorationDescID].uRadius) >= 512 ) | |
6045 goto LABEL_13; | |
6046 v14 = v13->field_16_event_id; | |
6047 if ( !v14 ) | |
6048 { | |
6049 if ( pLevelDecorations[(signed int)(unsigned __int16)v0 >> 3].IsInteractive() ) | |
6050 { | |
6051 v15 = stru_5E4C90._decor_events[v13->_idx_in_stru123 - 75] + 380; | |
6052 _5C3420_pDecoration = &pLevelDecorations[(signed int)(unsigned __int16)v0 >> 3]; | |
6053 EventProcessor(v15, 0, 1); | |
6054 _5C3420_pDecoration = 0; | |
6055 } | |
6056 return; | |
6057 } | |
6058 v11 = v14; | |
6059 } | |
6060 else | |
6061 { | |
6062 if ( (v0 & 7) != 6 || (unsigned int)v0 >= 0x2000000 ) | |
6063 goto LABEL_13; | |
6064 v2 = (signed int)(unsigned __int16)v0 >> 3; | |
6065 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
6066 { | |
6067 v3 = &pIndoor->pFaces[v2]; | |
6068 if ( !(v3->uAttributes & 0x2000000) ) | |
6069 { | |
6070 LABEL_11: | |
6071 v4 = pParty->pPickedItem.uItemID; | |
6072 if ( pParty->pPickedItem.uItemID ) | |
6073 { | |
6074 LABEL_14: | |
6075 v5 = pItemsTable->pItems[v4].uSpriteID; | |
6076 v6 = 0; | |
6077 a1.uItemType = v5; | |
6078 if ( (signed int)pObjectList->uNumObjects <= 0 ) | |
6079 { | |
6080 LABEL_18: | |
6081 LOWORD(v6) = 0; | |
6082 } | |
6083 else | |
6084 { | |
6085 v7 = (char *)&pObjectList->pObjects->uObjectID; | |
6086 while ( v5 != *(short *)v7 ) | |
6087 { | |
6088 ++v6; | |
6089 v7 += 56; | |
6090 if ( v6 >= (signed int)pObjectList->uNumObjects ) | |
6091 goto LABEL_18; | |
6092 } | |
6093 } | |
6094 a1.uObjectDescID = v6; | |
6095 a1.vPosition.y = pParty->vPosition.y; | |
6096 a1.field_58 = 4; | |
6097 a1.vPosition.x = pParty->vPosition.x; | |
6098 a1.vPosition.z = pParty->sEyelevel + pParty->vPosition.z; | |
6099 a1.uSoundID = 0; | |
6100 a1.uFacing = 0; | |
6101 a1.uAttributes = 8; | |
6102 a1.uSectorID = pIndoor->GetSector( | |
6103 pParty->vPosition.x, | |
6104 pParty->vPosition.y, | |
6105 pParty->sEyelevel + pParty->vPosition.z); | |
6106 a1.uSpriteFrameID = 0; | |
6107 memcpy(&a1.stru_24, &pParty->pPickedItem, 0x24u); | |
6108 v8 = (int *)pMouse->GetCursorPos(&v25); | |
6109 v9 = UnprojectX(*v8); | |
6110 a1.Create(pParty->sRotationY + v9, 184, 200, 0); | |
6111 v10 = pIcons_LOD->LoadTexture( | |
6112 pItemsTable->pItems[pParty->pPickedItem.uItemID].pIconName, | |
6113 TEXTURE_16BIT_PALETTE); | |
6114 if (v10 != -1) | |
6115 pIcons_LOD->pTextures[v10].Release(); | |
6116 pMouse->RemoveHoldingItem(); | |
6117 pIcons_LOD->_40F9C5(); | |
6118 return; | |
6119 } | |
6120 ShowNothingHereStatus(); | |
6121 LABEL_13: | |
6122 v4 = pParty->pPickedItem.uItemID; | |
6123 if ( !pParty->pPickedItem.uItemID ) | |
6124 return; | |
6125 goto LABEL_14; | |
6126 } | |
6127 v11 = pIndoor->pFaceExtras[v3->uFaceExtraID].uEventID; | |
6128 } | |
6129 else | |
6130 { | |
6131 v12 = &pOutdoor->pBModels[(signed int)(unsigned __int16)v0 >> 9].pFaces[v2 & 0x3F]; | |
6132 if ( !(v12->uAttributes & 0x2000000) ) | |
6133 goto LABEL_11; | |
6134 v11 = v12->sCogTriggeredID; | |
6135 } | |
6136 } | |
6137 EventProcessor(v11, (unsigned __int16)v0, 1); | |
6138 return; | |
6139 } | |
6140 v16 = (signed int)(unsigned __int16)v0 >> 3; | |
6141 a2.y = v16; | |
6142 v17 = &pActors[v16]; | |
6143 if ( v17->uAIState == 5 ) | |
6144 { | |
6145 if ( (unsigned int)v0 < 0x2000000 ) | |
6146 { | |
6147 stru_50C198.LootActor(&pActors[v16]); | |
6148 return; | |
6149 } | |
6150 goto LABEL_13; | |
6151 } | |
6152 if ( GetAsyncKeyState(VK_SHIFT) >= 0 ) | |
6153 { | |
6154 if ( !v17->GetActorsRelation(0) && !(BYTE2(v17->uAttributes) & 8) ) | |
6155 { | |
6156 if ( (unsigned int)v0 >= 0x2000000 ) | |
6157 goto LABEL_13; | |
6158 if ( !v17->CanAct() ) | |
6159 return; | |
6160 v18 = a2.y; | |
6161 Actor::FaceObject(a2.y, 4u, 0, 0); | |
6162 if ( !v17->uNPC_ID ) | |
6163 { | |
6164 v19 = pNPCStats->pGroups_copy[v17->uGroup]; | |
6165 if ( v19 ) | |
6166 { | |
6167 v20 = pNPCStats->pCatchPhrases[v19]; | |
6168 if ( v20 ) | |
6169 { | |
6170 pParty->uFlags |= 2u; | |
6171 strcpy(byte_5B0938, v20); | |
6172 sub_4451A8_press_any_key(0, 0, 0); | |
6173 } | |
6174 } | |
6175 return; | |
6176 } | |
6177 if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) | |
6178 return; | |
6179 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)161; | |
6180 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v18; | |
6181 LABEL_42: | |
6182 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
6183 ++pMessageQueue_50CBD0->uNumMessages; | |
6184 return; | |
6185 } | |
6186 if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->field_4 == 3 ) | |
6187 { | |
6188 pTurnEngine->field_18 |= 8u; | |
6189 return; | |
6190 } | |
6191 if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
6192 { | |
6193 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)23; | |
6194 goto LABEL_41; | |
6195 } | |
6196 } | |
6197 else | |
6198 { | |
6199 if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->field_4 == 3 ) | |
6200 { | |
6201 pParty->uFlags |= 8u; | |
6202 return; | |
6203 } | |
6204 if ( uActiveCharacter | |
6205 && sub_427769_spell(pPlayers[uActiveCharacter]->uQuickSpell) | |
6206 && (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
6207 { | |
6208 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)25; | |
6209 LABEL_41: | |
6210 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
6211 goto LABEL_42; | |
6212 } | |
6213 } | |
6214 } | |
6215 | |
6216 //----- (004226C2) -------------------------------------------------------- | |
6217 bool __cdecl sub_4226C2() | |
6218 { | |
6219 if ( pCurrentScreen | |
6220 && pCurrentScreen != 4 | |
6221 && pCurrentScreen != 17 ) | |
6222 { | |
6223 if ( pCurrentScreen == 18 ) | |
6224 return pVideoPlayer->pSmackerMovie != 0; | |
6225 if ( pCurrentScreen != 19 ) | |
6226 return 1; | |
6227 } | |
6228 return 0; | |
6229 } | |
6230 // 4E28F8: using guessed type int pCurrentScreen; | |
6231 | |
6232 //----- (004226EF) -------------------------------------------------------- | |
6233 void __fastcall SetUserInterface(int a1, bool bReplace) | |
6234 { | |
6235 int v2; // ecx@2 | |
6236 unsigned int v3; // eax@7 | |
6237 unsigned __int16 v4; // dx@7 | |
6238 unsigned __int16 v5; // cx@7 | |
6239 unsigned __int16 v6; // [sp-4h] [bp-14h]@7 | |
6240 | |
6241 if ( a1 ) | |
6242 { | |
6243 v2 = a1 - 1; | |
6244 if ( v2 ) | |
6245 { | |
6246 if ( v2 != 1 ) | |
6247 return; | |
6248 if ( bReplace ) | |
6249 { | |
6250 pTexture_RightFrame->Reload("ib-r-C.pcx"); | |
6251 pTexture_BottomFrame->Reload("ib-b-C.pcx"); | |
6252 pTexture_TopFrame->Reload("ib-t-C.pcx"); | |
6253 pTexture_LeftFrame->Reload("ib-l-C.pcx"); | |
6254 pTexture_StatusBar->Reload("IB-Foot-c.pcx"); | |
6255 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_right_panel], "ib-mb-C", 2); | |
6256 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079D8], "ib-autmask-c", 2); | |
6257 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079B4], "IB-COMP-C", 2); | |
6258 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079D0], "IB-InitG-c", 2); | |
6259 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079C8], "IB-InitY-c", 2); | |
6260 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079CC], "IB-InitR-c", 2); | |
6261 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507990], "IB-NPCLD-C", 2); | |
6262 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50798C], "IB-NPCRD-C", 2); | |
6263 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507980], "ib-autout-C", 2); | |
6264 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507984], "ib-autin-C", 2); | |
6265 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_50C98C], "IB-selec-C", 2); | |
6266 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50797C], "ib-m1d-c", 2); | |
6267 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507978], "ib-m2d-c", 2); | |
6268 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507974], "ib-m3d-c", 2); | |
6269 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507970], "ib-m4d-c", 2); | |
6270 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_50796C], "isg-01-c", 2); | |
6271 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507968], "isg-02-c", 2); | |
6272 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507964], "isg-03-c", 2); | |
6273 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507960], "isg-04-c", 2); | |
6274 pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeC"); | |
6275 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID); | |
6276 pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchC"); | |
6277 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID); | |
6278 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_506438], "ib-bcu-c", 2); | |
6279 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50795C], "evtnpc-c", 2); | |
6280 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507958], "fr_inven-c", 2); | |
6281 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Parchment], "parchment", 2); | |
6282 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B4], "cornr_ll-c", 2); | |
6283 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B0], "cornr_lr-c", 2); | |
6284 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076AC], "cornr_ul-c", 2); | |
6285 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A8], "cornr_ur-c", 2); | |
6286 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A4], "edge_btm-c", 2); | |
6287 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A0], "edge_lf-c", 2); | |
6288 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50769C], "edge_rt-c", 2); | |
6289 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507698], "edge_top-c", 2); | |
6290 pIcons_LOD->ReloadTexture(pTexture_591428, "endcap-c", 2); | |
6291 } | |
6292 else | |
6293 { | |
6294 pTexture_RightFrame->Load("ib-r-C.pcx", 0); | |
6295 pTexture_BottomFrame->Load("ib-b-c.pcx", 0); | |
6296 pTexture_TopFrame->Load("ib-t-C.pcx", 0); | |
6297 pTexture_LeftFrame->Load("ib-l-C.pcx", 0); | |
6298 pTexture_StatusBar->Load("IB-Foot-c.pcx", 0); | |
6299 uTextureID_right_panel = pIcons_LOD->LoadTexture("ib-mb-C", TEXTURE_16BIT_PALETTE); | |
6300 dword_5079D8 = pIcons_LOD->LoadTexture("ib-autmask-c", TEXTURE_16BIT_PALETTE); | |
6301 dword_5079B4 = pIcons_LOD->LoadTexture("IB-COMP-C", TEXTURE_16BIT_PALETTE); | |
6302 dword_5079D0 = pIcons_LOD->LoadTexture("IB-InitG-c", TEXTURE_16BIT_PALETTE); | |
6303 dword_5079C8 = pIcons_LOD->LoadTexture("IB-InitY-c", TEXTURE_16BIT_PALETTE); | |
6304 dword_5079CC = pIcons_LOD->LoadTexture("IB-InitR-c", TEXTURE_16BIT_PALETTE); | |
6305 uTextureID_507990 = pIcons_LOD->LoadTexture("IB-NPCLD-C", TEXTURE_16BIT_PALETTE); | |
6306 uTextureID_50798C = pIcons_LOD->LoadTexture("IB-NPCRD-C", TEXTURE_16BIT_PALETTE); | |
6307 uTextureID_507980 = pIcons_LOD->LoadTexture("ib-autout-C", TEXTURE_16BIT_PALETTE); | |
6308 uTextureID_507984 = pIcons_LOD->LoadTexture("ib-autin-C", TEXTURE_16BIT_PALETTE); | |
6309 dword_50C98C = pIcons_LOD->LoadTexture("IB-selec-C", TEXTURE_16BIT_PALETTE); | |
6310 uTextureID_50797C = pIcons_LOD->LoadTexture("ib-m1d-c", TEXTURE_16BIT_PALETTE); | |
6311 uTextureID_507978 = pIcons_LOD->LoadTexture("ib-m2d-c", TEXTURE_16BIT_PALETTE); | |
6312 dword_507974 = pIcons_LOD->LoadTexture("ib-m3d-c", TEXTURE_16BIT_PALETTE); | |
6313 uTextureID_507970 = pIcons_LOD->LoadTexture("ib-m4d-c", TEXTURE_16BIT_PALETTE); | |
6314 uTextureID_506438 = pIcons_LOD->LoadTexture("ib-bcu-c", TEXTURE_16BIT_PALETTE); | |
6315 dword_50796C = pIcons_LOD->LoadTexture("isg-01-c", TEXTURE_16BIT_PALETTE); | |
6316 dword_507968 = pIcons_LOD->LoadTexture("isg-02-c", TEXTURE_16BIT_PALETTE); | |
6317 dword_507964 = pIcons_LOD->LoadTexture("isg-03-c", TEXTURE_16BIT_PALETTE); | |
6318 dword_507960 = pIcons_LOD->LoadTexture("isg-04-c", TEXTURE_16BIT_PALETTE); | |
6319 uTextureID_50795C = pIcons_LOD->LoadTexture("evtnpc-c", TEXTURE_16BIT_PALETTE); | |
6320 uTextureID_507958 = pIcons_LOD->LoadTexture("fr_inven", TEXTURE_16BIT_PALETTE); | |
6321 pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeC"); | |
6322 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID); | |
6323 pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchC"); | |
6324 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID); | |
6325 } | |
6326 v3 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xC8u, 0, 0); | |
6327 v4 = 0; | |
6328 v6 = 0; | |
6329 v5 = 10; | |
6330 } | |
6331 else | |
6332 { | |
6333 if ( bReplace ) | |
6334 { | |
6335 pTexture_RightFrame->Reload("ib-r-a.pcx"); | |
6336 pTexture_BottomFrame->Reload("ib-b-a.pcx"); | |
6337 pTexture_TopFrame->Reload("ib-t-a.pcx"); | |
6338 pTexture_LeftFrame->Reload("ib-l-a.pcx"); | |
6339 pTexture_StatusBar->Reload("IB-Foot-a.pcx"); | |
6340 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_right_panel], "ib-mb-a", 2); | |
6341 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079D8], "ib-autmask-a", 2); | |
6342 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079B4], "IB-COMP-a", 2); | |
6343 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079D0], "IB-InitG-a", 2); | |
6344 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079C8], "IB-InitY-a", 2); | |
6345 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079CC], "IB-InitR-a", 2); | |
6346 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507990], "IB-NPCLD-a", 2); | |
6347 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50798C], "IB-NPCRD-a", 2); | |
6348 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507980], "ib-autout-a", 2); | |
6349 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507984], "ib-autin-a", 2); | |
6350 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_50C98C], "IB-selec-a", 2); | |
6351 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50797C], "ib-m1d-a", 2); | |
6352 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507978], "ib-m2d-a", 2); | |
6353 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507974], "ib-m3d-a", 2); | |
6354 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507970], "ib-m4d-a", 2); | |
6355 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_50796C], "isg-01-a", 2); | |
6356 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507968], "isg-02-a", 2); | |
6357 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507964], "isg-03-a", 2); | |
6358 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507960], "isg-04-a", 2); | |
6359 pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeA"); | |
6360 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID); | |
6361 pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchA"); | |
6362 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID); | |
6363 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_506438], "ib-bcu-a", 2); | |
6364 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50795C], "evtnpc", 2); | |
6365 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507958], "fr_inven", 2); | |
6366 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Parchment], "parchment", 2); | |
6367 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B4], "cornr_ll", 2); | |
6368 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B0], "cornr_lr", 2); | |
6369 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076AC], "cornr_ul", 2); | |
6370 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A8], "cornr_ur", 2); | |
6371 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A4], "edge_btm", 2); | |
6372 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A0], "edge_lf", 2); | |
6373 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50769C], "edge_rt", 2); | |
6374 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507698], "edge_top", 2); | |
6375 pIcons_LOD->ReloadTexture(pTexture_591428, "endcap", 2); | |
6376 } | |
6377 else | |
6378 { | |
6379 pTexture_RightFrame->Load("ib-r-A.pcx", 0); | |
6380 pTexture_BottomFrame->Load("ib-b-A.pcx", 0); | |
6381 pTexture_TopFrame->Load("ib-t-A.pcx", 0); | |
6382 pTexture_LeftFrame->Load("ib-l-A.pcx", 0); | |
6383 pTexture_StatusBar->Load("IB-Foot-a.pcx", 0); | |
6384 uTextureID_right_panel = pIcons_LOD->LoadTexture("ib-mb-A", TEXTURE_16BIT_PALETTE); | |
6385 dword_5079D8 = pIcons_LOD->LoadTexture("ib-autmask-a", TEXTURE_16BIT_PALETTE); | |
6386 dword_5079B4 = pIcons_LOD->LoadTexture("IB-COMP-A", TEXTURE_16BIT_PALETTE); | |
6387 dword_5079D0 = pIcons_LOD->LoadTexture("IB-InitG-a", TEXTURE_16BIT_PALETTE); | |
6388 dword_5079C8 = pIcons_LOD->LoadTexture("IB-InitY-a", TEXTURE_16BIT_PALETTE); | |
6389 dword_5079CC = pIcons_LOD->LoadTexture("IB-InitR-a", TEXTURE_16BIT_PALETTE); | |
6390 uTextureID_507990 = pIcons_LOD->LoadTexture("IB-NPCLD-A", TEXTURE_16BIT_PALETTE); | |
6391 uTextureID_50798C = pIcons_LOD->LoadTexture("IB-NPCRD-A", TEXTURE_16BIT_PALETTE); | |
6392 dword_50C98C = pIcons_LOD->LoadTexture("IB-selec-A", TEXTURE_16BIT_PALETTE); | |
6393 uTextureID_50797C = pIcons_LOD->LoadTexture("ib-m1d-a", TEXTURE_16BIT_PALETTE); | |
6394 uTextureID_507978 = pIcons_LOD->LoadTexture("ib-m2d-a", TEXTURE_16BIT_PALETTE); | |
6395 dword_507974 = pIcons_LOD->LoadTexture("ib-m3d-a", TEXTURE_16BIT_PALETTE); | |
6396 uTextureID_507970 = pIcons_LOD->LoadTexture("ib-m4d-a", TEXTURE_16BIT_PALETTE); | |
6397 uTextureID_507980 = pIcons_LOD->LoadTexture("ib-autout-a", TEXTURE_16BIT_PALETTE); | |
6398 uTextureID_507984 = pIcons_LOD->LoadTexture("ib-autin-a", TEXTURE_16BIT_PALETTE); | |
6399 uTextureID_506438 = pIcons_LOD->LoadTexture("ib-bcu-a", TEXTURE_16BIT_PALETTE); | |
6400 dword_50796C = pIcons_LOD->LoadTexture("isg-01-a", TEXTURE_16BIT_PALETTE); | |
6401 dword_507968 = pIcons_LOD->LoadTexture("isg-02-a", TEXTURE_16BIT_PALETTE); | |
6402 dword_507964 = pIcons_LOD->LoadTexture("isg-03-a", TEXTURE_16BIT_PALETTE); | |
6403 dword_507960 = pIcons_LOD->LoadTexture("isg-04-a", TEXTURE_16BIT_PALETTE); | |
6404 uTextureID_50795C = pIcons_LOD->LoadTexture("evtnpc", TEXTURE_16BIT_PALETTE); | |
6405 uTextureID_507958 = pIcons_LOD->LoadTexture("fr_inven", TEXTURE_16BIT_PALETTE); | |
6406 pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeA"); | |
6407 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID); | |
6408 pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchA"); | |
6409 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID); | |
6410 uTextureID_Parchment = pIcons_LOD->LoadTexture("parchment", TEXTURE_16BIT_PALETTE); | |
6411 uTextureID_5076B4 = pIcons_LOD->LoadTexture("cornr_ll", TEXTURE_16BIT_PALETTE); | |
6412 uTextureID_5076B0 = pIcons_LOD->LoadTexture("cornr_lr", TEXTURE_16BIT_PALETTE); | |
6413 uTextureID_5076AC = pIcons_LOD->LoadTexture("cornr_ul", TEXTURE_16BIT_PALETTE); | |
6414 uTextureID_5076A8 = pIcons_LOD->LoadTexture("cornr_ur", TEXTURE_16BIT_PALETTE); | |
6415 uTextureID_5076A4 = pIcons_LOD->LoadTexture("edge_btm", TEXTURE_16BIT_PALETTE); | |
6416 uTextureID_5076A0 = pIcons_LOD->LoadTexture("edge_lf", TEXTURE_16BIT_PALETTE); | |
6417 uTextureID_50769C = pIcons_LOD->LoadTexture("edge_rt", TEXTURE_16BIT_PALETTE); | |
6418 uTextureID_507698 = pIcons_LOD->LoadTexture("edge_top", TEXTURE_16BIT_PALETTE); | |
6419 pTexture_591428 = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("endcap", TEXTURE_16BIT_PALETTE)]; | |
6420 | |
6421 } | |
6422 v3 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xAu, 0, 0); | |
6423 v4 = 214; | |
6424 v5 = 230; | |
6425 v6 = 193; | |
6426 } | |
6427 } | |
6428 else | |
6429 { | |
6430 if ( bReplace ) | |
6431 { | |
6432 pTexture_RightFrame->Reload("ib-r-B.pcx"); | |
6433 pTexture_BottomFrame->Reload("ib-b-B.pcx"); | |
6434 pTexture_TopFrame->Reload("ib-t-B.pcx"); | |
6435 pTexture_LeftFrame->Reload("ib-l-B.pcx"); | |
6436 pTexture_StatusBar->Reload("IB-Foot-b.pcx"); | |
6437 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_right_panel], "ib-mb-B", 2); | |
6438 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079D8], "ib-autmask-b", 2); | |
6439 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079B4], "IB-COMP-B", 2); | |
6440 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079D0], "IB-InitG-b", 2); | |
6441 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079C8], "IB-InitY-b", 2); | |
6442 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079CC], "IB-InitR-b", 2); | |
6443 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507990], "IB-NPCLD-B", 2); | |
6444 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50798C], "IB-NPCRD-B", 2); | |
6445 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507980], "ib-autout-B", 2); | |
6446 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507984], "ib-autin-B", 2); | |
6447 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_50C98C], "IB-selec-B", 2); | |
6448 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50797C], "ib-m1d-b", 2); | |
6449 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507978], "ib-m2d-b", 2); | |
6450 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507974], "ib-m3d-b", 2); | |
6451 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507970], "ib-m4d-b", 2); | |
6452 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_50796C], "isg-01-b", 2); | |
6453 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507968], "isg-02-b", 2); | |
6454 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507964], "isg-03-b", 2); | |
6455 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507960], "isg-04-b", 2); | |
6456 pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeB"); | |
6457 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID); | |
6458 pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchB"); | |
6459 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID); | |
6460 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_506438], "ib-bcu-b", 2); | |
6461 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50795C], "evtnpc-b", 2); | |
6462 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507958], "fr_inven-b", 2); | |
6463 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Parchment], "parchment", 2); | |
6464 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B4], "cornr_ll-b", 2); | |
6465 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B0], "cornr_lr-b", 2); | |
6466 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076AC], "cornr_ul-b", 2); | |
6467 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A8], "cornr_ur-b", 2); | |
6468 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A4], "edge_btm-b", 2); | |
6469 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A0], "edge_lf-b", 2); | |
6470 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50769C], "edge_rt-b", 2); | |
6471 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507698], "edge_top-b", 2); | |
6472 pIcons_LOD->ReloadTexture(pTexture_591428, "endcap-b", 2); | |
6473 } | |
6474 v3 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0, 0xC8u); | |
6475 v5 = 255; | |
6476 v4 = 225; | |
6477 v6 = 255; | |
6478 } | |
6479 uGameUIFontMain = v3; | |
6480 uGameUIFontShadow = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(v5, v4, v6); | |
6481 } | |
6482 | |
6483 | |
6484 | |
6485 //----- (00423AEE) -------------------------------------------------------- | |
6486 void __cdecl reset_some_strus_flt_2Cs() | |
6487 { | |
6488 float *v0; // eax@1 | |
6489 signed int v1; // ecx@1 | |
6490 signed int v2; // edx@1 | |
6491 float *v3; // eax@3 | |
6492 signed int v4; // edx@3 | |
6493 float *v5; // eax@5 | |
6494 signed int v6; // edx@5 | |
6495 float *v7; // eax@7 | |
6496 signed int v8; // edx@7 | |
6497 float *v9; // eax@9 | |
6498 | |
6499 v0 = &array_50AC10[0].flt_2C; | |
6500 v1 = 50; | |
6501 v2 = 50; | |
6502 do | |
6503 { | |
6504 *v0 = 0.0; | |
6505 v0 += 12; | |
6506 --v2; | |
6507 } | |
6508 while ( v2 ); | |
6509 v3 = &array_50A2B0[0].flt_2C; | |
6510 v4 = 50; | |
6511 do | |
6512 { | |
6513 *v3 = 0.0; | |
6514 v3 += 12; | |
6515 --v4; | |
6516 } | |
6517 while ( v4 ); | |
6518 v5 = &array_509950[0].flt_2C; | |
6519 v6 = 50; | |
6520 do | |
6521 { | |
6522 *v5 = 0.0; | |
6523 v5 += 12; | |
6524 --v6; | |
6525 } | |
6526 while ( v6 ); | |
6527 v7 = &array_508FF0[0].flt_2C; | |
6528 v8 = 50; | |
6529 do | |
6530 { | |
6531 *v7 = 0.0; | |
6532 v7 += 12; | |
6533 --v8; | |
6534 } | |
6535 while ( v8 ); | |
6536 v9 = &array_508690[0].flt_2C; | |
6537 do | |
6538 { | |
6539 *v9 = 0.0; | |
6540 v9 += 12; | |
6541 --v1; | |
6542 } | |
6543 while ( v1 ); | |
6544 } | |
6545 | |
6546 //----- (00423B4A) -------------------------------------------------------- | |
6547 void __cdecl sub_423B4A() | |
6548 { | |
6549 float *v0; // eax@1 | |
6550 signed int v1; // ecx@1 | |
6551 | |
6552 v0 = &array_507D30[0].flt_2C; | |
6553 v1 = 50; | |
6554 do | |
6555 { | |
6556 *v0 = 0.0; | |
6557 v0 += 12; | |
6558 --v1; | |
6559 } | |
6560 while ( v1 ); | |
6561 } | |
6562 | |
6563 //----- (00423B5D) -------------------------------------------------------- | |
6564 int __fastcall sub_423B5D(unsigned int uFaceID) | |
6565 { | |
6566 BLVFace *v1; // ebx@1 | |
6567 Vec3_short_ *v2; // esi@1 | |
6568 //int v3; // ST28_4@1 | |
6569 __int16 v4; // ST2C_2@1 | |
6570 //signed int v5; // esi@1 | |
6571 //Vec3_short_ *v6; // eax@4 | |
6572 //signed int v7; // edi@5 | |
6573 //signed int v8; // eax@5 | |
6574 //signed int i_; // ecx@10 | |
6575 int v10; // eax@10 | |
6576 int v11; // edx@11 | |
6577 int v12; // ST28_4@12 | |
6578 signed int v13; // edx@12 | |
6579 signed __int64 v14; // qtt@12 | |
6580 int *v15; // ebx@12 | |
6581 int v16; // ST28_4@14 | |
6582 signed int v17; // eax@14 | |
6583 signed __int64 v18; // qtt@14 | |
6584 signed int v19; // edx@15 | |
6585 signed int v20; // edx@17 | |
6586 signed int v21; // ebx@19 | |
6587 signed int v22; // esi@20 | |
6588 int v23; // edi@21 | |
6589 int v24; // eax@21 | |
6590 int v25; // eax@22 | |
6591 int v26; // eax@22 | |
6592 signed int v27; // ST30_4@24 | |
6593 signed __int64 v28; // qtt@24 | |
6594 int v29; // ST18_4@25 | |
6595 int v30; // eax@26 | |
6596 int v31; // eax@27 | |
6597 int v32; // eax@27 | |
6598 signed int v33; // ST30_4@29 | |
6599 signed __int64 v34; // qtt@29 | |
6600 int v35; // ST30_4@30 | |
6601 signed int v36; // edi@31 | |
6602 unsigned int v37; // eax@31 | |
6603 bool v38; // edx@31 | |
6604 int v39; // ecx@31 | |
6605 int v40; // ecx@32 | |
6606 int v41; // esi@32 | |
6607 int v42; // eax@34 | |
6608 signed int v43; // ebx@41 | |
6609 unsigned int v44; // eax@41 | |
6610 signed int v45; // ecx@42 | |
6611 int v46; // esi@42 | |
6612 int v47; // eax@44 | |
6613 signed int v48; // edi@51 | |
6614 unsigned int v49; // eax@51 | |
6615 bool v50; // edx@51 | |
6616 int v51; // ecx@51 | |
6617 int v52; // ecx@52 | |
6618 signed int v53; // esi@52 | |
6619 int v54; // eax@54 | |
6620 int v55; // ebx@61 | |
6621 unsigned int v56; // eax@61 | |
6622 signed int v57; // ecx@62 | |
6623 int v58; // esi@62 | |
6624 int v59; // eax@64 | |
6625 char v61; // zf@72 | |
6626 signed int v62; // edx@75 | |
6627 int v63; // ecx@76 | |
6628 int v64; // esi@76 | |
6629 int v65; // ecx@83 | |
6630 //signed int v66; // [sp+14h] [bp-14h]@3 | |
6631 int v67; // [sp+14h] [bp-14h]@34 | |
6632 int v68; // [sp+14h] [bp-14h]@44 | |
6633 int v69; // [sp+14h] [bp-14h]@54 | |
6634 int v70; // [sp+14h] [bp-14h]@64 | |
6635 signed int v71; // [sp+14h] [bp-14h]@75 | |
6636 bool thisa; // [sp+18h] [bp-10h]@9 | |
6637 int thisb; // [sp+18h] [bp-10h]@12 | |
6638 int thisc; // [sp+18h] [bp-10h]@20 | |
6639 bool thisd; // [sp+18h] [bp-10h]@41 | |
6640 bool thise; // [sp+18h] [bp-10h]@61 | |
6641 int thisf; // [sp+18h] [bp-10h]@74 | |
6642 signed int v79; // [sp+1Ch] [bp-Ch]@9 | |
6643 int v80; // [sp+1Ch] [bp-Ch]@76 | |
6644 bool v81; // [sp+20h] [bp-8h]@10 | |
6645 bool v82; // [sp+20h] [bp-8h]@32 | |
6646 bool v83; // [sp+20h] [bp-8h]@42 | |
6647 bool v84; // [sp+20h] [bp-8h]@52 | |
6648 bool v85; // [sp+20h] [bp-8h]@62 | |
6649 //signed int i; // [sp+24h] [bp-4h]@9 | |
6650 signed int ia; // [sp+24h] [bp-4h]@19 | |
6651 signed int ib; // [sp+24h] [bp-4h]@31 | |
6652 signed int ic; // [sp+24h] [bp-4h]@41 | |
6653 signed int id; // [sp+24h] [bp-4h]@51 | |
6654 signed int ie; // [sp+24h] [bp-4h]@61 | |
6655 | |
6656 v1 = &pIndoor->pFaces[uFaceID]; | |
6657 //this = pGame->pIndoorCameraD3D; | |
6658 v2 = &pIndoor->pVertices[v1->pVertexIDs[0]]; | |
6659 //v3 = *(_DWORD *)&v2->x; | |
6660 v4 = v2->z; | |
6661 //v5 = 0; | |
6662 if ( v1->pFacePlane_old.vNormal.x * (v2->x - pBLVRenderParams->vPartyPos.x) | |
6663 + v1->pFacePlane_old.vNormal.y * (v2->y - pBLVRenderParams->vPartyPos.y) | |
6664 + v1->pFacePlane_old.vNormal.z * (v2->z - pBLVRenderParams->vPartyPos.z) < 0 ) | |
6665 { | |
6666 dword_50B700 = 1; | |
6667 } | |
6668 else | |
6669 { | |
6670 dword_50B700 = 0; | |
6671 if ( !(v1->uAttributes & 1) ) | |
6672 return 0; | |
6673 } | |
6674 //v66 = v1->uNumVertices; | |
6675 for (uint i = 0; i < v1->uNumVertices; ++i) | |
6676 { | |
6677 auto v6 = &pIndoor->pVertices[v1->pVertexIDs[i]]; | |
6678 pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible( | |
6679 v6->x, | |
6680 v6->y, | |
6681 v6->z, | |
6682 &_50B924_view_transformed_xs[i], | |
6683 &_50B834_view_transformed_zs[i], | |
6684 &_50B744_view_transformed_ys[i], | |
6685 0); | |
6686 } | |
6687 | |
6688 //v7 = v1->uNumVertices; | |
6689 //v8 = 0; | |
6690 if (v1->uNumVertices <= 0) | |
6691 return 0; | |
6692 | |
6693 bool bFound = false; | |
6694 for (uint i = 0; i < v1->uNumVertices; ++i) | |
6695 if (_50B924_view_transformed_xs[i] >= 0x80000u) | |
6696 { | |
6697 bFound = true; | |
6698 break; | |
6699 } | |
6700 if (!bFound) | |
6701 return 0; | |
6702 | |
6703 v79 = 0; | |
6704 _50B924_view_transformed_xs[v1->uNumVertices] = _50B924_view_transformed_xs[0]; | |
6705 _50B834_view_transformed_zs[v1->uNumVertices] = _50B834_view_transformed_zs[0]; | |
6706 _50B744_view_transformed_ys[v1->uNumVertices] = _50B744_view_transformed_ys[0]; | |
6707 thisa = _50B924_view_transformed_xs[0] >= 0x80000u; | |
6708 //int i = 1; | |
6709 for (uint i = 1; i < v1->uNumVertices; ++i) | |
6710 { | |
6711 v10 = _50B924_view_transformed_xs[i]; | |
6712 v81 = v10 >= (signed int)0x80000u; | |
6713 if ( thisa ^ v81 ) | |
6714 { | |
6715 v11 = _50B924_view_transformed_xs[i - 1]; | |
6716 if ( v10 >= (signed int)0x80000u ) | |
6717 { | |
6718 v12 = v10 - v11; | |
6719 v13 = 0x80000 - v11; | |
6720 LODWORD(v14) = v13 << 16; | |
6721 HIDWORD(v14) = v13 >> 16; | |
6722 v15 = &_50B744_view_transformed_ys[i - 1]; | |
6723 dword_50B828[v79] = ((unsigned __int64)((_50B834_view_transformed_zs[i] - _50B834_view_transformed_zs[i - 1]) | |
6724 * v14 | |
6725 / v12) >> 16) | |
6726 + _50B834_view_transformed_zs[i - 1]; | |
6727 thisb = (unsigned __int64)((_50B744_view_transformed_ys[i] - _50B744_view_transformed_ys[i - 1]) * v14 / v12) >> 16; | |
6728 } | |
6729 else | |
6730 { | |
6731 v16 = v11 - v10; | |
6732 v17 = 0x80000 - v10; | |
6733 LODWORD(v18) = v17 << 16; | |
6734 HIDWORD(v18) = v17 >> 16; | |
6735 v15 = &_50B744_view_transformed_ys[i]; | |
6736 dword_50B828[v79] = ((unsigned __int64)((_50B834_view_transformed_zs[i - 1] - _50B834_view_transformed_zs[i]) | |
6737 * v18 | |
6738 / v16) >> 16) | |
6739 + _50B834_view_transformed_zs[i]; | |
6740 thisb = (unsigned __int64)((_50B744_view_transformed_ys[i - 1] - _50B744_view_transformed_ys[i]) * v18 / v16) >> 16; | |
6741 } | |
6742 v19 = v79++; | |
6743 //v7 = v66; | |
6744 dword_50B738[v19] = thisb + *v15; | |
6745 dword_50B918[v19] = 0x80000u; | |
6746 } | |
6747 if ( v81 ) | |
6748 { | |
6749 v20 = v79++; | |
6750 dword_50B918[v20] = _50B924_view_transformed_xs[i]; | |
6751 dword_50B828[v20] = _50B834_view_transformed_zs[i]; | |
6752 dword_50B738[v20] = _50B744_view_transformed_ys[i]; | |
6753 } | |
6754 //++i; | |
6755 thisa = v81; | |
6756 } | |
6757 ia = 0; | |
6758 v21 = v79; | |
6759 dword_50B918[v79] = dword_50B918[0]; | |
6760 dword_50B828[v79] = dword_50B828[0]; | |
6761 for ( dword_50B738[v79] = dword_50B738[0]; ia < v79; dword_50BA08[v22] = pBLVRenderParams->uViewportCenterY - v35 ) | |
6762 { | |
6763 v22 = ia; | |
6764 thisc = abs(dword_50B918[ia]); | |
6765 if ( abs(dword_50B828[ia]) >> 13 <= thisc ) | |
6766 { | |
6767 v27 = dword_50B828[v22]; | |
6768 LODWORD(v28) = v27 << 16; | |
6769 HIDWORD(v28) = v27 >> 16; | |
6770 v26 = v28 / dword_50B918[v22]; | |
6771 v23 = 0; | |
6772 } | |
6773 else | |
6774 { | |
6775 v23 = 0; | |
6776 v24 = 0; | |
6777 if ( dword_50B828[v22] >= 0 ) | |
6778 { | |
6779 LOBYTE(v24) = dword_50B918[v22] >= 0; | |
6780 v26 = ((v24 - 1) & 0xFF800000) + 0x400000; | |
6781 } | |
6782 else | |
6783 { | |
6784 LOBYTE(v24) = dword_50B918[v22] >= 0; | |
6785 v25 = v24 - 1; | |
6786 v26 = (v25 & 0x800000) - 0x400000; | |
6787 } | |
6788 } | |
6789 v29 = dword_50B738[v22]; | |
6790 dword_50BAF4_xs[v22 + 1] = v26; | |
6791 if ( abs(v29) >> 13 <= thisc ) | |
6792 { | |
6793 v33 = dword_50B738[v22]; | |
6794 LODWORD(v34) = v33 << 16; | |
6795 HIDWORD(v34) = v33 >> 16; | |
6796 v32 = v34 / dword_50B918[v22]; | |
6797 } | |
6798 else | |
6799 { | |
6800 v30 = 0; | |
6801 if ( dword_50B738[v22] >= v23 ) | |
6802 { | |
6803 LOBYTE(v30) = dword_50B918[v22] >= v23; | |
6804 v32 = ((v30 - 1) & 0xFF800000) + 0x400000; | |
6805 } | |
6806 else | |
6807 { | |
6808 LOBYTE(v30) = dword_50B918[v22] >= v23; | |
6809 v31 = v30 - 1; | |
6810 v32 = (v31 & 0x800000) - 0x400000; | |
6811 } | |
6812 } | |
6813 dword_50BA08[v22] = v32; | |
6814 dword_50BAF4_xs[v22 + 1] = (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40) | |
6815 * (signed __int64)dword_50BAF4_xs[v22 + 1]) >> 16; | |
6816 v35 = (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40) * (signed __int64)dword_50BA08[v22]) >> 16; | |
6817 dword_50BAF4_xs[v22 + 1] = pBLVRenderParams->uViewportCenterX - dword_50BAF4_xs[v22 + 1]; | |
6818 ++ia; | |
6819 } | |
6820 v36 = 0; | |
6821 dword_50BAF4_xs[v21 + 1] = dword_50BAF4_xs[1]; | |
6822 dword_50BA08[v21] = dword_50BA08[0]; | |
6823 v37 = pBLVRenderParams->uViewportX; | |
6824 v38 = dword_50BAF4_xs[1] < (signed int)pBLVRenderParams->uViewportX; | |
6825 LOBYTE(v38) = dword_50BAF4_xs[1] >= (signed int)pBLVRenderParams->uViewportX; | |
6826 v39 = 1; | |
6827 ib = 1; | |
6828 if ( v79 < 1 ) | |
6829 return 0; | |
6830 do | |
6831 { | |
6832 v40 = v39; | |
6833 v41 = dword_50BAF4_xs[v40 + 1]; | |
6834 v82 = v41 >= (signed int)v37; | |
6835 if ( v38 ^ v82 ) | |
6836 { | |
6837 if ( v41 >= (signed int)v37 ) | |
6838 { | |
6839 v67 = (signed int)(v37 - dword_50BAF4_xs[v40]) | |
6840 * (signed __int64)(dword_50BA08[v40] - dword_50B9F8[v40 + 3]) | |
6841 / (v41 - dword_50BAF4_xs[v40]); | |
6842 v42 = dword_50B9F8[v40 + 3]; | |
6843 } | |
6844 else | |
6845 { | |
6846 v67 = (signed int)(v37 - v41) | |
6847 * (signed __int64)(dword_50B9F8[v40 + 3] - dword_50BA08[v40]) | |
6848 / (dword_50BAF4_xs[v40] - v41); | |
6849 v42 = dword_50BA08[v40]; | |
6850 } | |
6851 ++v36; | |
6852 dword_50B9F8[v36] = v67 + v42; | |
6853 v37 = pBLVRenderParams->uViewportX; | |
6854 dword_50BAE8_xs[v36] = pBLVRenderParams->uViewportX; | |
6855 } | |
6856 v38 = v82; | |
6857 if ( v82 ) | |
6858 { | |
6859 dword_50BAE8_xs[v36 + 1] = dword_50BAF4_xs[v40 + 1]; | |
6860 dword_50B9F8[v36++ + 1] = dword_50BA08[v40]; | |
6861 } | |
6862 v39 = ib++ + 1; | |
6863 } | |
6864 while ( ib <= v79 ); | |
6865 | |
6866 if ( !v36 | |
6867 || (v43 = 0, | |
6868 dword_50BAE8_xs[v36 + 1] = dword_50BAE8_xs[1], | |
6869 dword_50B9F8[v36 + 1] = dword_50B9F8[1], | |
6870 v44 = pBLVRenderParams->uViewportZ, | |
6871 thisd = dword_50BAE8_xs[1] <= (signed int)pBLVRenderParams->uViewportZ, | |
6872 ic = 1, | |
6873 v36 < 1) ) | |
6874 return 0; | |
6875 | |
6876 do | |
6877 { | |
6878 v45 = ic; | |
6879 v46 = dword_50BAE8_xs[ic + 1]; | |
6880 v83 = v46 <= (signed int)v44; | |
6881 if ( thisd ^ v83 ) | |
6882 { | |
6883 if ( v46 <= (signed int)v44 ) | |
6884 { | |
6885 v68 = (signed int)(v44 - dword_50BAE8_xs[v45]) | |
6886 * (signed __int64)(dword_50B9F8[v45 + 1] - dword_50B9F8[v45]) | |
6887 / (v46 - dword_50BAE8_xs[v45]); | |
6888 v47 = dword_50B9F8[v45]; | |
6889 } | |
6890 else | |
6891 { | |
6892 v68 = (signed int)(v44 - v46) | |
6893 * (signed __int64)(dword_50B9F8[v45] - dword_50B9F8[v45 + 1]) | |
6894 / (dword_50BAE8_xs[v45] - v46); | |
6895 v47 = dword_50B9F8[v45 + 1]; | |
6896 } | |
6897 ++v43; | |
6898 dword_50B9EC[v43] = v68 + v47; | |
6899 v44 = pBLVRenderParams->uViewportZ; | |
6900 dword_50BADC_xs[v43] = pBLVRenderParams->uViewportZ; | |
6901 } | |
6902 if ( v83 ) | |
6903 { | |
6904 dword_50BAE0[v43] = dword_50BAE8_xs[v45 + 1]; | |
6905 dword_50B9F0[v43++] = dword_50B9F8[v45 + 1]; | |
6906 } | |
6907 ++ic; | |
6908 thisd = v83; | |
6909 } | |
6910 while ( ic <= v36 ); | |
6911 if ( !v43 | |
6912 || (v48 = 0, | |
6913 dword_50BAE0[v43] = dword_50BAE0[0], | |
6914 dword_50B9F0[v43] = dword_50B9F0[0], | |
6915 v49 = pBLVRenderParams->uViewportY, | |
6916 v50 = dword_50B9F0[0] < (signed int)pBLVRenderParams->uViewportY, | |
6917 LOBYTE(v50) = dword_50B9F0[0] >= (signed int)pBLVRenderParams->uViewportY, | |
6918 v51 = 1, | |
6919 id = 1, | |
6920 v43 < 1) ) | |
6921 return 0; | |
6922 do | |
6923 { | |
6924 v52 = v51; | |
6925 v53 = dword_50B9F0[v52]; | |
6926 v84 = v53 >= (signed int)v49; | |
6927 if ( v50 ^ v84 ) | |
6928 { | |
6929 if ( v53 >= (signed int)v49 ) | |
6930 { | |
6931 v69 = (signed int)(v49 - dword_50B9EC[v52]) | |
6932 * (signed __int64)(dword_50BAE0[v52] - dword_50BADC_xs[v52]) | |
6933 / (v53 - dword_50B9EC[v52]); | |
6934 v54 = dword_50BADC_xs[v52]; | |
6935 } | |
6936 else | |
6937 { | |
6938 v69 = (signed int)(v49 - v53) | |
6939 * (signed __int64)(dword_50BADC_xs[v52] - dword_50BAE0[v52]) | |
6940 / (dword_50B9EC[v52] - v53); | |
6941 v54 = dword_50BAE0[v52]; | |
6942 } | |
6943 ++v48; | |
6944 dword_50BAD0[v48] = v69 + v54; | |
6945 v49 = pBLVRenderParams->uViewportY; | |
6946 dword_50B9E0_ys[v48] = pBLVRenderParams->uViewportY; | |
6947 } | |
6948 v50 = v84; | |
6949 if ( v84 ) | |
6950 { | |
6951 dword_50BAD4[v48] = dword_50BAE0[v52]; | |
6952 dword_50B9E0_ys[v48++ + 1] = dword_50B9F0[v52]; | |
6953 } | |
6954 v51 = id++ + 1; | |
6955 } | |
6956 while ( id <= v43 ); | |
6957 if ( !v48 | |
6958 || (v55 = 0, | |
6959 dword_50BAD4[v48] = dword_50BAD4[0], | |
6960 dword_50B9E0_ys[v48 + 1] = dword_50B9E0_ys[1], | |
6961 v56 = pBLVRenderParams->uViewportW, | |
6962 thise = dword_50B9E0_ys[1] <= (signed int)pBLVRenderParams->uViewportW, | |
6963 ie = 1, | |
6964 v48 < 1) ) | |
6965 return 0; | |
6966 do | |
6967 { | |
6968 v57 = ie; | |
6969 v58 = dword_50B9E0_ys[ie + 1]; | |
6970 v85 = v58 <= (signed int)v56; | |
6971 if ( thise ^ v85 ) | |
6972 { | |
6973 if ( v58 <= (signed int)v56 ) | |
6974 { | |
6975 v70 = (signed int)(v56 - dword_50B9E0_ys[v57]) | |
6976 * (signed __int64)(dword_50BAD4[v57] - dword_50BAD0[v57]) | |
6977 / (v58 - dword_50B9E0_ys[v57]); | |
6978 v59 = dword_50BAD0[v57]; | |
6979 } | |
6980 else | |
6981 { | |
6982 v70 = (signed int)(v56 - v58) | |
6983 * (signed __int64)(dword_50BAD0[v57] - dword_50BAD4[v57]) | |
6984 / (dword_50B9E0_ys[v57] - v58); | |
6985 v59 = dword_50BAD4[v57]; | |
6986 } | |
6987 ++v55; | |
6988 dword_50BAC4[v55] = v70 + v59; | |
6989 v56 = pBLVRenderParams->uViewportW; | |
6990 unk_50B9D4[v55] = pBLVRenderParams->uViewportW; | |
6991 } | |
6992 if ( v85 ) | |
6993 { | |
6994 dword_50BAC8[v55] = dword_50BAD4[v57]; | |
6995 dword_50B9D8_ys[v55++] = dword_50B9E0_ys[v57 + 1]; | |
6996 } | |
6997 ++ie; | |
6998 thise = v85; | |
6999 } | |
7000 while ( ie <= v48 ); | |
7001 if ( !v55 ) | |
7002 return 0; | |
7003 v61 = pRenderer->pRenderD3D == 0; | |
7004 dword_50BAC8[v55] = dword_50BAC8[0]; | |
7005 dword_50B9D8_ys[v55] = dword_50B9D8_ys[0]; | |
7006 if ( v61 && v55 > 3 ) | |
7007 { | |
7008 dword_50BAC8[v55 + 1] = dword_50BAC8[1]; | |
7009 dword_50B9D8_ys[v55 + 1] = dword_50B9D8_ys[1]; | |
7010 thisf = 2 * (dword_50B700 != 0) - 1; | |
7011 if ( v55 > 0 ) | |
7012 { | |
7013 v62 = 1; | |
7014 v71 = 1; | |
7015 do | |
7016 { | |
7017 v63 = v62 - 1; | |
7018 v64 = v62 + 1; | |
7019 v80 = v62 + 1; | |
7020 if ( v62 - 1 >= v55 ) | |
7021 v63 -= v55; | |
7022 if ( v62 >= v55 ) | |
7023 v62 -= v55; | |
7024 if ( v64 >= v55 ) | |
7025 v64 -= v55; | |
7026 if ( thisf | |
7027 * ((dword_50B9D8_ys[v64] - dword_50B9D8_ys[v63]) * (dword_50BAC8[v62] - dword_50BAC8[v63]) | |
7028 - (dword_50B9D8_ys[v62] - dword_50B9D8_ys[v63]) * (dword_50BAC8[v64] - dword_50BAC8[v63])) < 0 ) | |
7029 { | |
7030 v62 = v80; | |
7031 v71 = v80; | |
7032 } | |
7033 else | |
7034 { | |
7035 v62 = v71; | |
7036 v65 = v71; | |
7037 if ( v71 < v55 || (v65 = v71 - v55, v71 - v55 < v55) ) | |
7038 { | |
7039 memcpy(&dword_50B9D8_ys[v65], &dword_50B9D8_ys[v65 + 1], 4 * ((unsigned int)(4 * (v55 - v65)) >> 2)); | |
7040 memcpy(&dword_50BAC8[v65], &dword_50BAC8[v65 + 1], 4 * ((unsigned int)(4 * (v55 - v65)) >> 2)); | |
7041 } | |
7042 --v55; | |
7043 } | |
7044 } | |
7045 while ( v62 - 1 < v55 ); | |
7046 } | |
7047 dword_50BAC8[v55] = dword_50BAC8[0]; | |
7048 dword_50B9D8_ys[v55] = dword_50B9D8_ys[0]; | |
7049 } | |
7050 return v55; | |
7051 } | |
7052 | |
7053 | |
7054 //----- (00424579) -------------------------------------------------------- | |
7055 int __fastcall sub_424579(int uFaceID, stru320 *a2) | |
7056 { | |
7057 __debugbreak(); | |
7058 return 0; | |
7059 /*BLVFace *v2; // eax@1 | |
7060 Vec3_short_ *v3; // ebx@1 | |
7061 Vec3_short_ *v4; // esi@1 | |
7062 unsigned int v5; // esi@3 | |
7063 int v7; // ST1C_4@5 | |
7064 int v8; // ST1C_4@5 | |
7065 int v9; // ST1C_4@5 | |
7066 int v10; // ST1C_4@5 | |
7067 int v11; // esi@5 | |
7068 int v12; // ST1C_4@5 | |
7069 unsigned int v15; // ecx@8 | |
7070 unsigned int v19; // ecx@13 | |
7071 signed int v20; // ecx@16 | |
7072 signed int result; // eax@20 | |
7073 signed int v24; // edx@22 | |
7074 unsigned int v25; // [sp+Ch] [bp-1Ch]@3 | |
7075 float v26; // [sp+14h] [bp-14h]@3 | |
7076 float v27; // [sp+1Ch] [bp-Ch]@3 | |
7077 float v28; // [sp+20h] [bp-8h]@3 | |
7078 signed int v29; // [sp+24h] [bp-4h]@3 | |
7079 | |
7080 v2 = &pIndoor->pFaces[uFaceID]; | |
7081 v3 = pIndoor->pVertices; | |
7082 v4 = &pIndoor->pVertices[*v2->pVertexIDs]; | |
7083 if ( v2->pFacePlane_old.vNormal.x * ((signed __int16)*(int *)&v4->x - pBLVRenderParams->vPartyPos.x) | |
7084 + v2->pFacePlane_old.vNormal.y * ((signed __int16)(*(int *)&v4->x >> 16) - pBLVRenderParams->vPartyPos.y) | |
7085 + v2->pFacePlane_old.vNormal.z * (v4->z - pBLVRenderParams->vPartyPos.z) < 0 ) | |
7086 { | |
7087 dword_50B700 = 1; | |
7088 } | |
7089 else | |
7090 { | |
7091 dword_50B700 = 0; | |
7092 if ( !(v2->uAttributes & 1) ) | |
7093 return 0; | |
7094 } | |
7095 v29 = 0; | |
7096 v5 = v2->uNumVertices; | |
7097 __asm { fld pBLVRenderParams->fCosineY } | |
7098 v28 = pBLVRenderParams->fSineY; | |
7099 v26 = pBLVRenderParams->fCosineNegX; | |
7100 v27 = pBLVRenderParams->fSineNegX; | |
7101 v25 = v5; | |
7102 if ( (signed int)v5 > 0 ) | |
7103 { | |
7104 _ECX = (char *)&array_50AC10[0].vWorldPosition.z; | |
7105 do | |
7106 { | |
7107 v7 = v3[v2->pVertexIDs[v29]].x; | |
7108 __asm | |
7109 { | |
7110 fild [ebp+var_10] | |
7111 fstp dword ptr [ecx-8] | |
7112 } | |
7113 v8 = v3[v2->pVertexIDs[v29]].y; | |
7114 __asm | |
7115 { | |
7116 fild [ebp+var_10] | |
7117 fstp dword ptr [ecx-4] | |
7118 } | |
7119 v9 = v3[v2->pVertexIDs[v29]].z; | |
7120 __asm | |
7121 { | |
7122 fild [ebp+var_10] | |
7123 fstp dword ptr [ecx] | |
7124 } | |
7125 _ECX += 48; | |
7126 v10 = a2->pDeltaUV[0] + v2->pVertexUIDs[v29]; | |
7127 __asm | |
7128 { | |
7129 fild [ebp+var_10] | |
7130 fstp dword ptr [ecx-14h] | |
7131 } | |
7132 v11 = a2->pDeltaUV[1] + v2->pVertexVIDs[v29++]; | |
7133 v12 = v11; | |
7134 v5 = v25; | |
7135 __asm | |
7136 { | |
7137 fild [ebp+var_10] | |
7138 fstp dword ptr [ecx-10h] | |
7139 } | |
7140 } | |
7141 while ( v29 < (signed int)v25 ); | |
7142 } | |
7143 _EDX = (char *)&array_50AC10[0].vWorldViewPosition; | |
7144 if ( pBLVRenderParams->sPartyRotX ) | |
7145 { | |
7146 if ( (signed int)v5 > 0 ) | |
7147 { | |
7148 __asm | |
7149 { | |
7150 fild pBLVRenderParams->vPartyPos.x | |
7151 fild pBLVRenderParams->vPartyPos.y | |
7152 fild pBLVRenderParams->vPartyPos.z | |
7153 } | |
7154 _EAX = (char *)&array_50AC10[0].vWorldPosition.z; | |
7155 v15 = v5; | |
7156 do | |
7157 { | |
7158 __asm | |
7159 { | |
7160 fld dword ptr [eax-8] | |
7161 fsub st, st(3) | |
7162 fld dword ptr [eax-4] | |
7163 fsub st, st(3) | |
7164 fld st(1) | |
7165 fmul st, st(6) | |
7166 fld st(1) | |
7167 fmul [ebp+var_8] | |
7168 fsubp st(1), st | |
7169 fstp [ebp+var_4] | |
7170 fld dword ptr [eax] | |
7171 fsub st, st(3) | |
7172 } | |
7173 _EAX += 48; | |
7174 --v15; | |
7175 __asm | |
7176 { | |
7177 fstp [ebp+var_10] | |
7178 fld [ebp+var_4] | |
7179 fmul [ebp+var_14] | |
7180 fld [ebp+var_10] | |
7181 fmul [ebp+var_C] | |
7182 fsubp st(1), st | |
7183 fstp dword ptr [eax-2Ch] | |
7184 fld st(1) | |
7185 fmul [ebp+var_8] | |
7186 fld st(1) | |
7187 fmul st, st(7) | |
7188 faddp st(1), st | |
7189 fstp dword ptr [eax-28h] | |
7190 fstp st | |
7191 fstp st | |
7192 fld [ebp+var_4] | |
7193 fmul [ebp+var_C] | |
7194 fld [ebp+var_10] | |
7195 fmul [ebp+var_14] | |
7196 faddp st(1), st | |
7197 fstp dword ptr [eax-24h] | |
7198 } | |
7199 } | |
7200 while ( v15 ); | |
7201 LABEL_15: | |
7202 __asm | |
7203 { | |
7204 fstp st | |
7205 fstp st | |
7206 fstp st | |
7207 } | |
7208 goto LABEL_16; | |
7209 } | |
7210 } | |
7211 else | |
7212 { | |
7213 if ( (signed int)v5 > 0 ) | |
7214 { | |
7215 __asm | |
7216 { | |
7217 fild pBLVRenderParams->vPartyPos.x | |
7218 fild pBLVRenderParams->vPartyPos.y | |
7219 fild pBLVRenderParams->vPartyPos.z | |
7220 } | |
7221 _EAX = (char *)&array_50AC10[0].vWorldViewPosition; | |
7222 v19 = v5; | |
7223 do | |
7224 { | |
7225 __asm | |
7226 { | |
7227 fld dword ptr [eax-0Ch] | |
7228 fsub st, st(3) | |
7229 fld dword ptr [eax-8] | |
7230 fsub st, st(3) | |
7231 fld st(1) | |
7232 fmul st, st(6) | |
7233 fld st(1) | |
7234 fmul [ebp+var_8] | |
7235 fsubp st(1), st | |
7236 fstp dword ptr [eax] | |
7237 fld st(1) | |
7238 fmul [ebp+var_8] | |
7239 fld st(1) | |
7240 fmul st, st(7) | |
7241 } | |
7242 _EAX += 48; | |
7243 --v19; | |
7244 __asm | |
7245 { | |
7246 faddp st(1), st | |
7247 fstp dword ptr [eax-2Ch] | |
7248 fstp st | |
7249 fstp st | |
7250 fld dword ptr [eax-34h] | |
7251 fsub st, st(1) | |
7252 fstp dword ptr [eax-28h] | |
7253 } | |
7254 } | |
7255 while ( v19 ); | |
7256 goto LABEL_15; | |
7257 } | |
7258 } | |
7259 LABEL_16: | |
7260 v20 = 0; | |
7261 __asm { fstp st } | |
7262 if ( (signed int)v5 <= 0 ) | |
7263 return 0; | |
7264 do | |
7265 { | |
7266 __asm | |
7267 { | |
7268 fld dword ptr [edx] | |
7269 fcomp ds:flt_4D8524 | |
7270 fnstsw ax | |
7271 } | |
7272 if ( !(HIBYTE(_AX) & 1) ) | |
7273 break; | |
7274 ++v20; | |
7275 _EDX += 48; | |
7276 } | |
7277 while ( v20 < (signed int)v5 ); | |
7278 if ( v20 >= (signed int)v5 ) | |
7279 return 0; | |
7280 result = sr_424CD7(v5); | |
7281 if ( result > 0 ) | |
7282 { | |
7283 __asm { fild pBLVRenderParams->field_40 } | |
7284 _ECX = (char *)&array_507D30[0].vWorldViewPosition; | |
7285 v24 = result; | |
7286 __asm | |
7287 { | |
7288 fmul ds:flt_4D84A4 | |
7289 fild pBLVRenderParams->uViewportCenterX | |
7290 fild pBLVRenderParams->uViewportCenterY | |
7291 } | |
7292 do | |
7293 { | |
7294 __asm | |
7295 { | |
7296 fld1 | |
7297 fdiv dword ptr [ecx] | |
7298 } | |
7299 _ECX += 48; | |
7300 --v24; | |
7301 __asm | |
7302 { | |
7303 fld st | |
7304 fmul dword ptr [ecx-2Ch] | |
7305 fmul st, st(4) | |
7306 fsubr st, st(3) | |
7307 fstp dword ptr [ecx-24h] | |
7308 fmul dword ptr [ecx-28h] | |
7309 fmul st, st(3) | |
7310 fsubr st, st(1) | |
7311 fstp dword ptr [ecx-20h] | |
7312 } | |
7313 } | |
7314 while ( v24 ); | |
7315 __asm | |
7316 { | |
7317 fstp st | |
7318 fstp st | |
7319 fstp st | |
7320 } | |
7321 } | |
7322 memcpy(&array_507D30[result], array_507D30, sizeof(array_507D30[result])); | |
7323 return result;*/ | |
7324 } | |
7325 | |
7326 | |
7327 //----- (00424829) -------------------------------------------------------- | |
7328 bool sub_424829(int a1, BspRenderer_stru2 *a2, BspRenderer_stru2 *a3, int a4) | |
7329 { | |
7330 int v4; // edi@1 | |
7331 BspRenderer_stru2 *v5; // ebx@1 | |
7332 int v6; // eax@3 | |
7333 int v7; // esi@5 | |
7334 int v8; // edx@5 | |
7335 int v9; // ecx@6 | |
7336 int v10; // eax@12 | |
7337 int v11; // edi@13 | |
7338 int v12; // edx@18 | |
7339 int v13; // eax@22 | |
7340 int v14; // edi@28 | |
7341 int v15; // ecx@29 | |
7342 int v16; // edi@30 | |
7343 int v17; // edx@35 | |
7344 int v18; // eax@39 | |
7345 int v19; // eax@44 | |
7346 int v20; // ecx@44 | |
7347 int v21; // edi@45 | |
7348 int v22; // edi@46 | |
7349 __int16 *v23; // ecx@47 | |
7350 int v24; // edx@48 | |
7351 int v25; // eax@50 | |
7352 int v26; // eax@55 | |
7353 signed int v27; // edi@55 | |
7354 int v28; // edx@56 | |
7355 int v29; // edx@57 | |
7356 int v30; // eax@59 | |
7357 int v31; // eax@64 | |
7358 signed int v32; // edi@64 | |
7359 int v33; // edx@65 | |
7360 __int16 *v34; // eax@66 | |
7361 __int16 v35; // dx@66 | |
7362 __int16 v36; // dx@67 | |
7363 __int16 v37; // di@67 | |
7364 __int16 v38; // dx@67 | |
7365 BspRenderer_stru2 *v39; // ecx@69 | |
7366 int v40; // edx@69 | |
7367 int v41; // edi@70 | |
7368 __int16 *v42; // eax@76 | |
7369 __int16 *v43; // eax@81 | |
7370 __int16 *v45; // eax@87 | |
7371 int v46; // edx@87 | |
7372 __int16 v47; // cx@88 | |
7373 int v48; // eax@93 | |
7374 int v49; // esi@93 | |
7375 __int16 *v50; // ecx@94 | |
7376 int v51; // eax@95 | |
7377 int v52; // eax@97 | |
7378 int v53; // [sp+Ch] [bp-34h]@44 | |
7379 int v54; // [sp+10h] [bp-30h]@0 | |
7380 int v55; // [sp+14h] [bp-2Ch]@12 | |
7381 __int16 *v56; // [sp+14h] [bp-2Ch]@47 | |
7382 __int16 *v57; // [sp+14h] [bp-2Ch]@76 | |
7383 __int16 *v58; // [sp+14h] [bp-2Ch]@81 | |
7384 __int16 *v59; // [sp+14h] [bp-2Ch]@87 | |
7385 BspRenderer_stru2 *v60; // [sp+18h] [bp-28h]@1 | |
7386 int v61; // [sp+1Ch] [bp-24h]@29 | |
7387 int v62; // [sp+20h] [bp-20h]@0 | |
7388 signed int v63; // [sp+24h] [bp-1Ch]@3 | |
7389 signed int v64; // [sp+28h] [bp-18h]@3 | |
7390 int v65; // [sp+2Ch] [bp-14h]@5 | |
7391 int v66; // [sp+2Ch] [bp-14h]@39 | |
7392 int v67; // [sp+30h] [bp-10h]@22 | |
7393 int v68; // [sp+34h] [bp-Ch]@12 | |
7394 int v69; // [sp+34h] [bp-Ch]@29 | |
7395 int v70; // [sp+34h] [bp-Ch]@46 | |
7396 int v71; // [sp+34h] [bp-Ch]@75 | |
7397 int v72; // [sp+34h] [bp-Ch]@80 | |
7398 int v73; // [sp+38h] [bp-8h]@11 | |
7399 int v74; // [sp+3Ch] [bp-4h]@1 | |
7400 int a3a; // [sp+48h] [bp+8h]@76 | |
7401 int a3b; // [sp+48h] [bp+8h]@87 | |
7402 | |
7403 v4 = a1; | |
7404 v5 = a2; | |
7405 v74 = a1; | |
7406 v60 = a2; | |
7407 if ( !a1 | |
7408 || (!dword_50B700 ? (v64 = -1, v6 = 1, v63 = 1) : (v6 = 1, v63 = -1, v64 = 1), | |
7409 v7 = dword_50B9D8_ys[0], | |
7410 v65 = 0, | |
7411 v8 = dword_50B9D8_ys[0], | |
7412 a1 <= v6) ) | |
7413 return 0; | |
7414 do | |
7415 { | |
7416 v9 = dword_50B9D8_ys[v6]; | |
7417 if ( v9 >= v7 ) | |
7418 { | |
7419 if ( v9 > v8 ) | |
7420 v8 = dword_50B9D8_ys[v6]; | |
7421 } | |
7422 else | |
7423 { | |
7424 v65 = v6; | |
7425 v7 = dword_50B9D8_ys[v6]; | |
7426 } | |
7427 ++v6; | |
7428 } | |
7429 while ( v6 < v4 ); | |
7430 v73 = v8; | |
7431 if ( v8 == v7 ) | |
7432 return 0; | |
7433 v10 = v65; | |
7434 v68 = 0; | |
7435 v5->_viewport_space_y = v7; | |
7436 v5->_viewport_space_w = v8; | |
7437 v55 = v65; | |
7438 if ( v4 > 0 ) | |
7439 { | |
7440 v11 = v65; | |
7441 do | |
7442 { | |
7443 v10 += v64; | |
7444 if ( v10 < v74 ) | |
7445 { | |
7446 if ( v10 < 0 ) | |
7447 v10 += v74; | |
7448 } | |
7449 else | |
7450 { | |
7451 v10 -= v74; | |
7452 } | |
7453 v12 = dword_50B9D8_ys[v10]; | |
7454 if ( v12 <= dword_50B9D8_ys[v11] ) | |
7455 { | |
7456 v55 = v10; | |
7457 v11 = v10; | |
7458 } | |
7459 if ( v12 == v73 ) | |
7460 break; | |
7461 ++v68; | |
7462 } | |
7463 while ( v68 < v74 ); | |
7464 } | |
7465 v13 = v55 + v64; | |
7466 v67 = v55 + v64; | |
7467 if ( v55 + v64 < v74 ) | |
7468 { | |
7469 if ( v13 >= 0 ) | |
7470 goto LABEL_27; | |
7471 v13 += v74; | |
7472 } | |
7473 else | |
7474 { | |
7475 v13 -= v74; | |
7476 } | |
7477 v67 = v13; | |
7478 LABEL_27: | |
7479 if ( dword_50B9D8_ys[v13] != dword_50B9D8_ys[v55] ) | |
7480 { | |
7481 v14 = dword_50BAC8[v55]; | |
7482 v62 = v14 << 16; | |
7483 v54 = ((dword_50BAC8[v13] - v14) << 16) / (dword_50B9D8_ys[v13] - dword_50B9D8_ys[v55]); | |
7484 v5->array_18[v7] = LOWORD(dword_50BAC8[v55]); | |
7485 } | |
7486 v15 = v65; | |
7487 v69 = 0; | |
7488 v61 = v65; | |
7489 if ( v74 > 0 ) | |
7490 { | |
7491 v16 = v65; | |
7492 do | |
7493 { | |
7494 v15 += v63; | |
7495 if ( v15 < v74 ) | |
7496 { | |
7497 if ( v15 < 0 ) | |
7498 v15 += v74; | |
7499 } | |
7500 else | |
7501 { | |
7502 v15 -= v74; | |
7503 } | |
7504 v17 = dword_50B9D8_ys[v15]; | |
7505 if ( v17 <= dword_50B9D8_ys[v16] ) | |
7506 { | |
7507 v61 = v15; | |
7508 v16 = v15; | |
7509 } | |
7510 if ( v17 == v73 ) | |
7511 break; | |
7512 ++v69; | |
7513 } | |
7514 while ( v69 < v74 ); | |
7515 } | |
7516 v18 = v63 + v61; | |
7517 v66 = v63 + v61; | |
7518 if ( v63 + v61 < v74 ) | |
7519 { | |
7520 if ( v18 >= 0 ) | |
7521 goto LABEL_44; | |
7522 v18 += v74; | |
7523 } | |
7524 else | |
7525 { | |
7526 v18 -= v74; | |
7527 } | |
7528 v66 = v18; | |
7529 LABEL_44: | |
7530 v19 = v18; | |
7531 v20 = v61; | |
7532 v53 = dword_50B9D8_ys[v19] - dword_50B9D8_ys[v61]; | |
7533 if ( dword_50B9D8_ys[v19] != dword_50B9D8_ys[v61] ) | |
7534 { | |
7535 v21 = dword_50BAC8[v20]; | |
7536 v5 = v60; | |
7537 v61 = v21 << 16; | |
7538 v53 = ((dword_50BAC8[v19] - v21) << 16) / v53; | |
7539 v60->array_3D8[v73] = LOWORD(dword_50BAC8[v20]); | |
7540 } | |
7541 v22 = v7; | |
7542 v70 = v7; | |
7543 if ( v7 <= v73 ) | |
7544 { | |
7545 v56 = &v5->array_3D8[v7]; | |
7546 v23 = &v5->array_18[v7]; | |
7547 do | |
7548 { | |
7549 v24 = v67; | |
7550 if ( v22 < dword_50B9D8_ys[v67] || v22 == v73 ) | |
7551 goto LABEL_57; | |
7552 v25 = v64 + v67; | |
7553 v67 = v25; | |
7554 if ( v25 < v74 ) | |
7555 { | |
7556 if ( v25 >= 0 ) | |
7557 goto LABEL_55; | |
7558 v25 += v74; | |
7559 } | |
7560 else | |
7561 { | |
7562 v25 -= v74; | |
7563 } | |
7564 v67 = v25; | |
7565 LABEL_55: | |
7566 v26 = v25; | |
7567 v27 = dword_50B9D8_ys[v26] - dword_50B9D8_ys[v24]; | |
7568 if ( dword_50B9D8_ys[v26] - dword_50B9D8_ys[v24] > 0 ) | |
7569 { | |
7570 v28 = dword_50BAC8[v24]; | |
7571 v54 = ((dword_50BAC8[v26] - v28) << 16) / v27; | |
7572 v62 = v28 << 16; | |
7573 } | |
7574 LABEL_57: | |
7575 v29 = v66; | |
7576 if ( v70 >= dword_50B9D8_ys[v66] && v70 != v73 ) | |
7577 { | |
7578 v30 = v63 + v66; | |
7579 v66 += v63; | |
7580 if ( v66 >= v74 ) | |
7581 { | |
7582 v30 -= v74; | |
7583 goto LABEL_63; | |
7584 } | |
7585 if ( v30 < 0 ) | |
7586 { | |
7587 v30 += v74; | |
7588 LABEL_63: | |
7589 v66 = v30; | |
7590 } | |
7591 v31 = v30; | |
7592 v32 = dword_50B9D8_ys[v31] - dword_50B9D8_ys[v29]; | |
7593 if ( dword_50B9D8_ys[v31] - dword_50B9D8_ys[v29] > 0 ) | |
7594 { | |
7595 v33 = dword_50BAC8[v29]; | |
7596 v53 = ((dword_50BAC8[v31] - v33) << 16) / v32; | |
7597 v61 = v33 << 16; | |
7598 } | |
7599 } | |
7600 *(__int16 *)((char *)v56 + (int)(char *)v5->array_18 - (char *)v5->array_3D8) = HIWORD(v62); | |
7601 *v56 = HIWORD(v61); | |
7602 v34 = v23 + 480; | |
7603 v35 = v23[480]; | |
7604 if ( *v23 > v35 ) | |
7605 { | |
7606 v36 = *v23 ^ v35; | |
7607 v37 = *v34; | |
7608 *v23 = v36; | |
7609 v38 = v37 ^ v36; | |
7610 *v23 ^= v38; | |
7611 *v34 = v38; | |
7612 } | |
7613 ++v56; | |
7614 v62 += v54; | |
7615 v22 = v70 + 1; | |
7616 v61 += v53; | |
7617 ++v23; | |
7618 ++v70; | |
7619 } | |
7620 while ( v70 <= v73 ); | |
7621 } | |
7622 v39 = a3; | |
7623 v40 = v73; | |
7624 if ( v73 < a3->_viewport_space_y || (v41 = a3->_viewport_space_w, v7 > v41) ) | |
7625 return 0; | |
7626 if ( v7 < a3->_viewport_space_y ) | |
7627 v7 = a3->_viewport_space_y; | |
7628 if ( v73 > v41 ) | |
7629 { | |
7630 v40 = a3->_viewport_space_w; | |
7631 v73 = a3->_viewport_space_w; | |
7632 } | |
7633 v71 = v7; | |
7634 if ( v7 <= v40 ) | |
7635 { | |
7636 a3a = (char *)v5 - (char *)a3; | |
7637 v57 = &v5->array_18[v7]; | |
7638 v42 = &v39->array_3D8[v7]; | |
7639 do | |
7640 { | |
7641 if ( *(__int16 *)((char *)v42 + a3a) >= *(v42 - 480) && *v57 <= *v42 ) | |
7642 break; | |
7643 ++v57; | |
7644 ++v7; | |
7645 ++v71; | |
7646 ++v42; | |
7647 } | |
7648 while ( v71 <= v40 ); | |
7649 } | |
7650 v72 = v40; | |
7651 if ( v40 < v7 ) | |
7652 return 0; | |
7653 v58 = &v5->array_18[v40]; | |
7654 v43 = &v39->array_3D8[v40]; | |
7655 do | |
7656 { | |
7657 if ( *(__int16 *)((char *)v43 + (int)(char *)v5 - (char *)v39) >= *(v43 - 480) && *v58 <= *v43 ) | |
7658 break; | |
7659 --v58; | |
7660 --v40; | |
7661 --v72; | |
7662 --v43; | |
7663 v73 = v40; | |
7664 } | |
7665 while ( v72 >= v7 ); | |
7666 if ( v7 >= v40 ) | |
7667 return 0; | |
7668 a3b = (char *)v39 - (char *)v5; | |
7669 v59 = &v39->array_3D8[v7]; | |
7670 v45 = &v5->array_18[v7]; | |
7671 v46 = v73 - v7 + 1; | |
7672 do | |
7673 { | |
7674 v47 = *(__int16 *)((char *)v45 + a3b); | |
7675 if ( *v45 < v47 ) | |
7676 *v45 = v47; | |
7677 if ( v45[480] > *v59 ) | |
7678 v45[480] = *v59; | |
7679 ++v59; | |
7680 ++v45; | |
7681 --v46; | |
7682 } | |
7683 while ( v46 ); | |
7684 v5->_viewport_space_y = v7; | |
7685 v5->_viewport_space_w = v73; | |
7686 v5->field_8 = v5->array_18[v7]; | |
7687 v48 = v5->array_3D8[v7]; | |
7688 v5->field_10 = v7; | |
7689 v5->field_14 = v7; | |
7690 v49 = v7 + 1; | |
7691 v5->field_C = v48; | |
7692 if ( v49 <= v73 ) | |
7693 { | |
7694 v50 = &v5->array_3D8[v49]; | |
7695 do | |
7696 { | |
7697 v51 = *(v50 - 480); | |
7698 if ( v51 < v5->field_8 ) | |
7699 { | |
7700 v5->field_8 = v51; | |
7701 v5->field_10 = v49; | |
7702 } | |
7703 v52 = *v50; | |
7704 if ( v52 > v5->field_C ) | |
7705 { | |
7706 v5->field_C = v52; | |
7707 v5->field_14 = v49; | |
7708 } | |
7709 ++v49; | |
7710 ++v50; | |
7711 } | |
7712 while ( v49 <= v73 ); | |
7713 } | |
7714 return 1; | |
7715 } | |
7716 // 50B700: using guessed type int dword_50B700; | |
7717 | |
7718 //----- (00424CD7) -------------------------------------------------------- | |
7719 signed int __fastcall sr_424CD7(unsigned int uVertexID) | |
7720 { | |
7721 unsigned int v1; // edx@1 | |
7722 signed int v2; // edi@1 | |
7723 char *v3; // esi@4 | |
7724 char *v4; // ecx@4 | |
7725 unsigned int v5; // eax@4 | |
7726 char *v6; // edx@4 | |
7727 double v7; // st6@10 | |
7728 double v8; // st5@10 | |
7729 double v9; // st6@11 | |
7730 unsigned __int8 v10; // c2@15 | |
7731 unsigned __int8 v11; // c3@15 | |
7732 RenderVertexSoft *v12; // edi@22 | |
7733 char *v13; // eax@22 | |
7734 double v14; // st6@22 | |
7735 signed int result; // eax@24 | |
7736 unsigned int v16; // [sp+8h] [bp-28h]@4 | |
7737 bool v17; // [sp+Ch] [bp-24h]@6 | |
7738 char *v18; // [sp+10h] [bp-20h]@4 | |
7739 char *v19; // [sp+14h] [bp-1Ch]@4 | |
7740 signed int v20; // [sp+18h] [bp-18h]@1 | |
7741 RenderVertexSoft *v21; // [sp+1Ch] [bp-14h]@4 | |
7742 char *v22; // [sp+20h] [bp-10h]@4 | |
7743 char *v23; // [sp+24h] [bp-Ch]@4 | |
7744 char *v24; // [sp+28h] [bp-8h]@4 | |
7745 char *v25; // [sp+2Ch] [bp-4h]@4 | |
7746 | |
7747 v1 = uVertexID; | |
7748 memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID])); | |
7749 v2 = 0; | |
7750 v20 = 0; | |
7751 if ( array_50AC10[0].vWorldViewPosition.x >= 8.0 ) | |
7752 v2 = 1; | |
7753 if ( (signed int)(uVertexID + 1) <= 1 ) | |
7754 return 0; | |
7755 v3 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
7756 v4 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
7757 v5 = v1; | |
7758 v23 = (char *)&array_507D30[0].flt_20; | |
7759 v21 = array_507D30; | |
7760 v18 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
7761 v19 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
7762 v22 = (char *)&array_507D30[0].vWorldViewPosition; | |
7763 v24 = (char *)&array_507D30[0].v; | |
7764 v25 = (char *)&array_507D30[0].u; | |
7765 v6 = (char *)&array_50AC10[0].v; | |
7766 v16 = v5; | |
7767 do | |
7768 { | |
7769 v17 = *((float *)v6 + 5) >= 8.0; | |
7770 if ( v2 != v17 ) | |
7771 { | |
7772 if ( v17 ) | |
7773 { | |
7774 v7 = (8.0 - *((float *)v6 - 7)) / (*((float *)v6 + 5) - *((float *)v6 - 7)); | |
7775 *(float *)v4 = (*((float *)v6 + 6) - *((float *)v6 - 6)) * v7 + *((float *)v6 - 6); | |
7776 *(float *)v3 = (*((float *)v6 + 7) - *((float *)v6 - 5)) * v7 + *((float *)v6 - 5); | |
7777 *(float *)v25 = (*((float *)v6 + 11) - *((float *)v6 - 1)) * v7 + *((float *)v6 - 1); | |
7778 v8 = (*((float *)v6 + 12) - *(float *)v6) * v7 + *(float *)v6; | |
7779 } | |
7780 else | |
7781 { | |
7782 v9 = (8.0 - *((float *)v6 + 5)) / (*((float *)v6 - 7) - *((float *)v6 + 5)); | |
7783 *(float *)v4 = (*((float *)v6 - 6) - *((float *)v6 + 6)) * v9 + *((float *)v6 + 6); | |
7784 *(float *)v3 = (*((float *)v6 - 5) - *((float *)v6 + 7)) * v9 + *((float *)v6 + 7); | |
7785 *(float *)v25 = (*((float *)v6 - 1) - *((float *)v6 + 11)) * v9 + *((float *)v6 + 11); | |
7786 v8 = (*(float *)v6 - *((float *)v6 + 12)) * v9 + *((float *)v6 + 12); | |
7787 } | |
7788 *(float *)v24 = v8; | |
7789 *(float *)v22 = 8.0; | |
7790 *(int *)v23 = 0x3E000000u; | |
7791 if ( v2 ) | |
7792 { | |
7793 if ( 8.0 == *((float *)v6 - 7) && *(float *)v4 == *((float *)v6 - 6) ) | |
7794 { | |
7795 v10 = 0; | |
7796 v11 = *(float *)v3 == *((float *)v6 - 5); | |
7797 goto LABEL_19; | |
7798 } | |
7799 } | |
7800 else | |
7801 { | |
7802 if ( 8.0 == *((float *)v6 + 5) && *(float *)v4 == *((float *)v6 + 6) ) | |
7803 { | |
7804 v10 = 0; | |
7805 v11 = *(float *)v3 == *((float *)v6 + 7); | |
7806 LABEL_19: | |
7807 if ( v11 | v10 ) | |
7808 goto LABEL_21; | |
7809 goto LABEL_20; | |
7810 } | |
7811 } | |
7812 LABEL_20: | |
7813 ++v21; | |
7814 v22 += 48; | |
7815 v24 += 48; | |
7816 v25 += 48; | |
7817 v4 += 48; | |
7818 v3 += 48; | |
7819 ++v20; | |
7820 v23 += 48; | |
7821 v19 = v4; | |
7822 v18 = v3; | |
7823 } | |
7824 LABEL_21: | |
7825 if ( v17 ) | |
7826 { | |
7827 v12 = v21; | |
7828 v13 = v23; | |
7829 v19 += 48; | |
7830 v18 += 48; | |
7831 v14 = 1.0 / (*((float *)v6 + 5) + 0.0000001); | |
7832 ++v20; | |
7833 v25 += 48; | |
7834 v24 += 48; | |
7835 v22 += 48; | |
7836 ++v21; | |
7837 v23 += 48; | |
7838 memcpy(v12, v6 + 8, 0x30u); | |
7839 v4 = v19; | |
7840 v3 = v18; | |
7841 *(float *)v13 = v14; | |
7842 } | |
7843 v2 = v17; | |
7844 v6 += 48; | |
7845 --v16; | |
7846 } | |
7847 while ( v16 ); | |
7848 result = v20; | |
7849 if ( v20 < 3 ) | |
7850 return 0; | |
7851 return result; | |
7852 } |