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