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