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