Mercurial > mm7
annotate mm7_1.cpp @ 923:055ac998c606
Ticket #65
author | Nomad |
---|---|
date | Wed, 01 May 2013 12:04:02 +0200 |
parents | 8cd0b155bebe |
children | a78f08dbeb88 |
rev | line source |
---|---|
0 | 1 /* This file has been generated by the Hex-Rays decompiler. |
2 Copyright (c) 2007-2011 Hex-Rays <info@hex-rays.com> | |
3 | |
4 Detected compiler: Visual C++ | |
5 */ | |
6 | |
7 //#include <defs.h> | |
373 | 8 #include <assert.h> |
9 | |
0 | 10 #include "MM7.h" |
11 #include "MapInfo.h" | |
12 #include "Game.h" | |
13 #include "GUIWindow.h" | |
14 #include "GUIFont.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" | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
30 #include "SpriteObject.h" |
0 | 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 "Awards.h" | |
40 #include "Autonotes.h" | |
41 #include "stru160.h" | |
42 #include "stru279.h" | |
43 #include "TurnEngine.h" | |
44 #include "stru277.h" | |
45 #include "Weather.h" | |
46 #include "stru272.h" | |
47 #include "stru298.h" | |
48 #include "StorylineTextTable.h" | |
49 #include "Events2D.h" | |
189 | 50 #include "texts.h" |
351 | 51 #include "stru351.h" |
747 | 52 #include "UIHouses.h" |
0 | 53 #include "mm7_data.h" |
54 | |
55 int __stdcall aWinProc(HWND hWnd, UINT Msg, WPARAM wParam, unsigned int lParam); | |
56 int __stdcall InsertMM7CDDialogFunc(HWND hDlg, int a2, __int16 a3, int a4); | |
57 bool __fastcall FindMM7CD(HWND hWnd, char *pCDDrive); | |
58 bool __fastcall Initialize(HINSTANCE hInst, char *pCmdLine); | |
59 | |
791 | 60 |
61 //----- (004A1780) mm6_chinese--------------------------------------------- | |
62 int fixpoint_div(int a1, int a2) | |
63 { | |
64 return ((__int64)a1 << 16) / a2; | |
65 } | |
66 | |
871 | 67 int fixpoint_mul(int a1, int a2) |
68 { | |
69 return (((__int64)a1 << 16) * a2) >> 16; | |
70 } | |
71 | |
762 | 72 //----- (004453C0) mm6----------------------------------------------------- |
73 //----- (004A1760) mm6_chinese--------------------------------------------- | |
871 | 74 int fixpoint_sub0(int a1, int a2) |
762 | 75 { |
871 | 76 return ((__int64)a1 * (__int64)a2) >> 16; |
762 | 77 } |
78 | |
0 | 79 //----- (004196A0) -------------------------------------------------------- |
80 void __cdecl sub_4196A0() | |
81 { | |
82 GUIButton *i; // esi@2 | |
83 GUIButton *j; // esi@7 | |
84 | |
85 if ( dword_507CC0 ) | |
86 { | |
87 dword_507CC0 = 0; | |
705 | 88 for ( i = pGUIWindow_CurrentMenu->pControlsHead; i; i = j ) |
0 | 89 { |
705 | 90 j=i->pNext; |
91 if ( BYTE1(i->field_1C) & 0x80 ) | |
92 { | |
697 | 93 i->Release(); |
705 | 94 pAllocator->FreeChunk(i); |
95 } | |
0 | 96 } |
97 for ( j = pGUIWindow_CurrentMenu->pControlsHead; j; j = j->pNext ) | |
98 { | |
832 | 99 if ( j->msg == UIMSG_InventoryLeftClick) |
0 | 100 { |
101 j->uX = dword_50698C; | |
102 j->uY = dword_506988; | |
103 j->uZ = dword_506984; | |
104 j->uW = dword_506980; | |
105 pGUIWindow_CurrentMenu->_41D08F(1, 0, 0, 0); | |
106 } | |
107 } | |
108 } | |
109 } | |
110 | |
111 //----- (0041CD4F) -------------------------------------------------------- | |
112 bool __thiscall sub_41CD4F(unsigned int _this) | |
113 { | |
114 unsigned int v1; // edi@1 | |
115 unsigned int v2; // eax@2 | |
116 int v3; // esi@3 | |
117 int v4; // ecx@10 | |
118 GUIButton *v5; // eax@11 | |
119 int v6; // edx@12 | |
120 int v7; // ecx@20 | |
121 char v8; // zf@21 | |
122 GUIButton *v9; // ecx@24 | |
123 int v10; // esi@24 | |
832 | 124 //int v11; // edx@26 |
0 | 125 int v12; // edx@28 |
126 int v13; // esi@32 | |
127 GUIButton *v14; // eax@37 | |
128 int v15; // edx@38 | |
129 int v17; // ecx@50 | |
130 int v18; // edx@50 | |
131 GUIButton *v19; // ecx@54 | |
132 int v20; // esi@54 | |
832 | 133 //int v21; // edx@56 |
0 | 134 int v22; // ecx@59 |
135 int v23; // edx@59 | |
136 int v24; // ecx@60 | |
137 int v25; // esi@63 | |
138 unsigned int v26; // [sp+Ch] [bp-14h]@1 | |
139 int v27; // [sp+10h] [bp-10h]@1 | |
140 int v28; // [sp+14h] [bp-Ch]@10 | |
141 int v29; // [sp+14h] [bp-Ch]@36 | |
142 unsigned int uClickX; // [sp+18h] [bp-8h]@10 | |
143 unsigned int uClickY; // [sp+1Ch] [bp-4h]@10 | |
144 | |
145 v1 = 0; | |
146 v26 = _this; | |
147 v27 = uNumVisibleWindows; | |
148 if ( uNumVisibleWindows < 0 ) | |
149 return 0; | |
150 v2 = pMessageQueue_50CBD0->uNumMessages; | |
151 while ( 1 ) | |
152 { | |
153 v3 = pVisibleWindowsIdxs[v27] - 1; | |
585 | 154 if ( pWindowList[v3].field_44 != v1 ) |
155 { | |
586 | 156 switch(v26) |
585 | 157 { |
586 | 158 case VK_LEFT: |
159 { | |
160 v12 = pWindowList[v3].field_34; | |
161 if ( pWindowList[v3].pCurrentPosActiveItem - pWindowList[v3].pStartingPosActiveItem - v12 >= 0 ) | |
162 { | |
163 v8 = pCurrentScreen == SCREEN_PARTY_CREATION; | |
164 pWindowList[v3].pCurrentPosActiveItem -= v12; | |
165 if ( v8 ) | |
166 { | |
167 pAudioPlayer->PlaySound(SOUND_Button, v1, v1, -1, v1, v1, v1, v1); | |
168 v2 = pMessageQueue_50CBD0->uNumMessages; | |
169 } | |
170 } | |
171 if ( pWindowList[v3].field_30 != v1 ) | |
585 | 172 { |
586 | 173 break; |
174 } | |
175 v9 = pWindowList[v3].pControlsHead; | |
176 v13 = pWindowList[v3].pCurrentPosActiveItem; | |
177 if ( v13 > (signed int)v1 ) | |
178 { | |
179 do | |
180 { | |
181 v9 = v9->pNext; | |
182 --v13; | |
183 } | |
184 while ( v13 ); | |
185 } | |
832 | 186 |
187 pMessageQueue_50CBD0->AddMessage(v9->msg, v9->msg_param, v1); | |
586 | 188 break; |
585 | 189 } |
586 | 190 case VK_RIGHT: |
191 { | |
192 v7 = pWindowList[v3].pCurrentPosActiveItem + pWindowList[v3].field_34; | |
193 if ( v7 < pWindowList[v3].pNumPresenceButton + pWindowList[v3].pStartingPosActiveItem ) | |
585 | 194 { |
586 | 195 v8 = pCurrentScreen == SCREEN_PARTY_CREATION; |
196 pWindowList[v3].pCurrentPosActiveItem = v7; | |
197 if ( v8 ) | |
198 { | |
199 pAudioPlayer->PlaySound(SOUND_Button, v1, v1, -1, v1, v1, v1, v1); | |
200 v2 = pMessageQueue_50CBD0->uNumMessages; | |
201 } | |
202 } | |
203 if ( pWindowList[v3].field_30 != v1 ) | |
204 { | |
205 break; | |
585 | 206 } |
586 | 207 v9 = pWindowList[v3].pControlsHead; |
208 v10 = pWindowList[v3].pCurrentPosActiveItem; | |
209 if ( v10 > (signed int)v1 ) | |
585 | 210 { |
586 | 211 do |
212 { | |
213 v9 = v9->pNext; | |
214 --v10; | |
215 } | |
216 while ( v10 ); | |
217 } | |
832 | 218 pMessageQueue_50CBD0->AddMessage(v9->msg, v9->msg_param, v1); |
586 | 219 break; |
585 | 220 } |
586 | 221 case VK_DOWN: |
585 | 222 { |
586 | 223 v17 = pWindowList[v3].pStartingPosActiveItem; |
224 v18 = pWindowList[v3].pCurrentPosActiveItem; | |
225 if ( v18 >= pWindowList[v3].pNumPresenceButton + v17 - 1 ) | |
226 pWindowList[v3].pCurrentPosActiveItem = v17; | |
227 else | |
228 pWindowList[v3].pCurrentPosActiveItem = v18 + 1; | |
229 if ( pWindowList[v3].field_30 != v1 ) | |
230 return 1; | |
231 v19 = pWindowList[v3].pControlsHead; | |
232 v20 = pWindowList[v3].pCurrentPosActiveItem; | |
233 if ( v20 > (signed int)v1 ) | |
234 { | |
585 | 235 do |
236 { | |
586 | 237 v19 = v19->pNext; |
238 --v20; | |
585 | 239 } |
586 | 240 while ( v20 ); |
585 | 241 } |
832 | 242 pMessageQueue_50CBD0->AddMessage(v19->msg, v19->msg_param, v1); |
585 | 243 return 1; |
586 | 244 } |
245 case VK_SELECT: | |
246 { | |
247 pMouse->GetClickPos(&uClickX, &uClickY); | |
248 v4 = pWindowList[v3].pStartingPosActiveItem; | |
249 v28 = v4 + pWindowList[v3].pNumPresenceButton; | |
250 if ( v4 < v4 + pWindowList[v3].pNumPresenceButton ) | |
251 { | |
252 while ( 1 ) | |
253 { | |
254 v5 = pWindowList[v3].pControlsHead; | |
255 if ( v4 > 0 ) | |
256 { | |
257 v6 = v4; | |
258 do | |
259 { | |
260 v5 = v5->pNext; | |
261 --v6; | |
262 } | |
263 while ( v6 ); | |
264 } | |
265 if ( (signed int)uClickX >= (signed int)v5->uX | |
266 && (signed int)uClickX <= (signed int)v5->uZ | |
267 && (signed int)uClickY >= (signed int)v5->uY | |
268 && (signed int)uClickY <= (signed int)v5->uW ) | |
269 break; | |
270 ++v4; | |
271 if ( v4 >= v28 ) | |
272 { | |
273 v1 = 0; | |
274 v2 = pMessageQueue_50CBD0->uNumMessages; | |
275 --v27; | |
276 if ( v27 < 0 ) | |
277 return 0; | |
278 continue; | |
279 } | |
280 } | |
281 pWindowList[v3].pCurrentPosActiveItem = v4; | |
282 return 1; | |
283 } | |
284 v2 = pMessageQueue_50CBD0->uNumMessages; | |
285 break; | |
286 } | |
287 case VK_UP: | |
288 { | |
289 v22 = pWindowList[v3].pCurrentPosActiveItem; | |
290 v23 = pWindowList[v3].pStartingPosActiveItem; | |
291 if ( v22 <= v23 ) | |
292 v24 = pWindowList[v3].pNumPresenceButton + v23 - 1; | |
293 else | |
294 v24 = v22 - 1; | |
295 v8 = pWindowList[v3].field_30 == v1; | |
296 pWindowList[v3].pCurrentPosActiveItem = v24; | |
297 if ( !v8 ) | |
298 return 1; | |
299 v19 = pWindowList[v3].pControlsHead; | |
300 v25 = pWindowList[v3].pCurrentPosActiveItem; | |
301 if ( v25 > (signed int)v1 ) | |
585 | 302 { |
586 | 303 do |
304 { | |
305 v19 = v19->pNext; | |
306 --v25; | |
307 } | |
308 while ( v25 ); | |
585 | 309 } |
832 | 310 |
311 pMessageQueue_50CBD0->AddMessage(v19->msg, v19->msg_param, v1); | |
585 | 312 return 1; |
586 | 313 } |
314 case VK_NEXT: | |
315 { | |
316 if ( pWindowList[v3].field_30 != v1 ) | |
317 { | |
318 pMouse->GetClickPos(&uClickX, &uClickY); | |
319 v4 = pWindowList[v3].pStartingPosActiveItem; | |
320 v29 = v4 + pWindowList[v3].pNumPresenceButton; | |
321 if ( v4 < v4 + pWindowList[v3].pNumPresenceButton ) | |
322 { | |
323 while ( 1 ) | |
324 { | |
325 v14 = pWindowList[v3].pControlsHead; | |
326 if ( v4 > 0 ) | |
327 { | |
328 v15 = v4; | |
329 do | |
330 { | |
331 v14 = v14->pNext; | |
332 --v15; | |
333 } | |
334 while ( v15 ); | |
335 } | |
336 if ( (signed int)uClickX >= (signed int)v14->uX | |
337 && (signed int)uClickX <= (signed int)v14->uZ | |
338 && (signed int)uClickY >= (signed int)v14->uY | |
339 && (signed int)uClickY <= (signed int)v14->uW ) | |
340 { | |
341 pWindowList[v3].pCurrentPosActiveItem = v4; | |
342 return 1; | |
343 } | |
344 ++v4; | |
345 if ( v4 >= v29 ) | |
346 { | |
347 v1 = 0; | |
348 v2 = pMessageQueue_50CBD0->uNumMessages; | |
349 break; | |
350 } | |
351 } | |
352 } | |
353 else | |
354 { | |
355 v2 = pMessageQueue_50CBD0->uNumMessages; | |
356 } | |
357 } | |
585 | 358 break; |
586 | 359 } |
360 default: | |
361 { | |
362 break; | |
363 } | |
364 | |
585 | 365 } |
366 } | |
0 | 367 --v27; |
368 if ( v27 < 0 ) | |
369 return 0; | |
370 } | |
585 | 371 |
0 | 372 } |
373 | |
374 //----- (0041D20D) -------------------------------------------------------- | |
375 char __fastcall sub_41D20D_buff_remaining_time_string(int ecx0, GUIWindow *edx0, __int64 a3, GUIFont *a2) | |
376 { | |
377 unsigned int v4; // edi@1 | |
378 unsigned int v5; // esi@1 | |
379 unsigned int v6; // ebp@1 | |
380 unsigned int v7; // ebx@1 | |
381 signed __int64 v8; // ST34_8@1 | |
382 signed __int64 v9; // kr00_8@1 | |
383 char *v10; // eax@2 | |
384 char *v11; // eax@7 | |
385 char *v12; // eax@13 | |
386 char *v13; // eax@19 | |
387 int uY; // [sp+0h] [bp-20h]@1 | |
388 GUIWindow *a1; // [sp+4h] [bp-1Ch]@1 | |
389 signed __int64 v17; // [sp+10h] [bp-10h]@1 | |
390 signed __int64 v18; // [sp+18h] [bp-8h]@1 | |
391 unsigned int v19; // [sp+24h] [bp+4h]@1 | |
392 | |
393 a1 = edx0; | |
394 uY = ecx0; | |
395 v4 = (unsigned __int64)(signed __int64)((double)a3 * 0.234375) >> 32; | |
396 v5 = (signed __int64)((double)a3 * 0.234375); | |
397 v6 = (unsigned __int64)((signed __int64)((double)a3 * 0.234375) / 60) >> 32; | |
398 v7 = (signed __int64)((double)a3 * 0.234375) / 60; | |
399 v8 = (signed __int64)((double)a3 * 0.234375) / 60 / 60; | |
400 v19 = (unsigned int)v8 / 0x18; | |
401 v18 = (signed __int64)__PAIR__(v4, v5) % 60; | |
402 v17 = (signed __int64)__PAIR__(v6, v7) % 60; | |
403 v9 = v8 % 24; | |
404 strcpy(pTmpBuf, "\r020"); | |
405 if ( (unsigned int)v8 / 0x18 ) | |
406 { | |
407 v10 = pGlobalTXT_LocalizationStrings[57]; // Days | |
408 if ( v19 <= 1 ) | |
409 v10 = pGlobalTXT_LocalizationStrings[56]; // Day | |
410 sprintf(pTmpBuf2, "%d %s ", v19, v10); | |
411 strcat(pTmpBuf, pTmpBuf2); | |
412 } | |
413 if ( v9 ) | |
414 { | |
415 if ( v9 <= 1 ) | |
416 v11 = pGlobalTXT_LocalizationStrings[109];// Hour | |
417 else | |
418 v11 = pGlobalTXT_LocalizationStrings[110];// Hours | |
419 sprintf(pTmpBuf2, "%d %s ", v9, v11); | |
420 strcat(pTmpBuf, pTmpBuf2); | |
421 } | |
422 if ( v17 && !v19 ) | |
423 { | |
424 if ( v17 <= 1 ) | |
425 v12 = pGlobalTXT_LocalizationStrings[437];// Minute | |
426 else | |
427 v12 = pGlobalTXT_LocalizationStrings[436];// Minutes | |
428 sprintf(pTmpBuf2, "%d %s ", v17, v12); | |
429 strcat(pTmpBuf, pTmpBuf2); | |
430 } | |
431 if ( v18 && !v9 ) | |
432 { | |
433 if ( v18 <= 1 ) | |
434 v13 = pGlobalTXT_LocalizationStrings[439];// Second | |
435 else | |
436 v13 = pGlobalTXT_LocalizationStrings[438];// Seconds | |
437 sprintf(pTmpBuf2, "%d %s ", v18, v13); | |
438 strcat(pTmpBuf, pTmpBuf2); | |
439 } | |
440 return a1->DrawText(a2, 32, uY, 0, pTmpBuf, 0, 0, 0); | |
441 } | |
442 | |
443 //----- (0041F54A) -------------------------------------------------------- | |
444 void __cdecl LoadActualSkyFrame() | |
445 { | |
446 if ( pTexture_RestUI_CurrentSkyFrame ) | |
447 pTexture_RestUI_CurrentSkyFrame->Release(); | |
448 if ( pTexture_RestUI_CurrentHourglassFrame ) | |
449 pTexture_RestUI_CurrentHourglassFrame->Release(); | |
450 pIcons_LOD->_40F9C5(); | |
451 sprintf(pTmpBuf, "TERRA%03d", pParty->uCurrentMinute / 6 + 10 * pParty->uCurrentHour); | |
452 pTexture_RestUI_CurrentSkyFrame = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pTmpBuf, TEXTURE_16BIT_PALETTE)]; | |
453 } | |
454 | |
455 //----- (0041F5BE) -------------------------------------------------------- | |
456 void __cdecl Sleep6Hours() | |
457 { | |
458 if ( _506F18_num_hours_to_sleep < 6 ) | |
459 { | |
460 pParty->pPlayers[3].pConditions[2] = 0i64; | |
461 pParty->pPlayers[2].pConditions[2] = 0i64; | |
462 pParty->pPlayers[1].pConditions[2] = 0i64; | |
463 pParty->pPlayers[0].pConditions[2] = 0i64; | |
464 if ( _506F18_num_hours_to_sleep ) | |
465 { | |
466 Rest(_506F18_num_hours_to_sleep); | |
467 _506F18_num_hours_to_sleep = 0; | |
468 LoadActualSkyFrame(); | |
469 } | |
470 if ( dword_506F14 == 2 ) | |
471 { | |
472 pGUIWindow_CurrentMenu->Release(); | |
473 pEventTimer->Resume(); | |
474 if ( pTexture_RestUI_CurrentSkyFrame ) | |
475 pTexture_RestUI_CurrentSkyFrame->Release(); | |
476 if ( pTexture_RestUI_CurrentHourglassFrame ) | |
477 pTexture_RestUI_CurrentHourglassFrame->Release(); | |
478 pTexture_RestUI_CurrentHourglassFrame = 0; | |
479 pTexture_RestUI_CurrentSkyFrame = 0; | |
480 pIcons_LOD->_4114F2(); | |
481 pIcons_LOD->_40F9C5(); | |
151 | 482 pCurrentScreen = SCREEN_GAME; |
0 | 483 viewparams->bRedrawGameUI = 1; |
484 if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) | |
485 { | |
486 pOutdoor->UpdateSunlightVectors(); | |
487 pOutdoor->UpdateFog(); | |
488 } | |
489 } | |
490 dword_506F14 = 0; | |
491 } | |
492 else | |
493 { | |
494 Rest(6u); | |
495 _506F18_num_hours_to_sleep -= 6; | |
496 LoadActualSkyFrame(); | |
497 } | |
498 viewparams->bRedrawGameUI = 1; | |
499 } | |
500 | |
501 //----- (0042038D) -------------------------------------------------------- | |
502 void __cdecl sub_42038D() | |
503 { | |
504 POINT *v0; // esi@2 | |
505 int v1; // ecx@2 | |
506 const char *v2; // eax@3 | |
507 POINT v3; // [sp+0h] [bp-10h]@2 | |
508 POINT a2; // [sp+8h] [bp-8h]@1 | |
509 | |
510 if ( pMouse->GetCursorPos(&a2)->y < 350 ) | |
511 { | |
512 v0 = pMouse->GetCursorPos(&a2); | |
513 v1 = pRenderer->pActiveZBuffer[v0->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v3)->y]]; | |
514 if ( v1 ) | |
515 { | |
516 auto _w = (ItemGen *)(&pOtherOverlayList->pOverlays[49].field_4 + 2662 * (unsigned int)pChestWindow->ptr_1C | |
526 | 517 + 18 * *((short *)&pChests[0].igChestItems[139].uExpireTime |
0 | 518 + v1 + 2662 * (unsigned int)pChestWindow->ptr_1C + 3)); |
702 | 519 |
520 _w = (ItemGen *)(&pChests[(unsigned int)pChestWindow->ptr_1C] -32 | |
521 + 18 * *((short *)&pChests[(unsigned int)pChestWindow->ptr_1C].igChestItems[139].uExpireTime + v1 + 3)); | |
0 | 522 v2 = _w->GetDisplayName(); |
523 sub_41C0B8_set_status_string(v2); | |
524 } | |
525 } | |
526 } | |
527 | |
528 //----- (00420C05) -------------------------------------------------------- | |
529 void __fastcall party_finds_gold(unsigned int uNumGold, int _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal) | |
530 { | |
531 unsigned int v2; // edi@1 | |
532 int v3; // ebp@1 | |
533 unsigned int v4; // esi@1 | |
534 int v5; // ecx@6 | |
535 NPCData *v6; // eax@6 | |
536 signed int v7; // edx@8 | |
537 signed int v8; // ebx@10 | |
538 char *v9; // edi@11 | |
539 signed int v10; // ecx@17 | |
540 int v11; // eax@21 | |
541 NPCData *v12; // ecx@21 | |
542 unsigned int v13; // ecx@23 | |
543 signed int v14; // [sp+Ch] [bp-4h]@6 | |
544 | |
545 v2 = 0; | |
546 v3 = 0; | |
547 v4 = uNumGold; | |
548 if ( _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal ) | |
549 { | |
550 if ( _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal == 1 ) | |
551 { | |
552 sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[467], uNumGold);// You found %lu gold! | |
553 } | |
554 else | |
555 { | |
556 if ( _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal == 2 ) | |
557 pTmpBuf2[0] = 0; | |
558 } | |
559 } | |
560 else | |
561 { | |
562 v14 = 0; | |
563 v5 = 0; | |
564 v6 = pParty->pHirelings; | |
565 do | |
566 { | |
567 if ( v6->pName ) | |
568 { | |
569 v7 = v14++; | |
570 pTmpBuf[v7] = v5; | |
571 } | |
572 ++v6; | |
573 ++v5; | |
574 } | |
575 while ( (signed int)v6 < (signed int)&pParty->pPickedItem ); | |
576 v8 = 0; | |
577 if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) | |
578 { | |
579 v9 = (char *)pNPCStats->pNewNPCData; | |
580 do | |
581 { | |
582 if ( v9[8] & 0x80 | |
583 && (!pParty->pHirelings[0].pName || strcmp(*(const char **)v9, pParty->pHirelings[0].pName)) | |
584 && (!pParty->pHirelings[1].pName || strcmp(*(const char **)v9, pParty->pHirelings[1].pName)) ) | |
585 { | |
586 v10 = v14++; | |
587 pTmpBuf[v10] = v8 + 2; | |
588 } | |
589 ++v8; | |
590 v9 += 76; | |
591 } | |
592 while ( v8 < (signed int)pNPCStats->uNumNewNPCs ); | |
593 v2 = 0; | |
594 } | |
595 if ( v14 > 0 ) | |
596 { | |
597 do | |
598 { | |
599 v11 = (unsigned __int8)pTmpBuf[v2]; | |
600 v12 = &pNPCStats->pNPCData[v11 + 499]; | |
33 | 601 if ( (unsigned __int8)pTmpBuf[v2] < 2 ) |
0 | 602 v12 = &pParty->pHirelings[v11]; |
603 v13 = v12->uProfession; | |
604 if ( v13 ) | |
291 | 605 v3 += pNPCStats->pProfessions[v13].uHirePrice;//*(&pNPCStats->field_13A58 + 5 * v13); |
0 | 606 ++v2; |
607 } | |
608 while ( (signed int)v2 < v14 ); | |
609 } | |
652 | 610 if ( CheckHiredNPCSpeciality(Factor) ) |
0 | 611 v4 += (signed int)(10 * v4) / 100; |
652 | 612 if ( CheckHiredNPCSpeciality(Banker) ) |
0 | 613 v4 += (signed int)(20 * v4) / 100; |
652 | 614 if ( CheckHiredNPCSpeciality(Pirate) ) |
0 | 615 v4 += (signed int)(10 * v4) / 100; |
616 if ( v3 ) | |
617 { | |
618 v3 = (signed int)(v4 * v3 / 100) / 100; | |
619 if ( v3 < 1 ) | |
620 v3 = 1; | |
621 sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[466], v4, v3);// You found %lu gold (followers take %lu)! | |
622 } | |
623 else | |
624 { | |
625 sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[467], v4);// You found %lu gold! | |
626 } | |
627 v2 = 0; | |
628 } | |
629 pParty->uNumGold += v4 - v3; | |
630 pUIAnim_Gold->uAnimTime = v2; | |
631 pUIAnim_Gold->uAnimLength = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Gold->uIconID].uAnimLength; | |
632 if ( pTmpBuf2[0] ) | |
633 ShowStatusBarString(pTmpBuf2, 2u); | |
634 pAudioPlayer->PlaySound(SOUND_GoldReceived, v2, v2, -1, v2, v2, v2, v2); | |
635 } | |
636 | |
637 //----- (00420E01) -------------------------------------------------------- | |
638 void __cdecl sub_420E01() | |
639 { | |
526 | 640 int chest_id; // edi@1 |
0 | 641 POINT *v1; // esi@2 |
642 int v2; // eax@2 | |
643 int v3; // ebx@4 | |
644 int v4; // esi@6 | |
645 int v5; // ecx@6 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
646 //SpriteObject v6; // [sp+Ch] [bp-80h]@1 |
526 | 647 POINT v7; // [sp+7Ch] [bp-10h]@2 |
0 | 648 POINT a2; // [sp+84h] [bp-8h]@2 |
649 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
650 SpriteObject v6; // [sp+Ch] [bp-80h]@1 |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
651 //SpriteObject::SpriteObject(&v6); |
0 | 652 |
526 | 653 chest_id = pGUIWindow_CurrentMenu->par1C; |
0 | 654 if ( pParty->pPickedItem.uItemID ) |
655 { | |
526 | 656 if ( Chest::PutItemInChest(-1, &pParty->pPickedItem, pGUIWindow_CurrentMenu->par1C) ) |
0 | 657 pMouse->RemoveHoldingItem(); |
658 } | |
659 else | |
660 { | |
661 v1 = pMouse->GetCursorPos(&a2); | |
662 v2 = pRenderer->pActiveZBuffer[v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v7)->y]] & 0xFFFF; | |
663 if ( v2 ) | |
664 { | |
665 if ( v2 ) | |
666 v3 = v2 - 1; | |
667 else | |
668 v3 = -1; | |
526 | 669 v4 = pChests[chest_id].pInventoryIndices[v3] - 1; |
600 | 670 if ( pItemsTable->pItems[pChests[chest_id].igChestItems[v4].uItemID].uEquipType == EQUIP_GOLD ) |
0 | 671 { |
600 | 672 party_finds_gold(pChests[chest_id].igChestItems[v4].uSpecEnchantmentType, 0); |
0 | 673 viewparams->bRedrawGameUI = 1; |
674 } | |
675 else | |
676 { | |
526 | 677 pParty->SetHoldingItem(&pChests[chest_id].igChestItems[v4]); |
0 | 678 } |
679 sub_420B13(v4, v3); | |
680 } | |
681 } | |
682 } | |
683 | |
684 //----- (004219BE) -------------------------------------------------------- | |
685 GUIWindow *stru277::sub_4219BE() | |
686 { | |
687 int v1; // esi@1 | |
688 GUIWindow *v2; // ebx@1 | |
689 | |
690 auto a4 = this; | |
691 v1 = (int)a4; | |
692 pEventTimer->Pause(); | |
693 pAudioPlayer->StopChannels(-1, -1); | |
694 bRingsShownInCharScreen = 0; | |
695 CharacterUI_LoadPaperdollTextures(); | |
151 | 696 pCurrentScreen = SCREEN_CASTING; |
898 | 697 v2 = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell_InInventory, v1, 0); |
698 pCharacterScreen_ExitBtn = v2->CreateButton(394, 318, 75, 33, 1, 0, UIMSG_A8, 0, 0, | |
710 | 699 pGlobalTXT_LocalizationStrings[79], // Close |
0 | 700 (Texture *)(papredoll_dbrds[2] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[2]] : 0), |
701 papredoll_dbrds[1] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[1]] : 0, | |
702 0); | |
832 | 703 v2->CreateButton(0, 0, 0x1DCu, 0x159u, 1, 122, UIMSG_InventoryLeftClick, 0, 0, "", 0); |
910 | 704 pCharacterScreen_DollBtn = v2->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, 1, 0, UIMSG_ClickPaperdoll, 0, 0, "", 0); |
832 | 705 v2->CreateButton(61u, 424u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 1u, 0x31u, "", 0); |
706 v2->CreateButton(177u, 424u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 2u, 0x32u, "", 0); | |
707 v2->CreateButton(292u, 424u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 3u, 0x33u, "", 0); | |
708 v2->CreateButton(407u, 424u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 4u, 0x34u, "", 0); | |
0 | 709 return v2; |
710 } | |
711 | |
712 //----- (00421B2C) -------------------------------------------------------- | |
713 bool __cdecl sub_421B2C_PlaceInInventory_or_DropPickedItem() | |
714 { | |
715 unsigned int v0; // eax@2 | |
716 Texture *v1; // ebx@2 | |
717 int v2; // eax@3 | |
718 Player *v3; // esi@5 | |
719 int v4; // eax@6 | |
720 unsigned __int16 v5; // dx@11 | |
721 signed int v6; // eax@11 | |
722 char *v7; // edi@12 | |
723 __int16 v8; // ax@16 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
724 SpriteObject a1; // [sp+4h] [bp-78h]@11 |
0 | 725 int v11; // [sp+74h] [bp-8h]@2 |
726 int v12; // [sp+78h] [bp-4h]@5 | |
727 | |
728 if ( !pParty->pPickedItem.uItemID ) | |
729 return 1; | |
730 v0 = pIcons_LOD->LoadTexture( | |
731 pItemsTable->pItems[pParty->pPickedItem.uItemID].pIconName, | |
732 TEXTURE_16BIT_PALETTE); | |
733 v1 = (Texture *)(v0 != -1 ? (int)&pIcons_LOD->pTextures[v0] : 0); | |
734 v11 = areWeLoadingTexture; | |
735 if ( uActiveCharacter | |
736 && (v2 = pPlayers[uActiveCharacter]->AddItem(0xFFFFFFFFu, pParty->pPickedItem.uItemID)) != 0 ) | |
737 { | |
232 | 738 memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v2-1], &pParty->pPickedItem, 0x24u); |
244 | 739 pMouse->RemoveHoldingItem(); |
0 | 740 } |
741 else | |
742 { | |
743 v12 = 0; | |
744 v3 = pParty->pPlayers; | |
244 | 745 while ( v3 <= &pParty->pPlayers[3] ) |
0 | 746 { |
747 v4 = v3->AddItem(0xFFFFFFFFu, pParty->pPickedItem.uItemID); | |
748 if ( v4 ) | |
244 | 749 { |
750 memcpy(&pParty->pPlayers[v12].pInventoryItems[v4], &pParty->pPickedItem, 0x24u); | |
751 pMouse->RemoveHoldingItem(); | |
752 break; | |
753 } | |
754 ++v12; | |
0 | 755 ++v3; |
244 | 756 } |
757 if ( v12 == 4 ) | |
758 { | |
759 v5 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSpriteID; | |
760 v6 = 0; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
761 a1.uType = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSpriteID; |
244 | 762 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
763 { | |
764 LOWORD(v6) = 0; | |
765 } | |
766 else | |
767 { | |
768 v7 = (char *)&pObjectList->pObjects->uObjectID; | |
769 while ( v5 != *(short *)v7 ) | |
770 { | |
771 ++v6; | |
772 v7 += 56; | |
773 if ( v6 >= (signed int)pObjectList->uNumObjects ) | |
774 { | |
775 LOWORD(v6) = 0; | |
776 break; | |
777 } | |
778 } | |
779 } | |
822 | 780 a1.spell_caster_pid = OBJECT_Player; |
244 | 781 a1.uObjectDescID = v6; |
782 a1.vPosition.y = pParty->vPosition.y; | |
783 a1.vPosition.x = pParty->vPosition.x; | |
784 a1.vPosition.z = pParty->sEyelevel + pParty->vPosition.z; | |
785 a1.uSoundID = 0; | |
786 a1.uFacing = 0; | |
787 a1.uAttributes = 8; | |
788 v8 = pIndoor->GetSector( | |
789 pParty->vPosition.x, | |
790 pParty->vPosition.y, | |
791 pParty->sEyelevel + pParty->vPosition.z); | |
792 a1.uSpriteFrameID = 0; | |
793 a1.uSectorID = v8; | |
794 memcpy(&a1.stru_24, &pParty->pPickedItem, sizeof(a1.stru_24)); | |
795 a1.Create(pParty->sRotationY, 184, 200, 0); | |
796 pMouse->RemoveHoldingItem(); | |
797 } | |
798 } | |
0 | 799 if ( !v11 ) |
800 { | |
801 v1->Release(); | |
802 pIcons_LOD->_40F9C5(); | |
803 } | |
804 return 1; | |
805 } | |
806 | |
807 //----- (00421D00) -------------------------------------------------------- | |
808 void __fastcall GameUI_OnPlayerPortraitLeftClick(unsigned int uPlayerID) | |
809 { | |
201 | 810 //unsigned int v1; // esi@1 |
811 //int v2; // eax@2 | |
812 //Player *v3; // ecx@2 | |
813 //Player *v4; // ecx@5 | |
0 | 814 unsigned int v5; // [sp-4h] [bp-10h]@21 |
815 | |
201 | 816 //v1 = uPlayerID; |
817 auto player = &pParty->pPlayers[uPlayerID - 1]; | |
818 if (pParty->pPickedItem.uItemID) | |
819 { | |
820 //v3 = player; | |
821 if (auto slot = player->AddItem(0xFFFFFFFFu, pParty->pPickedItem.uItemID)) | |
822 { | |
232 | 823 memcpy(&player->pInventoryItems[slot-1], &pParty->pPickedItem, 0x24u); |
201 | 824 viewparams->bRedrawGameUI = true; |
0 | 825 pMouse->RemoveHoldingItem(); |
826 return; | |
827 } | |
201 | 828 |
829 if (!player->CanAct()) | |
830 { | |
831 player = pPlayers[uActiveCharacter]; | |
832 } | |
595 | 833 if(player->CanAct() || !pPlayers[uActiveCharacter]->CanAct()) |
588 | 834 player->PlaySound(SPEECH_NoRoom, 0); |
201 | 835 } |
836 | |
588 | 837 //LABEL_9: |
201 | 838 if (pCurrentScreen == SCREEN_GAME) |
839 { | |
840 viewparams->bRedrawGameUI = true; | |
841 if ( uActiveCharacter != uPlayerID ) | |
11 | 842 //goto LABEL_27; |
843 { | |
201 | 844 if ( pPlayers[uPlayerID]->uTimeToRecovery ) |
11 | 845 return; |
201 | 846 |
847 uActiveCharacter = uPlayerID; | |
11 | 848 return; |
849 } | |
0 | 850 v5 = 7; |
11 | 851 //LABEL_22: |
0 | 852 pGUIWindow_CurrentMenu = GameUI_InitializeCharacterWindow(v5); |
853 return; | |
854 } | |
151 | 855 if ( pCurrentScreen == SCREEN_SPELL_BOOK ) |
0 | 856 return; |
151 | 857 if ( pCurrentScreen == SCREEN_CHEST ) |
0 | 858 { |
11 | 859 //LABEL_23: |
201 | 860 viewparams->bRedrawGameUI = true; |
861 if ( uActiveCharacter == uPlayerID ) | |
0 | 862 { |
863 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; | |
151 | 864 pCurrentScreen = SCREEN_F; |
11 | 865 //goto LABEL_28; |
201 | 866 uActiveCharacter = uPlayerID; |
11 | 867 return; |
868 } | |
869 //LABEL_27: | |
201 | 870 if ( pPlayers[uPlayerID]->uTimeToRecovery ) |
0 | 871 return; |
11 | 872 //goto LABEL_28; |
201 | 873 uActiveCharacter = uPlayerID; |
11 | 874 return; |
0 | 875 } |
151 | 876 if ( pCurrentScreen != SCREEN_HOUSE ) |
877 { | |
878 if ( pCurrentScreen == SCREEN_E ) | |
0 | 879 { |
11 | 880 //LABEL_28: |
201 | 881 uActiveCharacter = uPlayerID; |
0 | 882 return; |
883 } | |
151 | 884 if ( pCurrentScreen != SCREEN_F ) |
0 | 885 { |
201 | 886 viewparams->bRedrawGameUI = true; |
887 uActiveCharacter = uPlayerID; | |
0 | 888 if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 102 ) |
521 | 889 FillAwardsData(); |
0 | 890 return; |
891 } | |
11 | 892 //goto LABEL_23; |
201 | 893 viewparams->bRedrawGameUI = true; |
894 if ( uActiveCharacter == uPlayerID ) | |
11 | 895 { |
896 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; | |
151 | 897 pCurrentScreen = SCREEN_F; |
11 | 898 //goto LABEL_28; |
201 | 899 uActiveCharacter = uPlayerID; |
11 | 900 return; |
901 } | |
902 //LABEL_27: | |
201 | 903 if ( pPlayers[uPlayerID]->uTimeToRecovery ) |
11 | 904 return; |
905 //goto LABEL_28; | |
201 | 906 uActiveCharacter = uPlayerID; |
11 | 907 return; |
0 | 908 } |
336 | 909 if ( window_SpeakInHouse->field_40 == 1 ) |
0 | 910 return; |
201 | 911 viewparams->bRedrawGameUI = true; |
912 if ( uActiveCharacter != uPlayerID ) | |
11 | 913 //goto LABEL_28; |
201 | 914 uActiveCharacter = uPlayerID; |
11 | 915 return; |
749 | 916 if (dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD || dialog_menu_id == HOUSE_DIALOGUE_SHOP_6) |
0 | 917 { |
747 | 918 __debugbreak(); // fix indexing |
0 | 919 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; |
920 v5 = 14; | |
11 | 921 //goto LABEL_22; |
922 pGUIWindow_CurrentMenu = GameUI_InitializeCharacterWindow(v5); | |
923 return; | |
0 | 924 } |
925 } | |
926 // 4E28F8: using guessed type int pCurrentScreen; | |
927 // F8B19C: using guessed type int dword_F8B19C; | |
928 | |
929 //----- (00421EA6) -------------------------------------------------------- | |
930 void __cdecl sub_421EA6_OnInventoryLeftClick() | |
931 { | |
932 Player *v0; // ebx@1 | |
933 signed int v1; // eax@2 | |
934 signed int v2; // ecx@2 | |
935 int v3; // eax@2 | |
936 char v4; // sf@2 | |
937 int v5; // eax@2 | |
938 unsigned int v6; // eax@7 | |
939 unsigned int v7; // esi@12 | |
940 unsigned int v8; // eax@12 | |
941 unsigned int v9; // eax@16 | |
942 unsigned int v10; // eax@18 | |
943 ItemGen this_; // [sp+Ch] [bp-3Ch]@1 | |
944 POINT a2; // [sp+30h] [bp-18h]@4 | |
945 unsigned int v13; // [sp+38h] [bp-10h]@13 | |
946 unsigned int pY; // [sp+3Ch] [bp-Ch]@2 | |
947 unsigned int pX; // [sp+40h] [bp-8h]@2 | |
948 int a4; // [sp+44h] [bp-4h]@2 | |
949 | |
950 v0 = pPlayers[uActiveCharacter]; | |
501 | 951 if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 103 ) |
0 | 952 { |
501 | 953 pMouse->GetClickPos(&pX, &pY); |
954 pY = pY - 17; | |
955 v2 =pX - 14; | |
956 pX = v2; | |
957 v3 = 14 * (pY >> 5); | |
958 v2 >>= 5; | |
959 v4 = v2 + v3 < 0; | |
960 v5 = v2 + v3; | |
961 a4 = v5; | |
962 if ( !v4 ) | |
0 | 963 { |
501 | 964 if ( v5 <= 126 && pMouse->GetCursorPos(&a2)->x < 462 |
965 && pMouse->GetCursorPos(&a2)->x >= 14 ) | |
0 | 966 { |
501 | 967 if ( unk_50C9A0 ) |
968 { | |
969 v6 = v0->GetItemIDAtInventoryIndex(&a4); | |
970 if ( v6 ) | |
971 { | |
972 *((char *)pGUIWindow_Settings->ptr_1C + 8) &= 0x7Fu; | |
973 *((short *)pGUIWindow_Settings->ptr_1C + 2) = uActiveCharacter - 1; | |
974 *((int *)pGUIWindow_Settings->ptr_1C + 3) = v6 - 1; | |
975 *((short *)pGUIWindow_Settings->ptr_1C + 3) = a4; | |
976 ptr_50C9A4 = (ItemGen *)&v0->pInventoryItems[v6-1]; | |
977 unk_50C9A0 = 0; | |
978 if ( pMessageQueue_50CBD0->uNumMessages ) | |
979 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | |
980 pMouse->SetCursorBitmap("MICON1"); | |
981 dword_50C9D0 = 113; | |
982 dword_50C9D4 = 0; | |
983 dword_50C9D8 = 256; | |
984 } | |
985 return; | |
986 } | |
987 if ( ptr_50C9A4 ) | |
988 return; | |
989 v7 = pParty->pPickedItem.uItemID; | |
990 v8 = v0->GetItemIDAtInventoryIndex(&a4); | |
991 if ( !v7 ) | |
992 { | |
993 if ( !v8 ) | |
994 return; | |
995 memcpy(&pParty->pPickedItem, &v0->pInventoryItems[v8-1], sizeof(pParty->pPickedItem)); | |
996 v0->RemoveItemAtInventoryIndex(a4); | |
997 v9 = pParty->pPickedItem.uItemID; | |
588 | 998 pMouse->SetCursorBitmap(pItemsTable->pItems[v9].pIconName); |
999 return; | |
501 | 1000 } |
1001 v13 = v8; | |
1002 if ( v8 ) | |
1003 { | |
1004 a2.y = (LONG)&v0->pInventoryItems[v8-1]; | |
1005 memcpy(&this_, (const void *)a2.y, sizeof(this_)); | |
1006 v0->RemoveItemAtInventoryIndex(a4); | |
1007 pX = v0->AddItem2(a4, &pParty->pPickedItem); | |
1008 if ( !pX ) | |
1009 { | |
1010 pX = v0->AddItem2(0xFFFFFFFFu, &pParty->pPickedItem); | |
1011 if ( !pX ) | |
1012 { | |
1013 v0->_49298B(&this_, v13 - 1, a4); | |
1014 memcpy((void *)a2.y, &this_, sizeof(ItemGen)); | |
1015 return; | |
1016 } | |
1017 } | |
1018 v9 = this_.uItemID; | |
1019 memcpy(&pParty->pPickedItem, &this_, sizeof(pParty->pPickedItem)); | |
1020 pMouse->SetCursorBitmap(pItemsTable->pItems[v9].pIconName); | |
1021 return; | |
1022 } | |
1023 v10 = v0->AddItem(a4, v7); | |
1024 pX = v10; | |
1025 if ( v10 || (v10 = v0->AddItem(0xFFFFFFFFu, pParty->pPickedItem.uItemID), (pX = v10) != 0) ) | |
1026 { | |
1027 memcpy(&v0->pInventoryItems[v10-1], &pParty->pPickedItem, 0x24u); | |
1028 pMouse->RemoveHoldingItem(); | |
1029 } | |
0 | 1030 } |
1031 } | |
1032 } | |
1033 } | |
1034 | |
1035 //----- (0042213C) -------------------------------------------------------- | |
1036 void __cdecl OnGameViewportClick() | |
1037 { | |
1038 signed int v0; // ebx@2 | |
1039 POINT *v1; // esi@3 | |
1040 signed int v2; // eax@9 | |
1041 BLVFace *v3; // eax@10 | |
1042 unsigned int v4; // eax@11 | |
1043 unsigned __int16 v5; // dx@14 | |
1044 signed int v6; // eax@14 | |
1045 char *v7; // esi@15 | |
1046 int *v8; // eax@19 | |
1047 int v9; // eax@19 | |
1048 unsigned int v10; // eax@19 | |
1049 int v11; // ecx@21 | |
1050 ODMFace *v12; // eax@22 | |
1051 LevelDecoration *v13; // esi@24 | |
1052 __int16 v14; // ax@25 | |
1053 int v15; // ecx@29 | |
1054 signed int v16; // edx@30 | |
1055 Actor *v17; // esi@30 | |
1056 int v18; // ebx@47 | |
1057 unsigned __int16 v19; // ax@50 | |
1058 const char *v20; // eax@51 | |
1059 signed int v21; // eax@58 | |
1060 ItemGen *v22; // esi@62 | |
1061 unsigned int v23; // eax@62 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
1062 SpriteObject a1; // [sp+Ch] [bp-80h]@1 |
0 | 1063 POINT v25; // [sp+7Ch] [bp-10h]@3 |
1064 POINT a2; // [sp+84h] [bp-8h]@3 | |
1065 | |
1066 if ( pRenderer->pRenderD3D ) | |
1067 { | |
1068 v0 = pGame->pVisInstance->get_picked_object_zbuf_val(); | |
1069 } | |
1070 else | |
1071 { | |
1072 v1 = pMouse->GetCursorPos(&a2); | |
1073 v0 = pRenderer->pActiveZBuffer[v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v25)->y]]; | |
1074 } | |
848 | 1075 if ( PID_TYPE(v0) == OBJECT_Item) |
0 | 1076 { |
1077 a2.y = (signed int)(unsigned __int16)v0 >> 3; | |
1078 v21 = (signed int)(unsigned __int16)v0 >> 3; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
1079 if ( !(pObjectList->pObjects[pSpriteObjects[v21].uObjectDescID].uFlags & 0x10) |
0 | 1080 && a2.y < 1000 |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
1081 && pSpriteObjects[v21].uObjectDescID |
0 | 1082 && (unsigned int)v0 < 0x2000000 ) |
1083 { | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
1084 v22 = &pSpriteObjects[v21].stru_24; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
1085 v23 = pSpriteObjects[v21].stru_24.uItemID; |
0 | 1086 if ( pItemsTable->pItems[v23].uEquipType == 18 ) |
1087 { | |
377 | 1088 party_finds_gold(v22->uSpecEnchantmentType, 0); |
0 | 1089 viewparams->bRedrawGameUI = 1; |
1090 } | |
1091 else | |
1092 { | |
721 | 1093 sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[v23].pUnidentifiedName); |
0 | 1094 ShowStatusBarString(pTmpBuf2, 2u); |
1095 if ( v22->uItemID == 506 ) | |
484 | 1096 _449B7E_toggle_bit(pParty->_quest_bits, 184, 1u); |
0 | 1097 if ( v22->uItemID == 455 ) |
484 | 1098 _449B7E_toggle_bit(pParty->_quest_bits, 185, 1u); |
0 | 1099 if ( !pParty->AddItem(v22) ) |
1100 pParty->SetHoldingItem(v22); | |
1101 } | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
1102 SpriteObject::OnInteraction(a2.y); |
0 | 1103 return; |
1104 } | |
588 | 1105 v4 = pParty->pPickedItem.uItemID; |
1106 if ( !pParty->pPickedItem.uItemID ) | |
1107 return; | |
1108 goto LABEL_14; | |
0 | 1109 } |
848 | 1110 if ( PID_TYPE(v0) != OBJECT_Actor) |
141 | 1111 { |
848 | 1112 if ( PID_TYPE(v0) == OBJECT_Decoration) |
0 | 1113 { |
1114 v13 = &pLevelDecorations[(signed int)(unsigned __int16)v0 >> 3]; | |
1115 if ( (signed int)(((unsigned int)v0 >> 16) - pDecorationList->pDecorations[v13->uDecorationDescID].uRadius) >= 512 ) | |
588 | 1116 { |
1117 v4 = pParty->pPickedItem.uItemID; | |
1118 if ( !pParty->pPickedItem.uItemID ) | |
1119 return; | |
1120 goto LABEL_14; | |
1121 } | |
0 | 1122 v14 = v13->field_16_event_id; |
1123 if ( !v14 ) | |
1124 { | |
1125 if ( pLevelDecorations[(signed int)(unsigned __int16)v0 >> 3].IsInteractive() ) | |
1126 { | |
1127 v15 = stru_5E4C90._decor_events[v13->_idx_in_stru123 - 75] + 380; | |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
515
diff
changeset
|
1128 activeLevelDecoration = &pLevelDecorations[(signed int)(unsigned __int16)v0 >> 3]; |
0 | 1129 EventProcessor(v15, 0, 1); |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
515
diff
changeset
|
1130 activeLevelDecoration = NULL; |
0 | 1131 } |
1132 return; | |
1133 } | |
1134 v11 = v14; | |
1135 } | |
1136 else | |
1137 { | |
848 | 1138 if ( PID_TYPE(v0) != OBJECT_BModel || (signed)v0 >= 0x2000000 ) |
588 | 1139 { |
1140 v4 = pParty->pPickedItem.uItemID; | |
1141 if ( !pParty->pPickedItem.uItemID ) | |
1142 return; | |
1143 goto LABEL_14; | |
1144 } | |
0 | 1145 v2 = (signed int)(unsigned __int16)v0 >> 3; |
1146 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
1147 { | |
1148 v3 = &pIndoor->pFaces[v2]; | |
1149 if ( !(v3->uAttributes & 0x2000000) ) | |
1150 { | |
1151 LABEL_11: | |
588 | 1152 v4 = pParty->pPickedItem.uItemID; |
1153 if ( !pParty->pPickedItem.uItemID ) | |
1154 { | |
1155 ShowNothingHereStatus(); | |
1156 v4 = pParty->pPickedItem.uItemID; | |
1157 if ( !pParty->pPickedItem.uItemID ) | |
1158 return; | |
1159 } | |
0 | 1160 LABEL_14: |
588 | 1161 v5 = pItemsTable->pItems[v4].uSpriteID; |
1162 v6 = 0; | |
1163 a1.uType = v5; | |
1164 if ( (signed int)pObjectList->uNumObjects <= 0 ) | |
1165 { | |
1166 LOWORD(v6) = 0; | |
1167 } | |
1168 else | |
1169 { | |
1170 v7 = (char *)&pObjectList->pObjects->uObjectID; | |
1171 while ( v5 != *(short *)v7 ) | |
1172 { | |
1173 ++v6; | |
1174 v7 += 56; | |
1175 if ( v6 >= (signed int)pObjectList->uNumObjects ) | |
1176 { | |
1177 LOWORD(v6) = 0; | |
1178 break; | |
1179 } | |
1180 } | |
1181 } | |
1182 a1.uObjectDescID = v6; | |
1183 a1.vPosition.y = pParty->vPosition.y; | |
822 | 1184 a1.spell_caster_pid = OBJECT_Player; |
588 | 1185 a1.vPosition.x = pParty->vPosition.x; |
1186 a1.vPosition.z = pParty->sEyelevel + pParty->vPosition.z; | |
1187 a1.uSoundID = 0; | |
1188 a1.uFacing = 0; | |
1189 a1.uAttributes = 8; | |
1190 a1.uSectorID = pIndoor->GetSector( | |
1191 pParty->vPosition.x, | |
1192 pParty->vPosition.y, | |
1193 pParty->sEyelevel + pParty->vPosition.z); | |
1194 a1.uSpriteFrameID = 0; | |
1195 memcpy(&a1.stru_24, &pParty->pPickedItem, 0x24u); | |
1196 v8 = (int *)pMouse->GetCursorPos(&v25); | |
1197 v9 = UnprojectX(*v8); | |
1198 a1.Create(pParty->sRotationY + v9, 184, 200, 0); | |
1199 v10 = pIcons_LOD->LoadTexture( | |
1200 pItemsTable->pItems[pParty->pPickedItem.uItemID].pIconName, | |
1201 TEXTURE_16BIT_PALETTE); | |
1202 if (v10 != -1) | |
1203 pIcons_LOD->pTextures[v10].Release(); | |
1204 pMouse->RemoveHoldingItem(); | |
1205 pIcons_LOD->_40F9C5(); | |
1206 return; | |
0 | 1207 } |
1208 v11 = pIndoor->pFaceExtras[v3->uFaceExtraID].uEventID; | |
1209 } | |
1210 else | |
1211 { | |
1212 v12 = &pOutdoor->pBModels[(signed int)(unsigned __int16)v0 >> 9].pFaces[v2 & 0x3F]; | |
1213 if ( !(v12->uAttributes & 0x2000000) ) | |
1214 goto LABEL_11; | |
1215 v11 = v12->sCogTriggeredID; | |
1216 } | |
1217 } | |
1218 EventProcessor(v11, (unsigned __int16)v0, 1); | |
1219 return; | |
1220 } | |
1221 v16 = (signed int)(unsigned __int16)v0 >> 3; | |
1222 a2.y = v16; | |
1223 v17 = &pActors[v16]; | |
1224 if ( v17->uAIState == 5 ) | |
1225 { | |
1226 if ( (unsigned int)v0 < 0x2000000 ) | |
1227 { | |
1228 stru_50C198.LootActor(&pActors[v16]); | |
1229 return; | |
1230 } | |
588 | 1231 v4 = pParty->pPickedItem.uItemID; |
1232 if ( !pParty->pPickedItem.uItemID ) | |
1233 return; | |
1234 goto LABEL_14; | |
0 | 1235 } |
1236 if ( GetAsyncKeyState(VK_SHIFT) >= 0 ) | |
1237 { | |
1238 if ( !v17->GetActorsRelation(0) && !(BYTE2(v17->uAttributes) & 8) ) | |
1239 { | |
1240 if ( (unsigned int)v0 >= 0x2000000 ) | |
588 | 1241 { |
1242 v4 = pParty->pPickedItem.uItemID; | |
1243 if ( !pParty->pPickedItem.uItemID ) | |
1244 return; | |
1245 goto LABEL_14; | |
1246 } | |
0 | 1247 if ( !v17->CanAct() ) |
1248 return; | |
1249 v18 = a2.y; | |
1250 Actor::FaceObject(a2.y, 4u, 0, 0); | |
602 | 1251 if ( !v17->sNPC_ID ) |
0 | 1252 { |
1253 v19 = pNPCStats->pGroups_copy[v17->uGroup]; | |
1254 if ( v19 ) | |
1255 { | |
1256 v20 = pNPCStats->pCatchPhrases[v19]; | |
1257 if ( v20 ) | |
1258 { | |
1259 pParty->uFlags |= 2u; | |
1260 strcpy(byte_5B0938, v20); | |
1261 sub_4451A8_press_any_key(0, 0, 0); | |
1262 } | |
1263 } | |
1264 return; | |
1265 } | |
437 | 1266 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) |
0 | 1267 return; |
1268 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)161; | |
1269 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v18; | |
1270 LABEL_42: | |
1271 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; | |
1272 ++pMessageQueue_50CBD0->uNumMessages; | |
437 | 1273 return;*/ |
1274 pMessageQueue_50CBD0->AddMessage(UIMSG_StartNPCDialogue, v18, 0); | |
0 | 1275 return; |
1276 } | |
1277 if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->field_4 == 3 ) | |
1278 { | |
1279 pTurnEngine->field_18 |= 8u; | |
1280 return; | |
1281 } | |
437 | 1282 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) |
0 | 1283 { |
1284 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)23; | |
1285 goto LABEL_41; | |
437 | 1286 }*/ |
1287 pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0); | |
0 | 1288 } |
1289 else | |
1290 { | |
1291 if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->field_4 == 3 ) | |
1292 { | |
569 | 1293 pParty->uFlags |= PARTY_FLAGS_1_FALLING; |
0 | 1294 return; |
1295 } | |
1296 if ( uActiveCharacter | |
437 | 1297 && sub_427769_spell(pPlayers[uActiveCharacter]->uQuickSpell)) |
0 | 1298 { |
437 | 1299 pMessageQueue_50CBD0->AddMessage(UIMSG_19, 0, 0); |
1300 /*&& (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) | |
0 | 1301 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)25; |
1302 LABEL_41: | |
1303 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; | |
437 | 1304 goto LABEL_42;*/ |
0 | 1305 } |
1306 } | |
1307 } | |
1308 | |
1309 //----- (004226C2) -------------------------------------------------------- | |
265 | 1310 bool PauseGameDrawing() |
0 | 1311 { |
265 | 1312 if ( pCurrentScreen != SCREEN_GAME |
151 | 1313 && pCurrentScreen != SCREEN_NPC_DIALOGUE |
1314 && pCurrentScreen != SCREEN_CHANGE_LOCATION ) | |
1315 { | |
1316 if ( pCurrentScreen == SCREEN_INPUT_BLV ) | |
0 | 1317 return pVideoPlayer->pSmackerMovie != 0; |
151 | 1318 if ( pCurrentScreen != SCREEN_BRANCHLESS_NPC_DIALOG ) |
265 | 1319 return true; |
1320 } | |
1321 return false; | |
0 | 1322 } |
1323 // 4E28F8: using guessed type int pCurrentScreen; | |
1324 | |
1325 //----- (004226EF) -------------------------------------------------------- | |
373 | 1326 void SetUserInterface(PartyAlignment align, bool bReplace) |
0 | 1327 { |
1328 unsigned int v3; // eax@7 | |
1329 unsigned __int16 v4; // dx@7 | |
1330 unsigned __int16 v5; // cx@7 | |
1331 unsigned __int16 v6; // [sp-4h] [bp-14h]@7 | |
1332 | |
373 | 1333 |
1334 if (align == PartyAlignment_Evil) | |
1335 { | |
0 | 1336 if ( bReplace ) |
1337 { | |
1338 pTexture_RightFrame->Reload("ib-r-C.pcx"); | |
1339 pTexture_BottomFrame->Reload("ib-b-C.pcx"); | |
1340 pTexture_TopFrame->Reload("ib-t-C.pcx"); | |
1341 pTexture_LeftFrame->Reload("ib-l-C.pcx"); | |
1342 pTexture_StatusBar->Reload("IB-Foot-c.pcx"); | |
1343 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_right_panel], "ib-mb-C", 2); | |
1344 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079D8], "ib-autmask-c", 2); | |
1345 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079B4], "IB-COMP-C", 2); | |
1346 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079D0], "IB-InitG-c", 2); | |
1347 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079C8], "IB-InitY-c", 2); | |
1348 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079CC], "IB-InitR-c", 2); | |
319 | 1349 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft], "IB-NPCLD-C", 2); |
1350 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_NPCRight], "IB-NPCRD-C", 2); | |
1351 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_ZoomIn], "ib-autout-C", 2); | |
1352 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_ZoomOut], "ib-autin-C", 2); | |
0 | 1353 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_50C98C], "IB-selec-C", 2); |
319 | 1354 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_CastSpell], "ib-m1d-c", 2); |
1355 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_Rest], "ib-m2d-c", 2); | |
1356 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_QuickReference], "ib-m3d-c", 2); | |
1357 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_GameSettings], "ib-m4d-c", 2); | |
569 | 1358 |
1359 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Bless], "isg-01-c", 2); | |
1360 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Preservation], "isg-02-c", 2); | |
1361 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Hammerhands], "isg-03-c", 2); | |
1362 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_PainReflection], "isg-04-c", 2); | |
1363 | |
0 | 1364 pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeC"); |
569 | 1365 pIconsFrameTable->InitializeAnimation(pUIAnim_WizardEye->uIconID); |
0 | 1366 pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchC"); |
569 | 1367 pIconsFrameTable->InitializeAnimation(pUIAnum_Torchlight->uIconID); |
1368 | |
526 | 1369 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uExitCancelTextureId], "ib-bcu-c", 2); |
0 | 1370 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50795C], "evtnpc-c", 2); |
1371 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507958], "fr_inven-c", 2); | |
1372 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Parchment], "parchment", 2); | |
1373 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B4], "cornr_ll-c", 2); | |
1374 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B0], "cornr_lr-c", 2); | |
1375 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076AC], "cornr_ul-c", 2); | |
1376 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A8], "cornr_ur-c", 2); | |
1377 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A4], "edge_btm-c", 2); | |
1378 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A0], "edge_lf-c", 2); | |
1379 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50769C], "edge_rt-c", 2); | |
1380 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507698], "edge_top-c", 2); | |
1381 pIcons_LOD->ReloadTexture(pTexture_591428, "endcap-c", 2); | |
1382 } | |
1383 else | |
1384 { | |
1385 pTexture_RightFrame->Load("ib-r-C.pcx", 0); | |
1386 pTexture_BottomFrame->Load("ib-b-c.pcx", 0); | |
1387 pTexture_TopFrame->Load("ib-t-C.pcx", 0); | |
1388 pTexture_LeftFrame->Load("ib-l-C.pcx", 0); | |
1389 pTexture_StatusBar->Load("IB-Foot-c.pcx", 0); | |
1390 uTextureID_right_panel = pIcons_LOD->LoadTexture("ib-mb-C", TEXTURE_16BIT_PALETTE); | |
1391 dword_5079D8 = pIcons_LOD->LoadTexture("ib-autmask-c", TEXTURE_16BIT_PALETTE); | |
1392 dword_5079B4 = pIcons_LOD->LoadTexture("IB-COMP-C", TEXTURE_16BIT_PALETTE); | |
1393 dword_5079D0 = pIcons_LOD->LoadTexture("IB-InitG-c", TEXTURE_16BIT_PALETTE); | |
1394 dword_5079C8 = pIcons_LOD->LoadTexture("IB-InitY-c", TEXTURE_16BIT_PALETTE); | |
1395 dword_5079CC = pIcons_LOD->LoadTexture("IB-InitR-c", TEXTURE_16BIT_PALETTE); | |
319 | 1396 uTextureID_Btn_NPCLeft = pIcons_LOD->LoadTexture("IB-NPCLD-C", TEXTURE_16BIT_PALETTE); |
1397 uTextureID_Btn_NPCRight = pIcons_LOD->LoadTexture("IB-NPCRD-C", TEXTURE_16BIT_PALETTE); | |
328 | 1398 uTextureID_Btn_ZoomIn = pIcons_LOD->LoadTexture("ib-autout-C", TEXTURE_16BIT_PALETTE); |
319 | 1399 uTextureID_Btn_ZoomOut = pIcons_LOD->LoadTexture("ib-autin-C", TEXTURE_16BIT_PALETTE); |
0 | 1400 dword_50C98C = pIcons_LOD->LoadTexture("IB-selec-C", TEXTURE_16BIT_PALETTE); |
319 | 1401 uTextureID_Btn_CastSpell = pIcons_LOD->LoadTexture("ib-m1d-c", TEXTURE_16BIT_PALETTE); |
1402 uTextureID_Btn_Rest = pIcons_LOD->LoadTexture("ib-m2d-c", TEXTURE_16BIT_PALETTE); | |
1403 uTextureID_Btn_QuickReference = pIcons_LOD->LoadTexture("ib-m3d-c", TEXTURE_16BIT_PALETTE); | |
1404 uTextureID_Btn_GameSettings = pIcons_LOD->LoadTexture("ib-m4d-c", TEXTURE_16BIT_PALETTE); | |
526 | 1405 uExitCancelTextureId = pIcons_LOD->LoadTexture("ib-bcu-c", TEXTURE_16BIT_PALETTE); |
569 | 1406 uTextureID_PlayerBuff_Bless = pIcons_LOD->LoadTexture("isg-01-c", TEXTURE_16BIT_PALETTE); |
1407 uTextureID_PlayerBuff_Preservation = pIcons_LOD->LoadTexture("isg-02-c", TEXTURE_16BIT_PALETTE); | |
1408 uTextureID_PlayerBuff_Hammerhands = pIcons_LOD->LoadTexture("isg-03-c", TEXTURE_16BIT_PALETTE); | |
1409 uTextureID_PlayerBuff_PainReflection = pIcons_LOD->LoadTexture("isg-04-c", TEXTURE_16BIT_PALETTE); | |
0 | 1410 uTextureID_50795C = pIcons_LOD->LoadTexture("evtnpc-c", TEXTURE_16BIT_PALETTE); |
1411 uTextureID_507958 = pIcons_LOD->LoadTexture("fr_inven", TEXTURE_16BIT_PALETTE); | |
1412 pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeC"); | |
1413 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID); | |
1414 pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchC"); | |
1415 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID); | |
1416 } | |
1417 v3 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xC8u, 0, 0); | |
1418 v4 = 0; | |
1419 v6 = 0; | |
1420 v5 = 10; | |
1421 } | |
373 | 1422 else if (align == PartyAlignment_Neutral) |
0 | 1423 { |
1424 if ( bReplace ) | |
1425 { | |
1426 pTexture_RightFrame->Reload("ib-r-a.pcx"); | |
1427 pTexture_BottomFrame->Reload("ib-b-a.pcx"); | |
1428 pTexture_TopFrame->Reload("ib-t-a.pcx"); | |
1429 pTexture_LeftFrame->Reload("ib-l-a.pcx"); | |
1430 pTexture_StatusBar->Reload("IB-Foot-a.pcx"); | |
1431 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_right_panel], "ib-mb-a", 2); | |
1432 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079D8], "ib-autmask-a", 2); | |
1433 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079B4], "IB-COMP-a", 2); | |
1434 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079D0], "IB-InitG-a", 2); | |
1435 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079C8], "IB-InitY-a", 2); | |
1436 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079CC], "IB-InitR-a", 2); | |
319 | 1437 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft], "IB-NPCLD-a", 2); |
1438 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_NPCRight], "IB-NPCRD-a", 2); | |
1439 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_ZoomIn], "ib-autout-a", 2); | |
1440 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_ZoomOut], "ib-autin-a", 2); | |
0 | 1441 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_50C98C], "IB-selec-a", 2); |
319 | 1442 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_CastSpell], "ib-m1d-a", 2); |
1443 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_Rest], "ib-m2d-a", 2); | |
1444 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_QuickReference], "ib-m3d-a", 2); | |
1445 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_GameSettings], "ib-m4d-a", 2); | |
569 | 1446 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Bless], "isg-01-a", 2); |
1447 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Preservation], "isg-02-a", 2); | |
1448 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Hammerhands], "isg-03-a", 2); | |
1449 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_PainReflection], "isg-04-a", 2); | |
0 | 1450 pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeA"); |
1451 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID); | |
1452 pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchA"); | |
1453 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID); | |
526 | 1454 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uExitCancelTextureId], "ib-bcu-a", 2); |
0 | 1455 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50795C], "evtnpc", 2); |
1456 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507958], "fr_inven", 2); | |
1457 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Parchment], "parchment", 2); | |
1458 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B4], "cornr_ll", 2); | |
1459 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B0], "cornr_lr", 2); | |
1460 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076AC], "cornr_ul", 2); | |
1461 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A8], "cornr_ur", 2); | |
1462 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A4], "edge_btm", 2); | |
1463 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A0], "edge_lf", 2); | |
1464 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50769C], "edge_rt", 2); | |
1465 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507698], "edge_top", 2); | |
1466 pIcons_LOD->ReloadTexture(pTexture_591428, "endcap", 2); | |
1467 } | |
1468 else | |
1469 { | |
1470 pTexture_RightFrame->Load("ib-r-A.pcx", 0); | |
1471 pTexture_BottomFrame->Load("ib-b-A.pcx", 0); | |
1472 pTexture_TopFrame->Load("ib-t-A.pcx", 0); | |
1473 pTexture_LeftFrame->Load("ib-l-A.pcx", 0); | |
1474 pTexture_StatusBar->Load("IB-Foot-a.pcx", 0); | |
1475 uTextureID_right_panel = pIcons_LOD->LoadTexture("ib-mb-A", TEXTURE_16BIT_PALETTE); | |
1476 dword_5079D8 = pIcons_LOD->LoadTexture("ib-autmask-a", TEXTURE_16BIT_PALETTE); | |
1477 dword_5079B4 = pIcons_LOD->LoadTexture("IB-COMP-A", TEXTURE_16BIT_PALETTE); | |
1478 dword_5079D0 = pIcons_LOD->LoadTexture("IB-InitG-a", TEXTURE_16BIT_PALETTE); | |
1479 dword_5079C8 = pIcons_LOD->LoadTexture("IB-InitY-a", TEXTURE_16BIT_PALETTE); | |
1480 dword_5079CC = pIcons_LOD->LoadTexture("IB-InitR-a", TEXTURE_16BIT_PALETTE); | |
319 | 1481 uTextureID_Btn_NPCLeft = pIcons_LOD->LoadTexture("IB-NPCLD-A", TEXTURE_16BIT_PALETTE); |
1482 uTextureID_Btn_NPCRight = pIcons_LOD->LoadTexture("IB-NPCRD-A", TEXTURE_16BIT_PALETTE); | |
0 | 1483 dword_50C98C = pIcons_LOD->LoadTexture("IB-selec-A", TEXTURE_16BIT_PALETTE); |
319 | 1484 uTextureID_Btn_CastSpell = pIcons_LOD->LoadTexture("ib-m1d-a", TEXTURE_16BIT_PALETTE); |
1485 uTextureID_Btn_Rest = pIcons_LOD->LoadTexture("ib-m2d-a", TEXTURE_16BIT_PALETTE); | |
1486 uTextureID_Btn_QuickReference = pIcons_LOD->LoadTexture("ib-m3d-a", TEXTURE_16BIT_PALETTE); | |
1487 uTextureID_Btn_GameSettings = pIcons_LOD->LoadTexture("ib-m4d-a", TEXTURE_16BIT_PALETTE); | |
328 | 1488 uTextureID_Btn_ZoomIn = pIcons_LOD->LoadTexture("ib-autout-a", TEXTURE_16BIT_PALETTE); |
319 | 1489 uTextureID_Btn_ZoomOut = pIcons_LOD->LoadTexture("ib-autin-a", TEXTURE_16BIT_PALETTE); |
526 | 1490 uExitCancelTextureId = pIcons_LOD->LoadTexture("ib-bcu-a", TEXTURE_16BIT_PALETTE); |
569 | 1491 uTextureID_PlayerBuff_Bless = pIcons_LOD->LoadTexture("isg-01-a", TEXTURE_16BIT_PALETTE); |
1492 uTextureID_PlayerBuff_Preservation = pIcons_LOD->LoadTexture("isg-02-a", TEXTURE_16BIT_PALETTE); | |
1493 uTextureID_PlayerBuff_Hammerhands = pIcons_LOD->LoadTexture("isg-03-a", TEXTURE_16BIT_PALETTE); | |
1494 uTextureID_PlayerBuff_PainReflection = pIcons_LOD->LoadTexture("isg-04-a", TEXTURE_16BIT_PALETTE); | |
0 | 1495 uTextureID_50795C = pIcons_LOD->LoadTexture("evtnpc", TEXTURE_16BIT_PALETTE); |
1496 uTextureID_507958 = pIcons_LOD->LoadTexture("fr_inven", TEXTURE_16BIT_PALETTE); | |
1497 pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeA"); | |
1498 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID); | |
1499 pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchA"); | |
1500 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID); | |
1501 uTextureID_Parchment = pIcons_LOD->LoadTexture("parchment", TEXTURE_16BIT_PALETTE); | |
1502 uTextureID_5076B4 = pIcons_LOD->LoadTexture("cornr_ll", TEXTURE_16BIT_PALETTE); | |
1503 uTextureID_5076B0 = pIcons_LOD->LoadTexture("cornr_lr", TEXTURE_16BIT_PALETTE); | |
1504 uTextureID_5076AC = pIcons_LOD->LoadTexture("cornr_ul", TEXTURE_16BIT_PALETTE); | |
1505 uTextureID_5076A8 = pIcons_LOD->LoadTexture("cornr_ur", TEXTURE_16BIT_PALETTE); | |
1506 uTextureID_5076A4 = pIcons_LOD->LoadTexture("edge_btm", TEXTURE_16BIT_PALETTE); | |
1507 uTextureID_5076A0 = pIcons_LOD->LoadTexture("edge_lf", TEXTURE_16BIT_PALETTE); | |
1508 uTextureID_50769C = pIcons_LOD->LoadTexture("edge_rt", TEXTURE_16BIT_PALETTE); | |
1509 uTextureID_507698 = pIcons_LOD->LoadTexture("edge_top", TEXTURE_16BIT_PALETTE); | |
1510 pTexture_591428 = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("endcap", TEXTURE_16BIT_PALETTE)]; | |
1511 | |
1512 } | |
1513 v3 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xAu, 0, 0); | |
1514 v4 = 214; | |
1515 v5 = 230; | |
1516 v6 = 193; | |
1517 } | |
373 | 1518 else if (align == PartyAlignment_Good) |
0 | 1519 { |
1520 if ( bReplace ) | |
1521 { | |
1522 pTexture_RightFrame->Reload("ib-r-B.pcx"); | |
1523 pTexture_BottomFrame->Reload("ib-b-B.pcx"); | |
1524 pTexture_TopFrame->Reload("ib-t-B.pcx"); | |
1525 pTexture_LeftFrame->Reload("ib-l-B.pcx"); | |
1526 pTexture_StatusBar->Reload("IB-Foot-b.pcx"); | |
1527 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_right_panel], "ib-mb-B", 2); | |
1528 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079D8], "ib-autmask-b", 2); | |
1529 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079B4], "IB-COMP-B", 2); | |
1530 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079D0], "IB-InitG-b", 2); | |
1531 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079C8], "IB-InitY-b", 2); | |
1532 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079CC], "IB-InitR-b", 2); | |
319 | 1533 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft], "IB-NPCLD-B", 2); |
1534 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_NPCRight], "IB-NPCRD-B", 2); | |
1535 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_ZoomIn], "ib-autout-B", 2); | |
1536 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_ZoomOut], "ib-autin-B", 2); | |
0 | 1537 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_50C98C], "IB-selec-B", 2); |
319 | 1538 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_CastSpell], "ib-m1d-b", 2); |
1539 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_Rest], "ib-m2d-b", 2); | |
1540 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_QuickReference], "ib-m3d-b", 2); | |
1541 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_GameSettings], "ib-m4d-b", 2); | |
569 | 1542 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Bless], "isg-01-b", 2); |
1543 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Preservation], "isg-02-b", 2); | |
1544 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_Hammerhands], "isg-03-b", 2); | |
1545 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_PlayerBuff_PainReflection], "isg-04-b", 2); | |
0 | 1546 pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeB"); |
1547 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID); | |
1548 pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchB"); | |
1549 pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID); | |
526 | 1550 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uExitCancelTextureId], "ib-bcu-b", 2); |
0 | 1551 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50795C], "evtnpc-b", 2); |
1552 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507958], "fr_inven-b", 2); | |
1553 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Parchment], "parchment", 2); | |
1554 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B4], "cornr_ll-b", 2); | |
1555 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B0], "cornr_lr-b", 2); | |
1556 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076AC], "cornr_ul-b", 2); | |
1557 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A8], "cornr_ur-b", 2); | |
1558 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A4], "edge_btm-b", 2); | |
1559 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A0], "edge_lf-b", 2); | |
1560 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50769C], "edge_rt-b", 2); | |
1561 pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507698], "edge_top-b", 2); | |
1562 pIcons_LOD->ReloadTexture(pTexture_591428, "endcap-b", 2); | |
1563 } | |
1564 v3 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0, 0xC8u); | |
1565 v5 = 255; | |
1566 v4 = 225; | |
1567 v6 = 255; | |
1568 } | |
373 | 1569 else assert(false); |
1570 | |
0 | 1571 uGameUIFontMain = v3; |
1572 uGameUIFontShadow = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(v5, v4, v6); | |
1573 } | |
1574 | |
1575 //----- (00423AEE) -------------------------------------------------------- | |
1576 void __cdecl reset_some_strus_flt_2Cs() | |
1577 { | |
1578 float *v0; // eax@1 | |
1579 signed int v1; // ecx@1 | |
1580 signed int v2; // edx@1 | |
1581 float *v3; // eax@3 | |
1582 signed int v4; // edx@3 | |
1583 float *v5; // eax@5 | |
1584 signed int v6; // edx@5 | |
1585 float *v7; // eax@7 | |
1586 signed int v8; // edx@7 | |
1587 float *v9; // eax@9 | |
1588 | |
1589 v0 = &array_50AC10[0].flt_2C; | |
1590 v1 = 50; | |
1591 v2 = 50; | |
1592 do | |
1593 { | |
1594 *v0 = 0.0; | |
1595 v0 += 12; | |
1596 --v2; | |
1597 } | |
1598 while ( v2 ); | |
1599 v3 = &array_50A2B0[0].flt_2C; | |
1600 v4 = 50; | |
1601 do | |
1602 { | |
1603 *v3 = 0.0; | |
1604 v3 += 12; | |
1605 --v4; | |
1606 } | |
1607 while ( v4 ); | |
1608 v5 = &array_509950[0].flt_2C; | |
1609 v6 = 50; | |
1610 do | |
1611 { | |
1612 *v5 = 0.0; | |
1613 v5 += 12; | |
1614 --v6; | |
1615 } | |
1616 while ( v6 ); | |
1617 v7 = &array_508FF0[0].flt_2C; | |
1618 v8 = 50; | |
1619 do | |
1620 { | |
1621 *v7 = 0.0; | |
1622 v7 += 12; | |
1623 --v8; | |
1624 } | |
1625 while ( v8 ); | |
1626 v9 = &array_508690[0].flt_2C; | |
1627 do | |
1628 { | |
1629 *v9 = 0.0; | |
1630 v9 += 12; | |
1631 --v1; | |
1632 } | |
1633 while ( v1 ); | |
1634 } | |
1635 | |
1636 //----- (00423B4A) -------------------------------------------------------- | |
1637 void __cdecl sub_423B4A() | |
1638 { | |
1639 float *v0; // eax@1 | |
1640 signed int v1; // ecx@1 | |
1641 | |
1642 v0 = &array_507D30[0].flt_2C; | |
1643 v1 = 50; | |
1644 do | |
1645 { | |
1646 *v0 = 0.0; | |
1647 v0 += 12; | |
1648 --v1; | |
1649 } | |
1650 while ( v1 ); | |
1651 } | |
1652 | |
1653 //----- (00423B5D) -------------------------------------------------------- | |
1654 int __fastcall sub_423B5D(unsigned int uFaceID) | |
1655 { | |
1656 BLVFace *v1; // ebx@1 | |
1657 Vec3_short_ *v2; // esi@1 | |
1658 //int v3; // ST28_4@1 | |
1659 __int16 v4; // ST2C_2@1 | |
1660 //signed int v5; // esi@1 | |
1661 //Vec3_short_ *v6; // eax@4 | |
1662 //signed int v7; // edi@5 | |
1663 //signed int v8; // eax@5 | |
1664 //signed int i_; // ecx@10 | |
1665 int v10; // eax@10 | |
1666 int v11; // edx@11 | |
1667 int v12; // ST28_4@12 | |
1668 signed int v13; // edx@12 | |
1669 signed __int64 v14; // qtt@12 | |
1670 int *v15; // ebx@12 | |
1671 int v16; // ST28_4@14 | |
1672 signed int v17; // eax@14 | |
1673 signed __int64 v18; // qtt@14 | |
1674 signed int v19; // edx@15 | |
1675 signed int v20; // edx@17 | |
1676 signed int v21; // ebx@19 | |
1677 signed int v22; // esi@20 | |
1678 int v23; // edi@21 | |
1679 int v24; // eax@21 | |
1680 int v25; // eax@22 | |
1681 int v26; // eax@22 | |
1682 signed int v27; // ST30_4@24 | |
1683 signed __int64 v28; // qtt@24 | |
1684 int v29; // ST18_4@25 | |
1685 int v30; // eax@26 | |
1686 int v31; // eax@27 | |
1687 int v32; // eax@27 | |
1688 signed int v33; // ST30_4@29 | |
1689 signed __int64 v34; // qtt@29 | |
1690 int v35; // ST30_4@30 | |
1691 signed int v36; // edi@31 | |
1692 unsigned int v37; // eax@31 | |
1693 bool v38; // edx@31 | |
1694 int v39; // ecx@31 | |
1695 int v40; // ecx@32 | |
1696 int v41; // esi@32 | |
1697 int v42; // eax@34 | |
1698 signed int v43; // ebx@41 | |
1699 unsigned int v44; // eax@41 | |
1700 signed int v45; // ecx@42 | |
1701 int v46; // esi@42 | |
1702 int v47; // eax@44 | |
1703 signed int v48; // edi@51 | |
1704 unsigned int v49; // eax@51 | |
1705 bool v50; // edx@51 | |
1706 int v51; // ecx@51 | |
1707 int v52; // ecx@52 | |
1708 signed int v53; // esi@52 | |
1709 int v54; // eax@54 | |
1710 int v55; // ebx@61 | |
1711 unsigned int v56; // eax@61 | |
1712 signed int v57; // ecx@62 | |
1713 int v58; // esi@62 | |
1714 int v59; // eax@64 | |
1715 char v61; // zf@72 | |
1716 signed int v62; // edx@75 | |
1717 int v63; // ecx@76 | |
1718 int v64; // esi@76 | |
1719 int v65; // ecx@83 | |
1720 //signed int v66; // [sp+14h] [bp-14h]@3 | |
1721 int v67; // [sp+14h] [bp-14h]@34 | |
1722 int v68; // [sp+14h] [bp-14h]@44 | |
1723 int v69; // [sp+14h] [bp-14h]@54 | |
1724 int v70; // [sp+14h] [bp-14h]@64 | |
1725 signed int v71; // [sp+14h] [bp-14h]@75 | |
1726 bool thisa; // [sp+18h] [bp-10h]@9 | |
1727 int thisb; // [sp+18h] [bp-10h]@12 | |
1728 int thisc; // [sp+18h] [bp-10h]@20 | |
1729 bool thisd; // [sp+18h] [bp-10h]@41 | |
1730 bool thise; // [sp+18h] [bp-10h]@61 | |
1731 int thisf; // [sp+18h] [bp-10h]@74 | |
1732 signed int v79; // [sp+1Ch] [bp-Ch]@9 | |
1733 int v80; // [sp+1Ch] [bp-Ch]@76 | |
1734 bool v81; // [sp+20h] [bp-8h]@10 | |
1735 bool v82; // [sp+20h] [bp-8h]@32 | |
1736 bool v83; // [sp+20h] [bp-8h]@42 | |
1737 bool v84; // [sp+20h] [bp-8h]@52 | |
1738 bool v85; // [sp+20h] [bp-8h]@62 | |
1739 //signed int i; // [sp+24h] [bp-4h]@9 | |
1740 signed int ia; // [sp+24h] [bp-4h]@19 | |
1741 signed int ib; // [sp+24h] [bp-4h]@31 | |
1742 signed int ic; // [sp+24h] [bp-4h]@41 | |
1743 signed int id; // [sp+24h] [bp-4h]@51 | |
1744 signed int ie; // [sp+24h] [bp-4h]@61 | |
1745 | |
1746 v1 = &pIndoor->pFaces[uFaceID]; | |
1747 //this = pGame->pIndoorCameraD3D; | |
1748 v2 = &pIndoor->pVertices[v1->pVertexIDs[0]]; | |
1749 //v3 = *(_DWORD *)&v2->x; | |
1750 v4 = v2->z; | |
1751 //v5 = 0; | |
1752 if ( v1->pFacePlane_old.vNormal.x * (v2->x - pBLVRenderParams->vPartyPos.x) | |
1753 + v1->pFacePlane_old.vNormal.y * (v2->y - pBLVRenderParams->vPartyPos.y) | |
1754 + v1->pFacePlane_old.vNormal.z * (v2->z - pBLVRenderParams->vPartyPos.z) < 0 ) | |
1755 { | |
1756 dword_50B700 = 1; | |
1757 } | |
1758 else | |
1759 { | |
1760 dword_50B700 = 0; | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
652
diff
changeset
|
1761 if ( !v1->Portal() ) |
0 | 1762 return 0; |
1763 } | |
1764 //v66 = v1->uNumVertices; | |
1765 for (uint i = 0; i < v1->uNumVertices; ++i) | |
1766 { | |
1767 auto v6 = &pIndoor->pVertices[v1->pVertexIDs[i]]; | |
1768 pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible( | |
1769 v6->x, | |
1770 v6->y, | |
1771 v6->z, | |
1772 &_50B924_view_transformed_xs[i], | |
1773 &_50B834_view_transformed_zs[i], | |
1774 &_50B744_view_transformed_ys[i], | |
1775 0); | |
1776 } | |
1777 | |
1778 //v7 = v1->uNumVertices; | |
1779 //v8 = 0; | |
1780 if (v1->uNumVertices <= 0) | |
1781 return 0; | |
1782 | |
1783 bool bFound = false; | |
1784 for (uint i = 0; i < v1->uNumVertices; ++i) | |
1785 if (_50B924_view_transformed_xs[i] >= 0x80000u) | |
1786 { | |
1787 bFound = true; | |
1788 break; | |
1789 } | |
1790 if (!bFound) | |
1791 return 0; | |
1792 | |
1793 v79 = 0; | |
1794 _50B924_view_transformed_xs[v1->uNumVertices] = _50B924_view_transformed_xs[0]; | |
1795 _50B834_view_transformed_zs[v1->uNumVertices] = _50B834_view_transformed_zs[0]; | |
1796 _50B744_view_transformed_ys[v1->uNumVertices] = _50B744_view_transformed_ys[0]; | |
564 | 1797 thisa = _50B924_view_transformed_xs[0] >= (signed int)0x80000u; |
0 | 1798 //int i = 1; |
561 | 1799 for (uint i = 1; i <= v1->uNumVertices; ++i) |
0 | 1800 { |
1801 v10 = _50B924_view_transformed_xs[i]; | |
1802 v81 = v10 >= (signed int)0x80000u; | |
1803 if ( thisa ^ v81 ) | |
1804 { | |
1805 v11 = _50B924_view_transformed_xs[i - 1]; | |
1806 if ( v10 >= (signed int)0x80000u ) | |
1807 { | |
1808 v12 = v10 - v11; | |
1809 v13 = 0x80000 - v11; | |
1810 LODWORD(v14) = v13 << 16; | |
1811 HIDWORD(v14) = v13 >> 16; | |
1812 v15 = &_50B744_view_transformed_ys[i - 1]; | |
486 | 1813 dword_50B828[v79] = ((unsigned __int64)((_50B834_view_transformed_zs[i] - _50B834_view_transformed_zs[i - 1]) * v14 / v12) >> 16) + _50B834_view_transformed_zs[i - 1]; |
0 | 1814 thisb = (unsigned __int64)((_50B744_view_transformed_ys[i] - _50B744_view_transformed_ys[i - 1]) * v14 / v12) >> 16; |
1815 } | |
1816 else | |
1817 { | |
1818 v16 = v11 - v10; | |
1819 v17 = 0x80000 - v10; | |
1820 LODWORD(v18) = v17 << 16; | |
1821 HIDWORD(v18) = v17 >> 16; | |
1822 v15 = &_50B744_view_transformed_ys[i]; | |
108 | 1823 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 | 1824 thisb = (unsigned __int64)((_50B744_view_transformed_ys[i - 1] - _50B744_view_transformed_ys[i]) * v18 / v16) >> 16; |
1825 } | |
1826 v19 = v79++; | |
1827 //v7 = v66; | |
1828 dword_50B738[v19] = thisb + *v15; | |
1829 dword_50B918[v19] = 0x80000u; | |
1830 } | |
1831 if ( v81 ) | |
1832 { | |
1833 v20 = v79++; | |
1834 dword_50B918[v20] = _50B924_view_transformed_xs[i]; | |
1835 dword_50B828[v20] = _50B834_view_transformed_zs[i]; | |
1836 dword_50B738[v20] = _50B744_view_transformed_ys[i]; | |
1837 } | |
1838 //++i; | |
1839 thisa = v81; | |
1840 } | |
1841 v21 = v79; | |
1842 dword_50B918[v79] = dword_50B918[0]; | |
1843 dword_50B828[v79] = dword_50B828[0]; | |
561 | 1844 dword_50B738[v79] = dword_50B738[0]; |
1845 for (ia = 0; ia < v79; ++ia) | |
0 | 1846 { |
1847 v22 = ia; | |
1848 thisc = abs(dword_50B918[ia]); | |
1849 if ( abs(dword_50B828[ia]) >> 13 <= thisc ) | |
1850 { | |
1851 v27 = dword_50B828[v22]; | |
1852 LODWORD(v28) = v27 << 16; | |
1853 HIDWORD(v28) = v27 >> 16; | |
1854 v26 = v28 / dword_50B918[v22]; | |
1855 v23 = 0; | |
1856 } | |
1857 else | |
1858 { | |
1859 v23 = 0; | |
1860 v24 = 0; | |
1861 if ( dword_50B828[v22] >= 0 ) | |
1862 { | |
1863 LOBYTE(v24) = dword_50B918[v22] >= 0; | |
1864 v26 = ((v24 - 1) & 0xFF800000) + 0x400000; | |
1865 } | |
1866 else | |
1867 { | |
1868 LOBYTE(v24) = dword_50B918[v22] >= 0; | |
1869 v25 = v24 - 1; | |
1870 v26 = (v25 & 0x800000) - 0x400000; | |
1871 } | |
1872 } | |
1873 v29 = dword_50B738[v22]; | |
561 | 1874 dword_50BAF8_xs[v22] = v26; |
0 | 1875 if ( abs(v29) >> 13 <= thisc ) |
1876 { | |
1877 v33 = dword_50B738[v22]; | |
1878 LODWORD(v34) = v33 << 16; | |
1879 HIDWORD(v34) = v33 >> 16; | |
1880 v32 = v34 / dword_50B918[v22]; | |
1881 } | |
1882 else | |
1883 { | |
1884 v30 = 0; | |
1885 if ( dword_50B738[v22] >= v23 ) | |
1886 { | |
1887 LOBYTE(v30) = dword_50B918[v22] >= v23; | |
1888 v32 = ((v30 - 1) & 0xFF800000) + 0x400000; | |
1889 } | |
1890 else | |
1891 { | |
1892 LOBYTE(v30) = dword_50B918[v22] >= v23; | |
1893 v31 = v30 - 1; | |
1894 v32 = (v31 & 0x800000) - 0x400000; | |
1895 } | |
1896 } | |
561 | 1897 dword_50BA08_ys[v22] = v32; |
1898 dword_50BAF8_xs[v22] = (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40) * (signed __int64)dword_50BAF8_xs[v22]) >> 16; | |
1899 v35 = (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40) * (signed __int64)dword_50BA08_ys[v22]) >> 16; | |
1900 dword_50BAF8_xs[v22] = pBLVRenderParams->uViewportCenterX - dword_50BAF8_xs[v22]; | |
1901 dword_50BA08_ys[v22] = pBLVRenderParams->uViewportCenterY - v35; | |
0 | 1902 } |
1903 v36 = 0; | |
561 | 1904 dword_50BAF8_xs[v21] = dword_50BAF8_xs[0]; |
1905 dword_50BA08_ys[v21] = dword_50BA08_ys[0]; | |
0 | 1906 v37 = pBLVRenderParams->uViewportX; |
561 | 1907 v38 = dword_50BAF8_xs[0] < (signed int)pBLVRenderParams->uViewportX; |
1908 LOBYTE(v38) = dword_50BAF8_xs[0] >= (signed int)pBLVRenderParams->uViewportX; | |
0 | 1909 v39 = 1; |
1910 ib = 1; | |
1911 if ( v79 < 1 ) | |
1912 return 0; | |
1913 do | |
1914 { | |
1915 v40 = v39; | |
561 | 1916 v41 = dword_50BAF8_xs[v40]; |
0 | 1917 v82 = v41 >= (signed int)v37; |
1918 if ( v38 ^ v82 ) | |
1919 { | |
1920 if ( v41 >= (signed int)v37 ) | |
1921 { | |
561 | 1922 v67 = (signed int)(v37 - dword_50BAF8_xs[v40 - 1]) * (signed __int64)(dword_50BA08_ys[v40] - dword_50BA08_ys[v40 - 1]) / (v41 - dword_50BAF8_xs[v40 - 1]); |
1923 v42 = dword_50BA08_ys[v40 - 1]; | |
0 | 1924 } |
1925 else | |
1926 { | |
561 | 1927 v67 = (signed int)(v37 - v41) * (signed __int64)(dword_50BA08_ys[v40 - 1] - dword_50BA08_ys[v40]) / (dword_50BAF8_xs[v40 - 1] - v41); |
1928 v42 = dword_50BA08_ys[v40]; | |
0 | 1929 } |
561 | 1930 dword_50B9FC_ys[v36] = v67 + v42; |
1931 v37 = pBLVRenderParams->uViewportX; | |
1932 dword_50BAEC_xs[v36] = pBLVRenderParams->uViewportX; | |
0 | 1933 ++v36; |
1934 } | |
1935 v38 = v82; | |
1936 if ( v82 ) | |
1937 { | |
561 | 1938 dword_50BAEC_xs[v36] = dword_50BAF8_xs[v40]; |
1939 dword_50B9FC_ys[v36] = dword_50BA08_ys[v40]; | |
1940 ++v36; | |
0 | 1941 } |
1942 v39 = ib++ + 1; | |
1943 } | |
1944 while ( ib <= v79 ); | |
1945 | |
486 | 1946 if (v36 < 1) |
0 | 1947 return 0; |
1948 | |
486 | 1949 v43 = 0; |
561 | 1950 dword_50BAEC_xs[v36] = dword_50BAEC_xs[0]; |
1951 dword_50B9FC_ys[v36] = dword_50B9FC_ys[0]; | |
486 | 1952 v44 = pBLVRenderParams->uViewportZ; |
561 | 1953 thisd = dword_50BAEC_xs[0] <= (signed int)pBLVRenderParams->uViewportZ; |
486 | 1954 ic = 1; |
1955 | |
0 | 1956 do |
1957 { | |
1958 v45 = ic; | |
561 | 1959 v46 = dword_50BAEC_xs[ic]; |
0 | 1960 v83 = v46 <= (signed int)v44; |
1961 if ( thisd ^ v83 ) | |
1962 { | |
1963 if ( v46 <= (signed int)v44 ) | |
1964 { | |
561 | 1965 v68 = (signed int)(v44 - dword_50BAEC_xs[v45 - 1]) * (signed __int64)(dword_50B9FC_ys[v45] - dword_50B9FC_ys[v45 - 1]) / (v46 - dword_50BAEC_xs[v45 - 1]); |
1966 v47 = dword_50B9FC_ys[v45 - 1]; | |
0 | 1967 } |
1968 else | |
1969 { | |
561 | 1970 v68 = (signed int)(v44 - v46) * (signed __int64)(dword_50B9FC_ys[v45 - 1] - dword_50B9FC_ys[v45]) / (dword_50BAEC_xs[v45 - 1] - v46); |
1971 v47 = dword_50B9FC_ys[v45]; | |
0 | 1972 } |
561 | 1973 dword_50B9F0[v43] = v68 + v47; |
1974 v44 = pBLVRenderParams->uViewportZ; | |
1975 dword_50BAE0[v43] = pBLVRenderParams->uViewportZ; | |
0 | 1976 ++v43; |
1977 } | |
1978 if ( v83 ) | |
1979 { | |
561 | 1980 dword_50BAE0[v43] = dword_50BAEC_xs[v45]; |
1981 dword_50B9F0[v43++] = dword_50B9FC_ys[v45]; | |
0 | 1982 } |
1983 ++ic; | |
1984 thisd = v83; | |
1985 } | |
1986 while ( ic <= v36 ); | |
486 | 1987 |
1988 if (v43 < 1) | |
0 | 1989 return 0; |
486 | 1990 |
1991 v48 = 0; | |
1992 dword_50BAE0[v43] = dword_50BAE0[0]; | |
1993 dword_50B9F0[v43] = dword_50B9F0[0]; | |
1994 v49 = pBLVRenderParams->uViewportY; | |
1995 v50 = dword_50B9F0[0] < (signed int)pBLVRenderParams->uViewportY; | |
1996 LOBYTE(v50) = dword_50B9F0[0] >= (signed int)pBLVRenderParams->uViewportY; | |
1997 v51 = 1; | |
1998 id = 1; | |
0 | 1999 do |
2000 { | |
2001 v52 = v51; | |
2002 v53 = dword_50B9F0[v52]; | |
2003 v84 = v53 >= (signed int)v49; | |
2004 if ( v50 ^ v84 ) | |
2005 { | |
2006 if ( v53 >= (signed int)v49 ) | |
2007 { | |
561 | 2008 v69 = (signed int)(v49 - dword_50B9F0[v52 - 1]) * (signed __int64)(dword_50BAE0[v52] - dword_50BAE0[v52 - 1]) / (v53 - dword_50B9F0[v52 - 1]); |
2009 v54 = dword_50BAE0[v52 - 1]; | |
0 | 2010 } |
2011 else | |
2012 { | |
561 | 2013 v69 = (signed int)(v49 - v53) * (signed __int64)(dword_50BAE0[v52 - 1] - dword_50BAE0[v52]) / (dword_50B9F0[v52 - 1] - v53); |
0 | 2014 v54 = dword_50BAE0[v52]; |
2015 } | |
561 | 2016 dword_50BAD4[v48] = v69 + v54; |
2017 v49 = pBLVRenderParams->uViewportY; | |
2018 dword_50B9E4[v48] = pBLVRenderParams->uViewportY; | |
0 | 2019 ++v48; |
2020 } | |
2021 v50 = v84; | |
2022 if ( v84 ) | |
2023 { | |
2024 dword_50BAD4[v48] = dword_50BAE0[v52]; | |
561 | 2025 dword_50B9E4[v48++] = dword_50B9F0[v52]; |
0 | 2026 } |
2027 v51 = id++ + 1; | |
2028 } | |
2029 while ( id <= v43 ); | |
486 | 2030 |
2031 if (v48 < 1) | |
0 | 2032 return 0; |
486 | 2033 |
2034 v55 = 0; | |
2035 dword_50BAD4[v48] = dword_50BAD4[0]; | |
561 | 2036 dword_50B9E4[v48] = dword_50B9E4[0]; |
486 | 2037 v56 = pBLVRenderParams->uViewportW; |
561 | 2038 thise = dword_50B9E4[0] <= (signed int)pBLVRenderParams->uViewportW; |
486 | 2039 ie = 1; |
0 | 2040 do |
2041 { | |
2042 v57 = ie; | |
561 | 2043 v58 = dword_50B9E4[ie]; |
0 | 2044 v85 = v58 <= (signed int)v56; |
2045 if ( thise ^ v85 ) | |
2046 { | |
2047 if ( v58 <= (signed int)v56 ) | |
2048 { | |
561 | 2049 v70 = (signed int)(v56 - dword_50B9E4[v57 - 1]) * (signed __int64)(dword_50BAD4[v57] - dword_50BAD4[v57 - 1]) / (v58 - dword_50B9E4[v57 - 1]); |
2050 v59 = dword_50BAD4[v57 - 1]; | |
0 | 2051 } |
2052 else | |
2053 { | |
561 | 2054 v70 = (signed int)(v56 - v58) * (signed __int64)(dword_50BAD4[v57 - 1] - dword_50BAD4[v57]) / (dword_50B9E4[v57 - 1] - v58); |
0 | 2055 v59 = dword_50BAD4[v57]; |
2056 } | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
652
diff
changeset
|
2057 _50BAC8_screen_space_x[v55] = v70 + v59; |
561 | 2058 v56 = pBLVRenderParams->uViewportW; |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
652
diff
changeset
|
2059 _50B9D8_screen_space_y[v55] = pBLVRenderParams->uViewportW; |
0 | 2060 ++v55; |
2061 } | |
2062 if ( v85 ) | |
2063 { | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
652
diff
changeset
|
2064 _50BAC8_screen_space_x[v55] = dword_50BAD4[v57]; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
652
diff
changeset
|
2065 _50B9D8_screen_space_y[v55++] = dword_50B9E4[v57]; |
0 | 2066 } |
2067 ++ie; | |
2068 thise = v85; | |
2069 } | |
2070 while ( ie <= v48 ); | |
486 | 2071 |
0 | 2072 if ( !v55 ) |
2073 return 0; | |
2074 v61 = pRenderer->pRenderD3D == 0; | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
652
diff
changeset
|
2075 _50BAC8_screen_space_x[v55] = _50BAC8_screen_space_x[0]; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
652
diff
changeset
|
2076 _50B9D8_screen_space_y[v55] = _50B9D8_screen_space_y[0]; |
0 | 2077 if ( v61 && v55 > 3 ) |
2078 { | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
652
diff
changeset
|
2079 _50BAC8_screen_space_x[v55 + 1] = _50BAC8_screen_space_x[1]; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
652
diff
changeset
|
2080 _50B9D8_screen_space_y[v55 + 1] = _50B9D8_screen_space_y[1]; |
0 | 2081 thisf = 2 * (dword_50B700 != 0) - 1; |
2082 if ( v55 > 0 ) | |
2083 { | |
2084 v62 = 1; | |
2085 v71 = 1; | |
2086 do | |
2087 { | |
2088 v63 = v62 - 1; | |
2089 v64 = v62 + 1; | |
2090 v80 = v62 + 1; | |
2091 if ( v62 - 1 >= v55 ) | |
2092 v63 -= v55; | |
2093 if ( v62 >= v55 ) | |
2094 v62 -= v55; | |
2095 if ( v64 >= v55 ) | |
2096 v64 -= v55; | |
2097 if ( thisf | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
652
diff
changeset
|
2098 * ((_50B9D8_screen_space_y[v64] - _50B9D8_screen_space_y[v63]) * (_50BAC8_screen_space_x[v62] - _50BAC8_screen_space_x[v63]) |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
652
diff
changeset
|
2099 - (_50B9D8_screen_space_y[v62] - _50B9D8_screen_space_y[v63]) * (_50BAC8_screen_space_x[v64] - _50BAC8_screen_space_x[v63])) < 0 ) |
0 | 2100 { |
2101 v62 = v80; | |
2102 v71 = v80; | |
2103 } | |
2104 else | |
2105 { | |
2106 v62 = v71; | |
2107 v65 = v71; | |
2108 if ( v71 < v55 || (v65 = v71 - v55, v71 - v55 < v55) ) | |
2109 { | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
652
diff
changeset
|
2110 memcpy(&_50B9D8_screen_space_y[v65], &_50B9D8_screen_space_y[v65 + 1], 4 * ((unsigned int)(4 * (v55 - v65)) >> 2)); |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
652
diff
changeset
|
2111 memcpy(&_50BAC8_screen_space_x[v65], &_50BAC8_screen_space_x[v65 + 1], 4 * ((unsigned int)(4 * (v55 - v65)) >> 2)); |
0 | 2112 } |
2113 --v55; | |
2114 } | |
2115 } | |
2116 while ( v62 - 1 < v55 ); | |
2117 } | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
652
diff
changeset
|
2118 _50BAC8_screen_space_x[v55] = _50BAC8_screen_space_x[0]; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
652
diff
changeset
|
2119 _50B9D8_screen_space_y[v55] = _50B9D8_screen_space_y[0]; |
0 | 2120 } |
2121 return v55; | |
2122 } | |
2123 | |
2124 //----- (00424579) -------------------------------------------------------- | |
2125 int __fastcall sub_424579(int uFaceID, stru320 *a2) | |
2126 { | |
2127 __debugbreak(); | |
2128 return 0; | |
2129 /*BLVFace *v2; // eax@1 | |
2130 Vec3_short_ *v3; // ebx@1 | |
2131 Vec3_short_ *v4; // esi@1 | |
2132 unsigned int v5; // esi@3 | |
2133 int v7; // ST1C_4@5 | |
2134 int v8; // ST1C_4@5 | |
2135 int v9; // ST1C_4@5 | |
2136 int v10; // ST1C_4@5 | |
2137 int v11; // esi@5 | |
2138 int v12; // ST1C_4@5 | |
2139 unsigned int v15; // ecx@8 | |
2140 unsigned int v19; // ecx@13 | |
2141 signed int v20; // ecx@16 | |
2142 signed int result; // eax@20 | |
2143 signed int v24; // edx@22 | |
2144 unsigned int v25; // [sp+Ch] [bp-1Ch]@3 | |
2145 float v26; // [sp+14h] [bp-14h]@3 | |
2146 float v27; // [sp+1Ch] [bp-Ch]@3 | |
2147 float v28; // [sp+20h] [bp-8h]@3 | |
2148 signed int v29; // [sp+24h] [bp-4h]@3 | |
2149 | |
2150 v2 = &pIndoor->pFaces[uFaceID]; | |
2151 v3 = pIndoor->pVertices; | |
2152 v4 = &pIndoor->pVertices[*v2->pVertexIDs]; | |
2153 if ( v2->pFacePlane_old.vNormal.x * ((signed __int16)*(int *)&v4->x - pBLVRenderParams->vPartyPos.x) | |
2154 + v2->pFacePlane_old.vNormal.y * ((signed __int16)(*(int *)&v4->x >> 16) - pBLVRenderParams->vPartyPos.y) | |
2155 + v2->pFacePlane_old.vNormal.z * (v4->z - pBLVRenderParams->vPartyPos.z) < 0 ) | |
2156 { | |
2157 dword_50B700 = 1; | |
2158 } | |
2159 else | |
2160 { | |
2161 dword_50B700 = 0; | |
2162 if ( !(v2->uAttributes & 1) ) | |
2163 return 0; | |
2164 } | |
2165 v29 = 0; | |
2166 v5 = v2->uNumVertices; | |
2167 __asm { fld pBLVRenderParams->fCosineY } | |
2168 v28 = pBLVRenderParams->fSineY; | |
2169 v26 = pBLVRenderParams->fCosineNegX; | |
2170 v27 = pBLVRenderParams->fSineNegX; | |
2171 v25 = v5; | |
2172 if ( (signed int)v5 > 0 ) | |
2173 { | |
2174 _ECX = (char *)&array_50AC10[0].vWorldPosition.z; | |
2175 do | |
2176 { | |
2177 v7 = v3[v2->pVertexIDs[v29]].x; | |
2178 __asm | |
2179 { | |
2180 fild [ebp+var_10] | |
2181 fstp dword ptr [ecx-8] | |
2182 } | |
2183 v8 = v3[v2->pVertexIDs[v29]].y; | |
2184 __asm | |
2185 { | |
2186 fild [ebp+var_10] | |
2187 fstp dword ptr [ecx-4] | |
2188 } | |
2189 v9 = v3[v2->pVertexIDs[v29]].z; | |
2190 __asm | |
2191 { | |
2192 fild [ebp+var_10] | |
2193 fstp dword ptr [ecx] | |
2194 } | |
2195 _ECX += 48; | |
2196 v10 = a2->pDeltaUV[0] + v2->pVertexUIDs[v29]; | |
2197 __asm | |
2198 { | |
2199 fild [ebp+var_10] | |
2200 fstp dword ptr [ecx-14h] | |
2201 } | |
2202 v11 = a2->pDeltaUV[1] + v2->pVertexVIDs[v29++]; | |
2203 v12 = v11; | |
2204 v5 = v25; | |
2205 __asm | |
2206 { | |
2207 fild [ebp+var_10] | |
2208 fstp dword ptr [ecx-10h] | |
2209 } | |
2210 } | |
2211 while ( v29 < (signed int)v25 ); | |
2212 } | |
2213 _EDX = (char *)&array_50AC10[0].vWorldViewPosition; | |
2214 if ( pBLVRenderParams->sPartyRotX ) | |
2215 { | |
2216 if ( (signed int)v5 > 0 ) | |
2217 { | |
2218 __asm | |
2219 { | |
2220 fild pBLVRenderParams->vPartyPos.x | |
2221 fild pBLVRenderParams->vPartyPos.y | |
2222 fild pBLVRenderParams->vPartyPos.z | |
2223 } | |
2224 _EAX = (char *)&array_50AC10[0].vWorldPosition.z; | |
2225 v15 = v5; | |
2226 do | |
2227 { | |
2228 __asm | |
2229 { | |
2230 fld dword ptr [eax-8] | |
2231 fsub st, st(3) | |
2232 fld dword ptr [eax-4] | |
2233 fsub st, st(3) | |
2234 fld st(1) | |
2235 fmul st, st(6) | |
2236 fld st(1) | |
2237 fmul [ebp+var_8] | |
2238 fsubp st(1), st | |
2239 fstp [ebp+var_4] | |
2240 fld dword ptr [eax] | |
2241 fsub st, st(3) | |
2242 } | |
2243 _EAX += 48; | |
2244 --v15; | |
2245 __asm | |
2246 { | |
2247 fstp [ebp+var_10] | |
2248 fld [ebp+var_4] | |
2249 fmul [ebp+var_14] | |
2250 fld [ebp+var_10] | |
2251 fmul [ebp+var_C] | |
2252 fsubp st(1), st | |
2253 fstp dword ptr [eax-2Ch] | |
2254 fld st(1) | |
2255 fmul [ebp+var_8] | |
2256 fld st(1) | |
2257 fmul st, st(7) | |
2258 faddp st(1), st | |
2259 fstp dword ptr [eax-28h] | |
2260 fstp st | |
2261 fstp st | |
2262 fld [ebp+var_4] | |
2263 fmul [ebp+var_C] | |
2264 fld [ebp+var_10] | |
2265 fmul [ebp+var_14] | |
2266 faddp st(1), st | |
2267 fstp dword ptr [eax-24h] | |
2268 } | |
2269 } | |
2270 while ( v15 ); | |
2271 LABEL_15: | |
2272 __asm | |
2273 { | |
2274 fstp st | |
2275 fstp st | |
2276 fstp st | |
2277 } | |
2278 goto LABEL_16; | |
2279 } | |
2280 } | |
2281 else | |
2282 { | |
2283 if ( (signed int)v5 > 0 ) | |
2284 { | |
2285 __asm | |
2286 { | |
2287 fild pBLVRenderParams->vPartyPos.x | |
2288 fild pBLVRenderParams->vPartyPos.y | |
2289 fild pBLVRenderParams->vPartyPos.z | |
2290 } | |
2291 _EAX = (char *)&array_50AC10[0].vWorldViewPosition; | |
2292 v19 = v5; | |
2293 do | |
2294 { | |
2295 __asm | |
2296 { | |
2297 fld dword ptr [eax-0Ch] | |
2298 fsub st, st(3) | |
2299 fld dword ptr [eax-8] | |
2300 fsub st, st(3) | |
2301 fld st(1) | |
2302 fmul st, st(6) | |
2303 fld st(1) | |
2304 fmul [ebp+var_8] | |
2305 fsubp st(1), st | |
2306 fstp dword ptr [eax] | |
2307 fld st(1) | |
2308 fmul [ebp+var_8] | |
2309 fld st(1) | |
2310 fmul st, st(7) | |
2311 } | |
2312 _EAX += 48; | |
2313 --v19; | |
2314 __asm | |
2315 { | |
2316 faddp st(1), st | |
2317 fstp dword ptr [eax-2Ch] | |
2318 fstp st | |
2319 fstp st | |
2320 fld dword ptr [eax-34h] | |
2321 fsub st, st(1) | |
2322 fstp dword ptr [eax-28h] | |
2323 } | |
2324 } | |
2325 while ( v19 ); | |
2326 goto LABEL_15; | |
2327 } | |
2328 } | |
2329 LABEL_16: | |
2330 v20 = 0; | |
2331 __asm { fstp st } | |
2332 if ( (signed int)v5 <= 0 ) | |
2333 return 0; | |
2334 do | |
2335 { | |
2336 __asm | |
2337 { | |
2338 fld dword ptr [edx] | |
2339 fcomp ds:flt_4D8524 | |
2340 fnstsw ax | |
2341 } | |
2342 if ( !(HIBYTE(_AX) & 1) ) | |
2343 break; | |
2344 ++v20; | |
2345 _EDX += 48; | |
2346 } | |
2347 while ( v20 < (signed int)v5 ); | |
2348 if ( v20 >= (signed int)v5 ) | |
2349 return 0; | |
2350 result = sr_424CD7(v5); | |
2351 if ( result > 0 ) | |
2352 { | |
2353 __asm { fild pBLVRenderParams->field_40 } | |
2354 _ECX = (char *)&array_507D30[0].vWorldViewPosition; | |
2355 v24 = result; | |
2356 __asm | |
2357 { | |
2358 fmul ds:flt_4D84A4 | |
2359 fild pBLVRenderParams->uViewportCenterX | |
2360 fild pBLVRenderParams->uViewportCenterY | |
2361 } | |
2362 do | |
2363 { | |
2364 __asm | |
2365 { | |
2366 fld1 | |
2367 fdiv dword ptr [ecx] | |
2368 } | |
2369 _ECX += 48; | |
2370 --v24; | |
2371 __asm | |
2372 { | |
2373 fld st | |
2374 fmul dword ptr [ecx-2Ch] | |
2375 fmul st, st(4) | |
2376 fsubr st, st(3) | |
2377 fstp dword ptr [ecx-24h] | |
2378 fmul dword ptr [ecx-28h] | |
2379 fmul st, st(3) | |
2380 fsubr st, st(1) | |
2381 fstp dword ptr [ecx-20h] | |
2382 } | |
2383 } | |
2384 while ( v24 ); | |
2385 __asm | |
2386 { | |
2387 fstp st | |
2388 fstp st | |
2389 fstp st | |
2390 } | |
2391 } | |
2392 memcpy(&array_507D30[result], array_507D30, sizeof(array_507D30[result])); | |
2393 return result;*/ | |
2394 } | |
2395 | |
2396 //----- (00424829) -------------------------------------------------------- | |
2397 bool sub_424829(int a1, BspRenderer_stru2 *a2, BspRenderer_stru2 *a3, int a4) | |
2398 { | |
2399 int v4; // edi@1 | |
2400 BspRenderer_stru2 *v5; // ebx@1 | |
2401 int v6; // eax@3 | |
2402 int v7; // esi@5 | |
2403 int v8; // edx@5 | |
2404 int v9; // ecx@6 | |
2405 int v10; // eax@12 | |
2406 int v11; // edi@13 | |
2407 int v12; // edx@18 | |
2408 int v13; // eax@22 | |
2409 int v14; // edi@28 | |
2410 int v15; // ecx@29 | |
2411 int v16; // edi@30 | |
2412 int v17; // edx@35 | |
2413 int v18; // eax@39 | |
2414 int v19; // eax@44 | |
2415 int v20; // ecx@44 | |
2416 int v21; // edi@45 | |
2417 int v22; // edi@46 | |
2418 __int16 *v23; // ecx@47 | |
2419 int v24; // edx@48 | |
2420 int v25; // eax@50 | |
2421 int v26; // eax@55 | |
2422 signed int v27; // edi@55 | |
2423 int v28; // edx@56 | |
2424 int v29; // edx@57 | |
2425 int v30; // eax@59 | |
2426 int v31; // eax@64 | |
2427 signed int v32; // edi@64 | |
2428 int v33; // edx@65 | |
2429 __int16 *v34; // eax@66 | |
2430 __int16 v35; // dx@66 | |
2431 __int16 v36; // dx@67 | |
2432 __int16 v37; // di@67 | |
2433 __int16 v38; // dx@67 | |
2434 BspRenderer_stru2 *v39; // ecx@69 | |
2435 int v40; // edx@69 | |
2436 int v41; // edi@70 | |
2437 __int16 *v42; // eax@76 | |
2438 __int16 *v43; // eax@81 | |
2439 __int16 *v45; // eax@87 | |
2440 int v46; // edx@87 | |
2441 __int16 v47; // cx@88 | |
2442 int v48; // eax@93 | |
2443 int v49; // esi@93 | |
2444 __int16 *v50; // ecx@94 | |
2445 int v51; // eax@95 | |
2446 int v52; // eax@97 | |
2447 int v53; // [sp+Ch] [bp-34h]@44 | |
2448 int v54; // [sp+10h] [bp-30h]@0 | |
2449 int v55; // [sp+14h] [bp-2Ch]@12 | |
2450 __int16 *v56; // [sp+14h] [bp-2Ch]@47 | |
2451 __int16 *v57; // [sp+14h] [bp-2Ch]@76 | |
2452 __int16 *v58; // [sp+14h] [bp-2Ch]@81 | |
2453 __int16 *v59; // [sp+14h] [bp-2Ch]@87 | |
2454 BspRenderer_stru2 *v60; // [sp+18h] [bp-28h]@1 | |
2455 int v61; // [sp+1Ch] [bp-24h]@29 | |
2456 int v62; // [sp+20h] [bp-20h]@0 | |
2457 signed int v63; // [sp+24h] [bp-1Ch]@3 | |
2458 signed int v64; // [sp+28h] [bp-18h]@3 | |
2459 int v65; // [sp+2Ch] [bp-14h]@5 | |
2460 int v66; // [sp+2Ch] [bp-14h]@39 | |
2461 int v67; // [sp+30h] [bp-10h]@22 | |
2462 int v68; // [sp+34h] [bp-Ch]@12 | |
2463 int v69; // [sp+34h] [bp-Ch]@29 | |
2464 int v70; // [sp+34h] [bp-Ch]@46 | |
2465 int v71; // [sp+34h] [bp-Ch]@75 | |
2466 int v72; // [sp+34h] [bp-Ch]@80 | |
2467 int v73; // [sp+38h] [bp-8h]@11 | |
2468 int v74; // [sp+3Ch] [bp-4h]@1 | |
2469 int a3a; // [sp+48h] [bp+8h]@76 | |
2470 int a3b; // [sp+48h] [bp+8h]@87 | |
2471 | |
2472 v4 = a1; | |
2473 v5 = a2; | |
2474 v74 = a1; | |
2475 v60 = a2; | |
2476 if ( !a1 | |
2477 || (!dword_50B700 ? (v64 = -1, v6 = 1, v63 = 1) : (v6 = 1, v63 = -1, v64 = 1), | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
652
diff
changeset
|
2478 v7 = _50B9D8_screen_space_y[0], |
0 | 2479 v65 = 0, |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
652
diff
changeset
|
2480 v8 = _50B9D8_screen_space_y[0], |
0 | 2481 a1 <= v6) ) |
2482 return 0; | |
2483 do | |
2484 { | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
652
diff
changeset
|
2485 v9 = _50B9D8_screen_space_y[v6]; |
0 | 2486 if ( v9 >= v7 ) |
2487 { | |
2488 if ( v9 > v8 ) | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
652
diff
changeset
|
2489 v8 = _50B9D8_screen_space_y[v6]; |
0 | 2490 } |
2491 else | |
2492 { | |
2493 v65 = v6; | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
652
diff
changeset
|
2494 v7 = _50B9D8_screen_space_y[v6]; |
0 | 2495 } |
2496 ++v6; | |
2497 } | |
2498 while ( v6 < v4 ); | |
2499 v73 = v8; | |
2500 if ( v8 == v7 ) | |
2501 return 0; | |
2502 v10 = v65; | |
2503 v68 = 0; | |
2504 v5->_viewport_space_y = v7; | |
2505 v5->_viewport_space_w = v8; | |
2506 v55 = v65; | |
2507 if ( v4 > 0 ) | |
2508 { | |
2509 v11 = v65; | |
2510 do | |
2511 { | |
2512 v10 += v64; | |
2513 if ( v10 < v74 ) | |
2514 { | |
2515 if ( v10 < 0 ) | |
2516 v10 += v74; | |
2517 } | |
2518 else | |
2519 { | |
2520 v10 -= v74; | |
2521 } | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
652
diff
changeset
|
2522 v12 = _50B9D8_screen_space_y[v10]; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
652
diff
changeset
|
2523 if ( v12 <= _50B9D8_screen_space_y[v11] ) |
0 | 2524 { |
2525 v55 = v10; | |
2526 v11 = v10; | |
2527 } | |
2528 if ( v12 == v73 ) | |
2529 break; | |
2530 ++v68; | |
2531 } | |
2532 while ( v68 < v74 ); | |
2533 } | |
2534 v13 = v55 + v64; | |
2535 v67 = v55 + v64; | |
2536 if ( v55 + v64 < v74 ) | |
2537 { | |
2538 if ( v13 >= 0 ) | |
2539 goto LABEL_27; | |
2540 v13 += v74; | |
2541 } | |
2542 else | |
2543 { | |
2544 v13 -= v74; | |
2545 } | |
2546 v67 = v13; | |
2547 LABEL_27: | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
652
diff
changeset
|
2548 if ( _50B9D8_screen_space_y[v13] != _50B9D8_screen_space_y[v55] ) |
0 | 2549 { |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
652
diff
changeset
|
2550 v14 = _50BAC8_screen_space_x[v55]; |
0 | 2551 v62 = v14 << 16; |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
652
diff
changeset
|
2552 v54 = ((_50BAC8_screen_space_x[v13] - v14) << 16) / (_50B9D8_screen_space_y[v13] - _50B9D8_screen_space_y[v55]); |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
652
diff
changeset
|
2553 v5->array_18[v7] = LOWORD(_50BAC8_screen_space_x[v55]); |
0 | 2554 } |
2555 v15 = v65; | |
2556 v69 = 0; | |
2557 v61 = v65; | |
2558 if ( v74 > 0 ) | |
2559 { | |
2560 v16 = v65; | |
2561 do | |
2562 { | |
2563 v15 += v63; | |
2564 if ( v15 < v74 ) | |
2565 { | |
2566 if ( v15 < 0 ) | |
2567 v15 += v74; | |
2568 } | |
2569 else | |
2570 { | |
2571 v15 -= v74; | |
2572 } | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
652
diff
changeset
|
2573 v17 = _50B9D8_screen_space_y[v15]; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
652
diff
changeset
|
2574 if ( v17 <= _50B9D8_screen_space_y[v16] ) |
0 | 2575 { |
2576 v61 = v15; | |
2577 v16 = v15; | |
2578 } | |
2579 if ( v17 == v73 ) | |
2580 break; | |
2581 ++v69; | |
2582 } | |
2583 while ( v69 < v74 ); | |
2584 } | |
2585 v18 = v63 + v61; | |
2586 v66 = v63 + v61; | |
2587 if ( v63 + v61 < v74 ) | |
2588 { | |
2589 if ( v18 >= 0 ) | |
2590 goto LABEL_44; | |
2591 v18 += v74; | |
2592 } | |
2593 else | |
2594 { | |
2595 v18 -= v74; | |
2596 } | |
2597 v66 = v18; | |
2598 LABEL_44: | |
2599 v19 = v18; | |
2600 v20 = v61; | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
652
diff
changeset
|
2601 v53 = _50B9D8_screen_space_y[v19] - _50B9D8_screen_space_y[v61]; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
652
diff
changeset
|
2602 if ( _50B9D8_screen_space_y[v19] != _50B9D8_screen_space_y[v61] ) |
0 | 2603 { |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
652
diff
changeset
|
2604 v21 = _50BAC8_screen_space_x[v20]; |
0 | 2605 v5 = v60; |
2606 v61 = v21 << 16; | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
652
diff
changeset
|
2607 v53 = ((_50BAC8_screen_space_x[v19] - v21) << 16) / v53; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
652
diff
changeset
|
2608 v60->array_3D8[v73] = LOWORD(_50BAC8_screen_space_x[v20]); |
0 | 2609 } |
2610 v22 = v7; | |
2611 v70 = v7; | |
2612 if ( v7 <= v73 ) | |
2613 { | |
2614 v56 = &v5->array_3D8[v7]; | |
2615 v23 = &v5->array_18[v7]; | |
2616 do | |
2617 { | |
2618 v24 = v67; | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
652
diff
changeset
|
2619 if ( v22 < _50B9D8_screen_space_y[v67] || v22 == v73 ) |
0 | 2620 goto LABEL_57; |
2621 v25 = v64 + v67; | |
2622 v67 = v25; | |
2623 if ( v25 < v74 ) | |
2624 { | |
2625 if ( v25 >= 0 ) | |
2626 goto LABEL_55; | |
2627 v25 += v74; | |
2628 } | |
2629 else | |
2630 { | |
2631 v25 -= v74; | |
2632 } | |
2633 v67 = v25; | |
2634 LABEL_55: | |
2635 v26 = v25; | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
652
diff
changeset
|
2636 v27 = _50B9D8_screen_space_y[v26] - _50B9D8_screen_space_y[v24]; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
652
diff
changeset
|
2637 if ( _50B9D8_screen_space_y[v26] - _50B9D8_screen_space_y[v24] > 0 ) |
0 | 2638 { |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
652
diff
changeset
|
2639 v28 = _50BAC8_screen_space_x[v24]; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
652
diff
changeset
|
2640 v54 = ((_50BAC8_screen_space_x[v26] - v28) << 16) / v27; |
0 | 2641 v62 = v28 << 16; |
2642 } | |
2643 LABEL_57: | |
2644 v29 = v66; | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
652
diff
changeset
|
2645 if ( v70 >= _50B9D8_screen_space_y[v66] && v70 != v73 ) |
0 | 2646 { |
2647 v30 = v63 + v66; | |
2648 v66 += v63; | |
2649 if ( v66 >= v74 ) | |
2650 { | |
2651 v30 -= v74; | |
2652 goto LABEL_63; | |
2653 } | |
2654 if ( v30 < 0 ) | |
2655 { | |
2656 v30 += v74; | |
2657 LABEL_63: | |
2658 v66 = v30; | |
2659 } | |
2660 v31 = v30; | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
652
diff
changeset
|
2661 v32 = _50B9D8_screen_space_y[v31] - _50B9D8_screen_space_y[v29]; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
652
diff
changeset
|
2662 if ( _50B9D8_screen_space_y[v31] - _50B9D8_screen_space_y[v29] > 0 ) |
0 | 2663 { |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
652
diff
changeset
|
2664 v33 = _50BAC8_screen_space_x[v29]; |
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
652
diff
changeset
|
2665 v53 = ((_50BAC8_screen_space_x[v31] - v33) << 16) / v32; |
0 | 2666 v61 = v33 << 16; |
2667 } | |
2668 } | |
2669 *(__int16 *)((char *)v56 + (int)(char *)v5->array_18 - (char *)v5->array_3D8) = HIWORD(v62); | |
2670 *v56 = HIWORD(v61); | |
2671 v34 = v23 + 480; | |
2672 v35 = v23[480]; | |
2673 if ( *v23 > v35 ) | |
2674 { | |
2675 v36 = *v23 ^ v35; | |
2676 v37 = *v34; | |
2677 *v23 = v36; | |
2678 v38 = v37 ^ v36; | |
2679 *v23 ^= v38; | |
2680 *v34 = v38; | |
2681 } | |
2682 ++v56; | |
2683 v62 += v54; | |
2684 v22 = v70 + 1; | |
2685 v61 += v53; | |
2686 ++v23; | |
2687 ++v70; | |
2688 } | |
2689 while ( v70 <= v73 ); | |
2690 } | |
2691 v39 = a3; | |
2692 v40 = v73; | |
2693 if ( v73 < a3->_viewport_space_y || (v41 = a3->_viewport_space_w, v7 > v41) ) | |
2694 return 0; | |
2695 if ( v7 < a3->_viewport_space_y ) | |
2696 v7 = a3->_viewport_space_y; | |
2697 if ( v73 > v41 ) | |
2698 { | |
2699 v40 = a3->_viewport_space_w; | |
2700 v73 = a3->_viewport_space_w; | |
2701 } | |
2702 v71 = v7; | |
2703 if ( v7 <= v40 ) | |
2704 { | |
2705 a3a = (char *)v5 - (char *)a3; | |
2706 v57 = &v5->array_18[v7]; | |
2707 v42 = &v39->array_3D8[v7]; | |
2708 do | |
2709 { | |
2710 if ( *(__int16 *)((char *)v42 + a3a) >= *(v42 - 480) && *v57 <= *v42 ) | |
2711 break; | |
2712 ++v57; | |
2713 ++v7; | |
2714 ++v71; | |
2715 ++v42; | |
2716 } | |
2717 while ( v71 <= v40 ); | |
2718 } | |
2719 v72 = v40; | |
2720 if ( v40 < v7 ) | |
2721 return 0; | |
2722 v58 = &v5->array_18[v40]; | |
2723 v43 = &v39->array_3D8[v40]; | |
2724 do | |
2725 { | |
2726 if ( *(__int16 *)((char *)v43 + (int)(char *)v5 - (char *)v39) >= *(v43 - 480) && *v58 <= *v43 ) | |
2727 break; | |
2728 --v58; | |
2729 --v40; | |
2730 --v72; | |
2731 --v43; | |
2732 v73 = v40; | |
2733 } | |
2734 while ( v72 >= v7 ); | |
2735 if ( v7 >= v40 ) | |
2736 return 0; | |
2737 a3b = (char *)v39 - (char *)v5; | |
2738 v59 = &v39->array_3D8[v7]; | |
2739 v45 = &v5->array_18[v7]; | |
2740 v46 = v73 - v7 + 1; | |
2741 do | |
2742 { | |
2743 v47 = *(__int16 *)((char *)v45 + a3b); | |
2744 if ( *v45 < v47 ) | |
2745 *v45 = v47; | |
2746 if ( v45[480] > *v59 ) | |
2747 v45[480] = *v59; | |
2748 ++v59; | |
2749 ++v45; | |
2750 --v46; | |
2751 } | |
2752 while ( v46 ); | |
2753 v5->_viewport_space_y = v7; | |
2754 v5->_viewport_space_w = v73; | |
2755 v5->field_8 = v5->array_18[v7]; | |
2756 v48 = v5->array_3D8[v7]; | |
2757 v5->field_10 = v7; | |
2758 v5->field_14 = v7; | |
2759 v49 = v7 + 1; | |
2760 v5->field_C = v48; | |
2761 if ( v49 <= v73 ) | |
2762 { | |
2763 v50 = &v5->array_3D8[v49]; | |
2764 do | |
2765 { | |
2766 v51 = *(v50 - 480); | |
2767 if ( v51 < v5->field_8 ) | |
2768 { | |
2769 v5->field_8 = v51; | |
2770 v5->field_10 = v49; | |
2771 } | |
2772 v52 = *v50; | |
2773 if ( v52 > v5->field_C ) | |
2774 { | |
2775 v5->field_C = v52; | |
2776 v5->field_14 = v49; | |
2777 } | |
2778 ++v49; | |
2779 ++v50; | |
2780 } | |
2781 while ( v49 <= v73 ); | |
2782 } | |
2783 return 1; | |
2784 } | |
2785 // 50B700: using guessed type int dword_50B700; | |
2786 | |
2787 //----- (00424CD7) -------------------------------------------------------- | |
2788 signed int __fastcall sr_424CD7(unsigned int uVertexID) | |
2789 { | |
2790 unsigned int v1; // edx@1 | |
2791 signed int v2; // edi@1 | |
2792 char *v3; // esi@4 | |
2793 char *v4; // ecx@4 | |
2794 unsigned int v5; // eax@4 | |
2795 char *v6; // edx@4 | |
2796 double v7; // st6@10 | |
2797 double v8; // st5@10 | |
2798 double v9; // st6@11 | |
2799 unsigned __int8 v10; // c2@15 | |
2800 unsigned __int8 v11; // c3@15 | |
2801 RenderVertexSoft *v12; // edi@22 | |
2802 char *v13; // eax@22 | |
2803 double v14; // st6@22 | |
2804 signed int result; // eax@24 | |
2805 unsigned int v16; // [sp+8h] [bp-28h]@4 | |
2806 bool v17; // [sp+Ch] [bp-24h]@6 | |
2807 char *v18; // [sp+10h] [bp-20h]@4 | |
2808 char *v19; // [sp+14h] [bp-1Ch]@4 | |
2809 signed int v20; // [sp+18h] [bp-18h]@1 | |
2810 RenderVertexSoft *v21; // [sp+1Ch] [bp-14h]@4 | |
2811 char *v22; // [sp+20h] [bp-10h]@4 | |
2812 char *v23; // [sp+24h] [bp-Ch]@4 | |
2813 char *v24; // [sp+28h] [bp-8h]@4 | |
2814 char *v25; // [sp+2Ch] [bp-4h]@4 | |
2815 | |
2816 v1 = uVertexID; | |
2817 memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID])); | |
2818 v2 = 0; | |
2819 v20 = 0; | |
2820 if ( array_50AC10[0].vWorldViewPosition.x >= 8.0 ) | |
2821 v2 = 1; | |
2822 if ( (signed int)(uVertexID + 1) <= 1 ) | |
2823 return 0; | |
2824 v3 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
2825 v4 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
2826 v5 = v1; | |
168 | 2827 v23 = (char *)&array_507D30[0]._rhw; |
0 | 2828 v21 = array_507D30; |
2829 v18 = (char *)&array_507D30[0].vWorldViewPosition.z; | |
2830 v19 = (char *)&array_507D30[0].vWorldViewPosition.y; | |
2831 v22 = (char *)&array_507D30[0].vWorldViewPosition; | |
2832 v24 = (char *)&array_507D30[0].v; | |
2833 v25 = (char *)&array_507D30[0].u; | |
2834 v6 = (char *)&array_50AC10[0].v; | |
2835 v16 = v5; | |
2836 do | |
2837 { | |
2838 v17 = *((float *)v6 + 5) >= 8.0; | |
2839 if ( v2 != v17 ) | |
2840 { | |
2841 if ( v17 ) | |
2842 { | |
2843 v7 = (8.0 - *((float *)v6 - 7)) / (*((float *)v6 + 5) - *((float *)v6 - 7)); | |
2844 *(float *)v4 = (*((float *)v6 + 6) - *((float *)v6 - 6)) * v7 + *((float *)v6 - 6); | |
2845 *(float *)v3 = (*((float *)v6 + 7) - *((float *)v6 - 5)) * v7 + *((float *)v6 - 5); | |
2846 *(float *)v25 = (*((float *)v6 + 11) - *((float *)v6 - 1)) * v7 + *((float *)v6 - 1); | |
2847 v8 = (*((float *)v6 + 12) - *(float *)v6) * v7 + *(float *)v6; | |
2848 } | |
2849 else | |
2850 { | |
2851 v9 = (8.0 - *((float *)v6 + 5)) / (*((float *)v6 - 7) - *((float *)v6 + 5)); | |
2852 *(float *)v4 = (*((float *)v6 - 6) - *((float *)v6 + 6)) * v9 + *((float *)v6 + 6); | |
2853 *(float *)v3 = (*((float *)v6 - 5) - *((float *)v6 + 7)) * v9 + *((float *)v6 + 7); | |
2854 *(float *)v25 = (*((float *)v6 - 1) - *((float *)v6 + 11)) * v9 + *((float *)v6 + 11); | |
2855 v8 = (*(float *)v6 - *((float *)v6 + 12)) * v9 + *((float *)v6 + 12); | |
2856 } | |
2857 *(float *)v24 = v8; | |
2858 *(float *)v22 = 8.0; | |
2859 *(int *)v23 = 0x3E000000u; | |
2860 if ( v2 ) | |
2861 { | |
2862 if ( 8.0 == *((float *)v6 - 7) && *(float *)v4 == *((float *)v6 - 6) ) | |
2863 { | |
2864 v10 = 0; | |
2865 v11 = *(float *)v3 == *((float *)v6 - 5); | |
2866 goto LABEL_19; | |
2867 } | |
2868 } | |
2869 else | |
2870 { | |
2871 if ( 8.0 == *((float *)v6 + 5) && *(float *)v4 == *((float *)v6 + 6) ) | |
2872 { | |
2873 v10 = 0; | |
2874 v11 = *(float *)v3 == *((float *)v6 + 7); | |
2875 LABEL_19: | |
2876 if ( v11 | v10 ) | |
2877 goto LABEL_21; | |
2878 goto LABEL_20; | |
2879 } | |
2880 } | |
2881 LABEL_20: | |
2882 ++v21; | |
2883 v22 += 48; | |
2884 v24 += 48; | |
2885 v25 += 48; | |
2886 v4 += 48; | |
2887 v3 += 48; | |
2888 ++v20; | |
2889 v23 += 48; | |
2890 v19 = v4; | |
2891 v18 = v3; | |
2892 } | |
2893 LABEL_21: | |
2894 if ( v17 ) | |
2895 { | |
2896 v12 = v21; | |
2897 v13 = v23; | |
2898 v19 += 48; | |
2899 v18 += 48; | |
2900 v14 = 1.0 / (*((float *)v6 + 5) + 0.0000001); | |
2901 ++v20; | |
2902 v25 += 48; | |
2903 v24 += 48; | |
2904 v22 += 48; | |
2905 ++v21; | |
2906 v23 += 48; | |
2907 memcpy(v12, v6 + 8, 0x30u); | |
2908 v4 = v19; | |
2909 v3 = v18; | |
2910 *(float *)v13 = v14; | |
2911 } | |
2912 v2 = v17; | |
2913 v6 += 48; | |
2914 --v16; | |
2915 } | |
2916 while ( v16 ); | |
2917 result = v20; | |
2918 if ( v20 < 3 ) | |
2919 return 0; | |
2920 return result; | |
2921 } |