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