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