0
|
1 #include "IndoorCameraD3D.h"
|
|
2 #include "VectorTypes.h"
|
|
3 #include "Game.h"
|
|
4 #include "Indoor.h"
|
|
5 #include "Viewport.h"
|
|
6 #include "IndoorCamera.h"
|
|
7 #include "OutdoorCamera.h"
|
|
8 #include "Render.h"
|
|
9 #include "LOD.h"
|
|
10
|
|
11 #include "mm7_data.h"
|
|
12
|
|
13
|
|
14
|
|
15 //----- (004364C5) --------------------------------------------------------
|
|
16 void IndoorCameraD3D::_4364C5(RenderVertexSoft *pVertices, unsigned int uNumVertices, RenderVertexSoft *a1, stru320 *a5)
|
|
17 {
|
|
18 unsigned int v5; // ebx@1
|
|
19 char *v6; // edx@2
|
|
20 char *v7; // eax@2
|
|
21
|
|
22 v5 = uNumVertices;
|
|
23 if ( (signed int)uNumVertices > 0 )
|
|
24 {
|
|
25 v6 = (char *)&a1->vWorldPosition.z;
|
|
26 v7 = (char *)&pVertices->vWorldPosition.z;
|
|
27 do
|
|
28 {
|
|
29 *((int *)v6 - 2) = *((int *)v7 - 2);
|
|
30 *((int *)v6 - 1) = *((int *)v7 - 1);
|
|
31 *(int *)v6 = *(int *)v7;
|
|
32 v7 += 48;
|
|
33 v6 += 48;
|
|
34 --v5;
|
|
35 *((float *)v6 - 5) = (double)a5->pDeltaUV[0] + *((float *)v7 - 5);
|
|
36 *((float *)v6 - 4) = (double)a5->pDeltaUV[1] + *((float *)v7 - 4);
|
|
37 }
|
|
38 while ( v5 );
|
|
39 }
|
|
40 ViewTransform(a1, uNumVertices);
|
|
41 }
|
|
42
|
|
43 //----- (0043669D) --------------------------------------------------------
|
|
44 char IndoorCameraD3D::ApplyViewTransform_TrueIfStillVisible(int x, int y, int z, signed int *pOutX, int *pOutZ, int *pOutY, char bDoNotShow)
|
|
45 {
|
|
46 int to_z; // esi@2
|
|
47 int v9; // ecx@3
|
|
48 signed int *v10; // esi@5
|
|
49 int pOutY_; // ecx@5
|
|
50 signed int v12; // esi@7
|
|
51 int v14; // [sp+8h] [bp-4h]@3
|
|
52 int to_x; // [sp+14h] [bp+8h]@1
|
|
53 int to_y; // [sp+18h] [bp+Ch]@1
|
|
54 int a2b; // [sp+18h] [bp+Ch]@5
|
|
55 int a3a; // [sp+1Ch] [bp+10h]@5
|
|
56
|
|
57 to_x = (x - pBLVRenderParams->vPartyPos.x) << 16;
|
|
58 to_y = (y - pBLVRenderParams->vPartyPos.y) << 16;
|
|
59 if ( pBLVRenderParams->sPartyRotX )
|
|
60 {
|
|
61 to_z = (z - pBLVRenderParams->vPartyPos.z) << 16;
|
|
62 if ( pRenderer->pRenderD3D )
|
|
63 {
|
|
64 v14 = ((unsigned __int64)(to_x * (signed __int64)pBLVRenderParams->sCosineY) >> 16)
|
|
65 + ((unsigned __int64)(to_y * (signed __int64)pBLVRenderParams->sSineY) >> 16);
|
|
66 v9 = ((unsigned __int64)(to_x * (signed __int64)pBLVRenderParams->sSineY) >> 16)
|
|
67 - ((unsigned __int64)(to_y * (signed __int64)pBLVRenderParams->sCosineY) >> 16);
|
|
68 }
|
|
69 else
|
|
70 {
|
|
71 v14 = ((unsigned __int64)(to_x * (signed __int64)pBLVRenderParams->sCosineY) >> 16)
|
|
72 - ((unsigned __int64)(to_y * (signed __int64)pBLVRenderParams->sSineY) >> 16);
|
|
73 v9 = ((unsigned __int64)(to_x * (signed __int64)pBLVRenderParams->sSineY) >> 16)
|
|
74 + ((unsigned __int64)(to_y * (signed __int64)pBLVRenderParams->sCosineY) >> 16);
|
|
75 }
|
|
76 a3a = (z - pBLVRenderParams->vPartyPos.z) << 16;
|
|
77 a2b = (unsigned __int64)(to_z * (signed __int64)pBLVRenderParams->sSineNegX) >> 16;
|
|
78 v10 = pOutX;
|
|
79 *pOutX = ((unsigned __int64)(v14 * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - a2b;
|
|
80 *pOutZ = v9;
|
|
81 pOutY_ = ((unsigned __int64)(v14 * (signed __int64)pBLVRenderParams->sSineNegX) >> 16)
|
|
82 + ((unsigned __int64)(a3a * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16);
|
|
83 }
|
|
84 else
|
|
85 {
|
|
86 pOutY_ = (z - pBLVRenderParams->vPartyPos.z) << 16;
|
|
87 if ( pRenderer->pRenderD3D )
|
|
88 {
|
|
89 v10 = pOutX;
|
|
90 *pOutX = ((unsigned __int64)(to_x * (signed __int64)pBLVRenderParams->sCosineY) >> 16)
|
|
91 + ((unsigned __int64)(to_y * (signed __int64)pBLVRenderParams->sSineY) >> 16);
|
|
92 *pOutZ = ((unsigned __int64)(to_x * (signed __int64)pBLVRenderParams->sSineY) >> 16)
|
|
93 - ((unsigned __int64)(to_y * (signed __int64)pBLVRenderParams->sCosineY) >> 16);
|
|
94 }
|
|
95 else
|
|
96 {
|
|
97 v10 = pOutX;
|
|
98 *pOutX = ((unsigned __int64)(to_x * (signed __int64)pBLVRenderParams->sCosineY) >> 16)
|
|
99 - ((unsigned __int64)(to_y * (signed __int64)pBLVRenderParams->sSineY) >> 16);
|
|
100 *pOutZ = ((unsigned __int64)(to_x * (signed __int64)pBLVRenderParams->sSineY) >> 16)
|
|
101 + ((unsigned __int64)(to_y * (signed __int64)pBLVRenderParams->sCosineY) >> 16);
|
|
102 }
|
|
103 }
|
|
104 *pOutY = pOutY_;
|
|
105 return !bDoNotShow || (v12 = *v10, v12 >= (signed int)0x40000u) && v12 <= (signed int)0x1F400000u;
|
|
106 }
|
|
107
|
|
108
|
|
109
|
|
110 //----- (00436455) --------------------------------------------------------
|
|
111 bool IndoorCameraD3D::IsFaceFacedTowardsCamera(BLVFace *pFace)
|
|
112 {
|
|
113 IndoorCameraD3D *v2; // edi@1
|
|
114 bool result; // eax@1
|
|
115 RenderVertexSoft v; // [sp+8h] [bp-30h]@1
|
|
116
|
|
117 v2 = this;
|
|
118 Vec3_short__to_RenderVertexSoft(&v, &pIndoor->pVertices[*pFace->pVertexIDs]);
|
|
119 LOBYTE(result) = is_vertex_with_normal_from_face_towards_camera(pFace, &v);
|
|
120 return result;
|
|
121 }
|
|
122
|
|
123 //----- (00436523) --------------------------------------------------------
|
|
124 void IndoorCameraD3D::ViewTransform(RenderVertexSoft *a1a, unsigned int uNumVertices)
|
|
125 {
|
|
126 __debugbreak();
|
|
127 /*
|
|
128 unsigned int v3; // esi@4
|
|
129 unsigned int v4; // ecx@7
|
|
130 float v7; // [sp+4h] [bp-4h]@7
|
|
131
|
|
132 auto a1 = this;
|
|
133 if ( byte_4D864C && pGame->uFlags & 0x80 || uCurrentlyLoadedLevelType == LEVEL_Indoor)
|
|
134 {
|
|
135 __asm
|
|
136 {
|
|
137 fld pIndoorCamera->fRotationYCosine
|
|
138 fld pIndoorCamera->fRotationYSine
|
|
139 fld pIndoorCamera->fRotationXCosine
|
|
140 }
|
|
141 v4 = uNumVertices;
|
|
142 v7 = pIndoorCamera->fRotationXSine;
|
|
143 if ( pIndoorCamera->sRotationX )
|
|
144 {
|
|
145 if ( (signed int)uNumVertices > 0 )
|
|
146 {
|
|
147 _EAX = a1a;
|
|
148 do
|
|
149 {
|
|
150 __asm
|
|
151 {
|
|
152 fild pIndoorCamera->pos.x
|
|
153 fsubr dword ptr [eax]
|
|
154 fstp [ebp+a1]
|
|
155 fild pIndoorCamera->pos.y
|
|
156 fsubr dword ptr [eax+4]
|
|
157 fstp [ebp+uNumVertices]
|
|
158 fild pIndoorCamera->pos.z
|
|
159 fsubr dword ptr [eax+8]
|
|
160 }
|
|
161 if ( pRenderer->pRenderD3D )
|
|
162 {
|
|
163 __asm
|
|
164 {
|
|
165 fld [ebp+uNumVertices]
|
|
166 fmul st, st(3)
|
|
167 fld [ebp+a1]
|
|
168 fmul st, st(5)
|
|
169 faddp st(1), st
|
|
170 fld [ebp+a1]
|
|
171 fmul st, st(4)
|
|
172 fld [ebp+uNumVertices]
|
|
173 fmul st, st(6)
|
|
174 fsubp st(1), st
|
|
175 }
|
|
176 }
|
|
177 else
|
|
178 {
|
|
179 __asm
|
|
180 {
|
|
181 fld [ebp+a1]
|
|
182 fmul st, st(4)
|
|
183 fld [ebp+uNumVertices]
|
|
184 fmul st, st(4)
|
|
185 fsubp st(1), st
|
|
186 fld [ebp+a1]
|
|
187 fmul st, st(4)
|
|
188 fld [ebp+uNumVertices]
|
|
189 fmul st, st(6)
|
|
190 faddp st(1), st
|
|
191 }
|
|
192 }
|
|
193 __asm
|
|
194 {
|
|
195 fld st(1)
|
|
196 fmul st, st(4)
|
|
197 fld st(3)
|
|
198 fmul [ebp+var_4]
|
|
199 }
|
|
200 ++_EAX;
|
|
201 --v4;
|
|
202 __asm
|
|
203 {
|
|
204 fsubp st(1), st
|
|
205 fstp dword ptr [eax-24h]
|
|
206 fstp dword ptr [eax-20h]
|
|
207 fmul [ebp+var_4]
|
|
208 fld st(1)
|
|
209 fmul st, st(3)
|
|
210 faddp st(1), st
|
|
211 fstp dword ptr [eax-1Ch]
|
|
212 fstp st
|
|
213 }
|
|
214 }
|
|
215 while ( v4 );
|
|
216 }
|
|
217 __asm { fstp st }
|
|
218 }
|
|
219 else
|
|
220 {
|
|
221 __asm { fstp st }
|
|
222 if ( (signed int)uNumVertices > 0 )
|
|
223 {
|
|
224 _EAX = a1a;
|
|
225 do
|
|
226 {
|
|
227 __asm
|
|
228 {
|
|
229 fild pIndoorCamera->pos.x
|
|
230 fsubr dword ptr [eax]
|
|
231 fstp [ebp+a1]
|
|
232 fild pIndoorCamera->pos.y
|
|
233 fsubr dword ptr [eax+4]
|
|
234 fstp [ebp+uNumVertices]
|
|
235 fild pIndoorCamera->pos.z
|
|
236 fsubr dword ptr [eax+8]
|
|
237 }
|
|
238 if ( pRenderer->pRenderD3D )
|
|
239 {
|
|
240 __asm
|
|
241 {
|
|
242 fld [ebp+uNumVertices]
|
|
243 fmul st, st(2)
|
|
244 fld [ebp+a1]
|
|
245 fmul st, st(4)
|
|
246 faddp st(1), st
|
|
247 fstp dword ptr [eax+0Ch]
|
|
248 fld [ebp+a1]
|
|
249 fmul st, st(2)
|
|
250 fld [ebp+uNumVertices]
|
|
251 fmul st, st(4)
|
|
252 fsubp st(1), st
|
|
253 }
|
|
254 }
|
|
255 else
|
|
256 {
|
|
257 __asm
|
|
258 {
|
|
259 fld [ebp+a1]
|
|
260 fmul st, st(3)
|
|
261 fld [ebp+uNumVertices]
|
|
262 fmul st, st(3)
|
|
263 fsubp st(1), st
|
|
264 fstp dword ptr [eax+0Ch]
|
|
265 fld [ebp+a1]
|
|
266 fmul st, st(2)
|
|
267 fld [ebp+uNumVertices]
|
|
268 fmul st, st(4)
|
|
269 faddp st(1), st
|
|
270 }
|
|
271 }
|
|
272 __asm
|
|
273 {
|
|
274 fstp dword ptr [eax+10h]
|
|
275 fstp dword ptr [eax+14h]
|
|
276 }
|
|
277 ++_EAX;
|
|
278 --v4;
|
|
279 }
|
|
280 while ( v4 );
|
|
281 }
|
|
282 }
|
|
283 __asm
|
|
284 {
|
|
285 fstp st
|
|
286 fstp st
|
|
287 }
|
|
288 }
|
|
289 else
|
|
290 {
|
|
291 v3 = uNumVertices;
|
|
292 if ( (signed int)uNumVertices > 0 )
|
|
293 {
|
|
294 do
|
|
295 {
|
|
296 :ViewTransform(a1a);
|
|
297 ++a1a;
|
|
298 --v3;
|
|
299 }
|
|
300 while ( v3 );
|
|
301 }
|
|
302 }*/
|
|
303 }
|
|
304
|
|
305
|
|
306 //----- (00436932) --------------------------------------------------------
|
|
307 char IndoorCameraD3D::GetFacetOrientation(char a1, Vec3_float_ *a2, Vec3_float_ *a3, Vec3_float_ *a4)
|
|
308 {
|
|
309 Vec3_float_ *v5; // eax@9
|
|
310 double v6; // st7@9
|
|
311
|
|
312 if ( a1 == 1 )
|
|
313 {
|
|
314 a4->x = -a2->y;
|
|
315 a4->y = a2->x;
|
|
316 a4->z = 0.0;
|
|
317 LABEL_9:
|
|
318 v5 = a3;
|
|
319 a3->x = 0.0;
|
|
320 a3->y = 0.0;
|
|
321 v6 = 1.0;
|
|
322 LABEL_11:
|
|
323 v5->z = v6;
|
|
324 return 1;
|
|
325 }
|
|
326 if ( a1 == 3 || a1 == 5 )
|
|
327 {
|
|
328 LABEL_10:
|
|
329 a4->x = 1.0;
|
|
330 a4->y = 0.0;
|
|
331 a4->z = 0.0;
|
|
332 v5 = a3;
|
|
333 a3->x = 0.0;
|
|
334 a3->y = 1.0;
|
|
335 v6 = 0.0;
|
|
336 goto LABEL_11;
|
|
337 }
|
|
338 if ( a1 == 4 || a1 == 6 )
|
|
339 {
|
|
340 if ( fabs(a2->z) < 0.70811361 )
|
|
341 {
|
|
342 a4->x = -a2->y;
|
|
343 a4->y = a2->x;
|
|
344 a4->z = 0.0;
|
|
345 a4->Normalize();
|
|
346 goto LABEL_9;
|
|
347 }
|
|
348 goto LABEL_10;
|
|
349 }
|
|
350 return 1;
|
|
351 }
|
|
352
|
|
353
|
|
354 //----- (00438258) --------------------------------------------------------
|
|
355 bool IndoorCameraD3D::is_vertex_with_normal_from_face_towards_camera(BLVFace *pFace, RenderVertexSoft *a2)
|
|
356 {
|
|
357 char result; // al@2
|
|
358
|
|
359 if ( (a2->vWorldPosition.z - (double)pIndoorCamera->pos.z) * (double)pFace->pFacePlane_old.vNormal.z
|
|
360 + (a2->vWorldPosition.y - (double)pIndoorCamera->pos.y) * (double)pFace->pFacePlane_old.vNormal.y
|
|
361 + (a2->vWorldPosition.x - (double)pIndoorCamera->pos.x) * (double)pFace->pFacePlane_old.vNormal.x < 0.0
|
|
362 || (result = 1, pFace->uAttributes & 1) )
|
|
363 result = 0;
|
|
364 return result;
|
|
365 }
|
|
366
|
|
367 //----- (00438250) --------------------------------------------------------
|
|
368 void IndoorCameraD3D::Reset_list_0037C()
|
|
369 {
|
|
370 this->list_0037C_size = 0;
|
|
371 }
|
|
372
|
|
373
|
|
374 //----- (00438240) --------------------------------------------------------
|
|
375 void IndoorCameraD3D::_438240_draw_lits()
|
|
376 {
|
|
377 IndoorCameraD3D *v1; // ebp@1
|
|
378 int v2; // edi@2
|
|
379 int v3; // ebx@3
|
|
380 int v4; // esi@4
|
|
381 double v5; // st7@6
|
|
382 float v6; // ST00_4@8
|
|
383 IndoorCameraD3D *v7; // esi@1
|
|
384 float v8; // [sp+4h] [bp-28h]@6
|
|
385 float v9; // [sp+8h] [bp-24h]@6
|
|
386 unsigned int v10; // [sp+Ch] [bp-20h]@6
|
|
387 char v11; // [sp+10h] [bp-1Ch]@6
|
|
388 float v12; // [sp+14h] [bp-18h]@6
|
|
389 int v13; // [sp+28h] [bp-4h]@1
|
|
390
|
|
391 v7 = this;
|
|
392 _438141_draw_list_0037C();
|
|
393 v13 = 0;
|
|
394 v1 = v7;
|
|
395 if ( v7->list_E0380_size > 0 )
|
|
396 {
|
|
397 v2 = (int)&v7->list_E0380[0].field_C04;
|
|
398 do
|
|
399 {
|
|
400 v3 = 0;
|
|
401 if ( *(int *)v2 > 0 )
|
|
402 {
|
|
403 v4 = v2 - 3048;
|
|
404 do
|
|
405 {
|
|
406 if ( *(char *)(v2 - 3076) & 1 )
|
|
407 {
|
|
408 LODWORD(v12) = 1;
|
|
409 v11 = 1;
|
|
410 v10 = *(int *)(v2 + 4);
|
|
411 v9 = 0.0;
|
|
412 v8 = *(float *)(v4 + 4);
|
|
413 v5 = *(float *)v4;
|
|
414 }
|
|
415 else
|
|
416 {
|
|
417 LODWORD(v12) = 0;
|
|
418 v11 = 1;
|
|
419 v10 = *(int *)(v2 + 4);
|
|
420 v9 = *(float *)(v4 - 16);
|
|
421 v8 = *(float *)(v4 - 20);
|
|
422 v5 = *(float *)(v4 - 24);
|
|
423 }
|
|
424 v6 = v5;
|
|
425 _437D4A_draw_some_vertices(v6, v8, v9, v10, v11, v12);
|
|
426 ++v3;
|
|
427 v4 += 48;
|
|
428 }
|
|
429 while ( v3 < *(int *)v2 );
|
|
430 }
|
|
431 ++v13;
|
|
432 v2 += 3088;
|
|
433 }
|
|
434 while ( v13 < v1->list_E0380_size );
|
|
435 }
|
|
436 }
|
|
437
|
|
438
|
|
439 //----- (00438141) --------------------------------------------------------
|
|
440 void IndoorCameraD3D::_438141_draw_list_0037C()
|
|
441 {
|
|
442 IndoorCameraD3D *v1; // edi@1
|
|
443 signed int v2; // ebx@1
|
|
444 char *v3; // esi@2
|
|
445 double v4; // st7@4
|
|
446 float v5; // ST00_4@6
|
|
447 float v6; // [sp+4h] [bp-20h]@4
|
|
448 float v7; // [sp+8h] [bp-1Ch]@4
|
|
449 unsigned int v8; // [sp+Ch] [bp-18h]@4
|
|
450 char v9; // [sp+10h] [bp-14h]@4
|
|
451 float v10; // [sp+14h] [bp-10h]@4
|
|
452
|
|
453 v1 = this;
|
|
454 v2 = 0;
|
|
455 if ( (signed int)this->list_0037C_size > 0 )
|
|
456 {
|
|
457 v3 = (char *)&this->list_0037C[0].field_20;
|
|
458 do
|
|
459 {
|
|
460 if ( *(v3 - 32) & 1 )
|
|
461 {
|
|
462 LODWORD(v10) = 1;
|
|
463 v9 = 1;
|
|
464 v8 = *((int *)v3 + 5);
|
|
465 v7 = 0.0;
|
|
466 v6 = *(float *)v3;
|
|
467 v4 = *((float *)v3 - 1);
|
|
468 }
|
|
469 else
|
|
470 {
|
|
471 LODWORD(v10) = 0;
|
|
472 v9 = 1;
|
|
473 v8 = *((int *)v3 + 5);
|
|
474 v7 = *((float *)v3 - 5);
|
|
475 v6 = *((float *)v3 - 6);
|
|
476 v4 = *((float *)v3 - 7);
|
|
477 }
|
|
478 v5 = v4;
|
|
479 _437D4A_draw_some_vertices(v5, v6, v7, v8, v9, v10);
|
|
480 ++v2;
|
|
481 v3 += 56;
|
|
482 }
|
|
483 while ( v2 < (signed int)v1->list_0037C_size );
|
|
484 }
|
|
485 }
|
|
486
|
|
487
|
|
488 //----- (00437D4A) --------------------------------------------------------
|
|
489 void IndoorCameraD3D::_437D4A_draw_some_vertices(float x, float y, float z, unsigned int a5, char a6, float a7)
|
|
490 {
|
|
491 IndoorCameraD3D *v7; // edx@1
|
|
492 char *v8; // eax@1
|
|
493 signed int v9; // ecx@1
|
|
494 signed int v10; // edx@10
|
|
495 char *v11; // ecx@10
|
|
496 signed int uNumD3DVertices; // edi@16
|
|
497 char *v13; // ecx@24
|
|
498 unsigned int v14; // edx@25
|
|
499 unsigned int v15; // eax@25
|
|
500 int v16; // ebx@25
|
|
501 int v17; // eax@26
|
|
502 int v18; // edx@26
|
|
503 IDirect3DDevice3 *v19; // ST24_4@27
|
|
504 HRESULT v20; // eax@27
|
|
505 RenderVertexSoft vert[20]; // [sp+0h] [bp-680h]@1
|
|
506 RenderVertexD3D3 pD3DVertices[5]; // [sp+3C0h] [bp-2C0h]@15
|
|
507 RenderVertexSoft a1; // [sp+640h] [bp-40h]@1
|
2
|
508 //double v24; // [sp+670h] [bp-10h]@25
|
|
509 //double v25; // [sp+678h] [bp-8h]@1
|
0
|
510
|
|
511 v7 = this;
|
|
512 a1.flt_2C = 0.0;
|
2
|
513 //HIDWORD(v25) = (int)this;
|
0
|
514 v8 = (char *)&vert[0].flt_2C;
|
|
515 v9 = 20;
|
|
516 do
|
|
517 {
|
|
518 *(float *)v8 = 0.0;
|
|
519 v8 += 48;
|
|
520 --v9;
|
|
521 }
|
|
522 while ( v9 );
|
|
523 if ( LOBYTE(a7) )
|
|
524 {
|
|
525 vert[0].vWorldViewProjX = x;
|
|
526 vert[0].vWorldViewProjY = y;
|
|
527 goto LABEL_15;
|
|
528 }
|
|
529 a1.vWorldPosition.x = x;
|
|
530 a1.vWorldPosition.y = y;
|
|
531 a1.vWorldPosition.z = z;
|
|
532 if ( pRenderer->pRenderD3D )
|
|
533 {
|
|
534 LODWORD(a7) = 1;
|
|
535 if ( v7->_437285_prolly_colide_vertices_against_frustrum(
|
|
536 &a1,
|
|
537 (unsigned int *)&a7,
|
|
538 vert,
|
|
539 v7->std__vector_000034_prolly_frustrum,
|
|
540 4,
|
|
541 1,
|
|
542 0) == 1
|
|
543 && SLODWORD(a7) < 1 )
|
|
544 return;
|
|
545 }
|
|
546 else
|
|
547 {
|
|
548 vert[0].vWorldPosition.x = x;
|
|
549 vert[0].vWorldPosition.y = y;
|
|
550 vert[0].vWorldPosition.z = z;
|
|
551 }
|
|
552 ViewTransform(vert, 1u);
|
|
553 v10 = 0;
|
|
554 v11 = (char *)&vert[0].vWorldViewPosition;
|
|
555 do
|
|
556 {
|
|
557 if ( *(float *)v11 >= 8.0 )
|
|
558 break;
|
|
559 ++v10;
|
|
560 v11 += 48;
|
|
561 }
|
|
562 while ( v10 < 1 );
|
|
563 if ( v10 < 1 )
|
|
564 {
|
|
565 _436BB7_project_and_stuff(vert, 1u, 0);
|
|
566 LABEL_15:
|
|
567 pD3DVertices[0].pos.x = vert[0].vWorldViewProjX;
|
|
568 pD3DVertices[0].pos.y = vert[0].vWorldViewProjY;
|
|
569 pD3DVertices[0].specular = 0;
|
|
570 pD3DVertices[0].diffuse = a5;
|
|
571 if ( a6 )
|
|
572 {
|
|
573 pD3DVertices[0].pos.z = 0.000099999997;
|
|
574 pD3DVertices[1].pos.x = vert[0].vWorldViewProjX;
|
|
575 pD3DVertices[2].pos.x = vert[0].vWorldViewProjX;
|
|
576 pD3DVertices[0].rhw = 0.001;
|
|
577 uNumD3DVertices = 5;
|
|
578 pD3DVertices[0].texcoord.x = 0.0;
|
|
579 pD3DVertices[1].diffuse = a5;
|
|
580 pD3DVertices[1].specular = 0;
|
|
581 pD3DVertices[0].texcoord.y = 0.0;
|
|
582 pD3DVertices[2].diffuse = a5;
|
|
583 pD3DVertices[2].specular = 0;
|
|
584 pD3DVertices[3].pos.y = vert[0].vWorldViewProjY;
|
|
585 pD3DVertices[3].diffuse = a5;
|
|
586 pD3DVertices[3].specular = 0;
|
|
587 pD3DVertices[4].pos.y = vert[0].vWorldViewProjY;
|
|
588 pD3DVertices[1].pos.y = vert[0].vWorldViewProjY - 1.0;
|
|
589 pD3DVertices[4].diffuse = a5;
|
|
590 pD3DVertices[4].specular = 0;
|
|
591 pD3DVertices[1].pos.z = 0.000099999997;
|
|
592 pD3DVertices[1].rhw = 0.001;
|
|
593 pD3DVertices[1].texcoord.x = 0.0;
|
|
594 pD3DVertices[1].texcoord.y = 0.0;
|
|
595 pD3DVertices[2].pos.y = vert[0].vWorldViewProjY + 1.0;
|
|
596 pD3DVertices[2].pos.z = 0.000099999997;
|
|
597 pD3DVertices[2].rhw = 0.001;
|
|
598 pD3DVertices[2].texcoord.x = 0.0;
|
|
599 pD3DVertices[2].texcoord.y = 0.0;
|
|
600 pD3DVertices[3].pos.x = vert[0].vWorldViewProjX - 1.0;
|
|
601 pD3DVertices[3].pos.z = 0.000099999997;
|
|
602 pD3DVertices[3].rhw = 0.001;
|
|
603 pD3DVertices[3].texcoord.x = 0.0;
|
|
604 pD3DVertices[3].texcoord.y = 0.0;
|
|
605 pD3DVertices[4].pos.x = vert[0].vWorldViewProjX + 1.0;
|
|
606 pD3DVertices[4].pos.z = 0.000099999997;
|
|
607 pD3DVertices[4].rhw = 0.001;
|
|
608 pD3DVertices[4].texcoord.x = 0.0;
|
|
609 pD3DVertices[4].texcoord.y = 0.0;
|
|
610 }
|
|
611 else
|
|
612 {
|
|
613 uNumD3DVertices = 1;
|
|
614 __debugbreak(); // make things right
|
|
615 *(unsigned int *)(&pD3DVertices[0].pos.z) = 0x38D1B717u;
|
|
616 pD3DVertices[0].texcoord.x = 0.0;
|
|
617 *(unsigned int *)(&pD3DVertices[0].rhw) = 0x3A83126Fu;
|
|
618 pD3DVertices[0].texcoord.y = 0.0;
|
|
619 }
|
|
620 if ( pRenderer->pRenderD3D )
|
|
621 {
|
|
622 __debugbreak(); // decompilation bug
|
|
623 //v19 = pRenderer->pRenderD3D->pDevice;
|
|
624 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTexture(0, nullptr));
|
|
625 ErrD3D(pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_POINTLIST,
|
|
626 452,
|
|
627 pD3DVertices,
|
|
628 uNumD3DVertices,
|
|
629 16));
|
|
630 }
|
|
631 else
|
|
632 {
|
|
633 if ( (double)(signed int)pViewport->uViewportX <= vert[0].vWorldViewProjX - 1.0
|
|
634 && (double)(signed int)pViewport->uViewportZ > vert[0].vWorldViewProjX + 2.0
|
|
635 && (double)(signed int)pViewport->uViewportY <= vert[0].vWorldViewProjY - 1.0
|
|
636 && (double)(signed int)pViewport->uViewportW > vert[0].vWorldViewProjY + 2.0
|
|
637 && uNumD3DVertices > 0 )
|
|
638 {
|
|
639 v13 = (char *)&pD3DVertices[0].diffuse;
|
|
640 do
|
|
641 {
|
|
642 LODWORD(a7) = *((int *)v13 - 3);
|
2
|
643 //v25 = a7 + 6.7553994e15;
|
3
|
644 auto _v25 = floorf(a7 + 0.5f);
|
2
|
645
|
|
646 //v24 = *((float *)v13 - 4) + 6.7553994e15;
|
3
|
647 auto _v24 = floorf(*((float *)v13 - 4) + 0.5f);
|
2
|
648
|
0
|
649 v14 = *(int *)v13;
|
|
650 v15 = *(int *)v13;
|
|
651 v16 = (*(int *)v13 >> 3) & 0x1F;
|
|
652 if ( pRenderer->uTargetGBits == 5 )
|
|
653 {
|
|
654 v17 = (v15 >> 6) & 0x3E0;
|
|
655 v18 = (v14 >> 9) & 0x7C00;
|
|
656 }
|
|
657 else
|
|
658 {
|
|
659 v17 = (v15 >> 5) & 0x7E0;
|
|
660 v18 = (v14 >> 8) & 0xF800;
|
|
661 }
|
|
662 v13 += 32;
|
|
663 --uNumD3DVertices;
|
2
|
664 pRenderer->pTargetSurface[(uint)_v24 + pRenderer->uTargetSurfacePitch * (uint)_v25] = v18 | v16 | (unsigned __int16)v17;
|
0
|
665 }
|
|
666 while ( uNumD3DVertices );
|
|
667 }
|
|
668 }
|
|
669 }
|
|
670 }
|
|
671
|
|
672
|
|
673 //----- (00437C96) --------------------------------------------------------
|
|
674 void IndoorCameraD3D::do_draw_debug_line_d3d(const RenderVertexD3D3 *pLineBegin, unsigned int uDiffuseBegin, const RenderVertexD3D3 *pLineEnd, unsigned int uDiffuseEnd, float z_stuff)
|
|
675 {
|
|
676 double v6; // st7@2
|
|
677 IDirect3DDevice3 *v7; // eax@2
|
|
678 HRESULT v8; // eax@2
|
|
679 std::string v9; // [sp-18h] [bp-60h]@3
|
|
680 const char *v10; // [sp-Ch] [bp-54h]@2
|
|
681 const char *v11; // [sp-8h] [bp-50h]@2
|
|
682 int v12; // [sp-4h] [bp-4Ch]@2
|
|
683 RenderVertexD3D3 v13[2]; // [sp+8h] [bp-40h]@2
|
|
684
|
|
685 if ( pRenderer->pRenderD3D )
|
|
686 {
|
|
687 v6 = 0.001 - z_stuff;
|
|
688 memcpy(v13, pLineBegin, 0x20u);
|
|
689 memcpy(&v13[1], pLineEnd, sizeof(v13[1]));
|
|
690 v13[0].pos.z = v6;
|
|
691 v13[1].pos.z = v6;
|
|
692 v12 = 0;
|
|
693 v13[0].diffuse = uDiffuseBegin;
|
|
694 v13[1].diffuse = uDiffuseEnd;
|
|
695 v7 = pRenderer->pRenderD3D->pDevice;
|
|
696 v11 = 0;
|
|
697 //v10 = (const char *)v7;
|
|
698 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTexture(0, nullptr));
|
|
699 ErrD3D(pRenderer->pRenderD3D->pDevice->DrawPrimitive(
|
|
700 D3DPT_LINELIST,
|
|
701 452,
|
|
702 v13,
|
|
703 2,
|
|
704 16));
|
|
705 }
|
|
706 else
|
|
707 {
|
|
708 MessageBoxW(nullptr, L"draw_debug_line() not implemented for SW rendering", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Core3D.cpp:1415", 0);
|
|
709 }
|
|
710 }
|
|
711
|
|
712 //----- (00437AB5) --------------------------------------------------------
|
|
713 void IndoorCameraD3D::do_draw_debug_line_sw(RenderVertexSoft *pLineBegin, unsigned int uStartDiffuse, RenderVertexSoft *pLineEnd, unsigned int uEndDiffuse, unsigned int uOutNumVertices, float z_stuff)
|
|
714 {
|
|
715 char *v7; // eax@2
|
|
716 signed int v8; // edx@2
|
|
717 float v9; // ecx@5
|
|
718 float v10; // eax@5
|
|
719 char *v11; // eax@6
|
|
720 signed int v12; // edx@6
|
|
721 float v13; // edx@8
|
|
722 float v14; // eax@8
|
|
723 float v15; // eax@8
|
|
724 double v16; // st7@11
|
|
725 HRESULT v17; // eax@11
|
|
726 std::string v18; // [sp-18h] [bp-7E4h]@12
|
|
727 IDirect3DDevice3 *v19; // [sp-Ch] [bp-7D8h]@8
|
|
728 const char *v20; // [sp-8h] [bp-7D4h]@8
|
|
729 int v21; // [sp-4h] [bp-7D0h]@8
|
|
730 RenderVertexSoft a1[20]; // [sp+8h] [bp-7C4h]@6
|
|
731 RenderVertexSoft pVertices[20]; // [sp+3C8h] [bp-404h]@2
|
|
732 RenderVertexD3D3 v24[2]; // [sp+788h] [bp-44h]@11
|
|
733 IndoorCameraD3D *v25; // [sp+7C8h] [bp-4h]@1
|
|
734
|
|
735 v25 = this;
|
|
736 if ( pRenderer->pRenderD3D )
|
|
737 {
|
|
738 v7 = (char *)&pVertices[0].flt_2C;
|
|
739 v8 = 20;
|
|
740 do
|
|
741 {
|
|
742 *(float *)v7 = 0.0;
|
|
743 v7 += 48;
|
|
744 --v8;
|
|
745 }
|
|
746 while ( v8 );
|
|
747 if ( (char)uOutNumVertices )
|
|
748 {
|
|
749 v9 = pLineBegin->vWorldViewProjX;
|
|
750 pVertices[0].vWorldViewProjY = pLineBegin->vWorldViewProjY;
|
|
751 pVertices[0].vWorldViewProjX = v9;
|
|
752 v10 = pLineEnd->vWorldViewProjY;
|
|
753 pVertices[1].vWorldViewProjX = pLineEnd->vWorldViewProjX;
|
|
754 pVertices[1].vWorldViewProjY = v10;
|
|
755 LABEL_11:
|
|
756 v16 = 0.001 - z_stuff;
|
|
757 v24[0].specular = 0;
|
|
758 v24[0].pos.x = pVertices[0].vWorldViewProjX;
|
|
759 v24[0].pos.y = pVertices[0].vWorldViewProjY;
|
|
760 v24[0].pos.z = v16;
|
|
761 v24[0].diffuse = uStartDiffuse;
|
|
762 v24[0].rhw = 0.001;
|
|
763 v24[1].pos.x = pVertices[1].vWorldViewProjX;
|
|
764 v24[0].texcoord.x = 0.0;
|
|
765 v24[1].pos.y = pVertices[1].vWorldViewProjY;
|
|
766 v24[0].texcoord.y = 0.0;
|
|
767 v24[1].diffuse = uEndDiffuse;
|
|
768 v24[1].pos.z = v16;
|
|
769 v24[1].specular = 0;
|
|
770 v21 = 0;
|
|
771 v24[1].rhw = 0.001;
|
|
772 v20 = 0;
|
|
773 v24[1].texcoord.x = 0.0;
|
|
774 v24[1].texcoord.y = 0.0;
|
|
775 //v19 = pRenderer->pRenderD3D->pDevice;
|
|
776 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTexture(0, nullptr));
|
|
777 ErrD3D(pRenderer->pRenderD3D->pDevice->DrawPrimitive(
|
|
778 D3DPT_LINELIST,
|
|
779 452,
|
|
780 v24,
|
|
781 2,
|
|
782 16));
|
|
783 return;
|
|
784 }
|
|
785 v11 = (char *)&a1[0].flt_2C;
|
|
786 v12 = 20;
|
|
787 do
|
|
788 {
|
|
789 *(float *)v11 = 0.0;
|
|
790 v11 += 48;
|
|
791 --v12;
|
|
792 }
|
|
793 while ( v12 );
|
|
794 v21 = 0;
|
|
795 v20 = (const char *)1;
|
|
796 v19 = (IDirect3DDevice3 *)4;
|
|
797 v13 = pLineBegin->vWorldPosition.x;
|
|
798 uOutNumVertices = 2;
|
|
799 a1[0].vWorldPosition.x = v13;
|
|
800 v14 = pLineBegin->vWorldPosition.z;
|
|
801 a1[0].vWorldPosition.y = pLineBegin->vWorldPosition.y;
|
|
802 a1[0].vWorldPosition.z = v14;
|
|
803 a1[1].vWorldPosition.x = pLineEnd->vWorldPosition.x;
|
|
804 v15 = pLineEnd->vWorldPosition.z;
|
|
805 a1[1].vWorldPosition.y = pLineEnd->vWorldPosition.y;
|
|
806 a1[1].vWorldPosition.z = v15;
|
|
807 if ( _437285_prolly_colide_vertices_against_frustrum(
|
|
808 a1,
|
|
809 &uOutNumVertices,
|
|
810 pVertices,
|
|
811 this->std__vector_000034_prolly_frustrum,
|
|
812 4,
|
|
813 1,
|
|
814 0) != 1
|
|
815 || (signed int)uOutNumVertices >= 2 )
|
|
816 {
|
|
817 ViewTransform(pVertices, 2u);
|
|
818 _436BB7_project_and_stuff(pVertices, 2u, 0);
|
|
819 goto LABEL_11;
|
|
820 }
|
|
821 }
|
|
822 else
|
|
823 MessageBoxW(nullptr, L"draw_debug_line() not implemented for SW rendering", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Core3D.cpp:1383", 0);
|
|
824 }
|
|
825
|
|
826
|
|
827 //----- (00437A55) --------------------------------------------------------
|
|
828 void IndoorCameraD3D::debug_outline_d3d(const RenderVertexD3D3 *pLineVertices, unsigned int uNumLines, int uDiffuse, float z_stuff)
|
|
829 {
|
|
830 unsigned int v5; // esi@1
|
|
831 const RenderVertexD3D3 *v6; // ecx@2
|
|
832 unsigned int v7; // ebx@2
|
|
833 const RenderVertexD3D3 *v8; // edi@3
|
|
834 IndoorCameraD3D *thisa; // [sp+10h] [bp-4h]@1
|
|
835
|
|
836 v5 = 0;
|
|
837 thisa = this;
|
|
838 if ( (signed int)(uNumLines - 1) > 0 )
|
|
839 {
|
|
840 v6 = pLineVertices;
|
|
841 v7 = uNumLines - 1;
|
|
842 v5 = uNumLines - 1;
|
|
843 do
|
|
844 {
|
|
845 v8 = v6 + 1;
|
|
846 do_draw_debug_line_d3d(v6, uDiffuse, v6 + 1, uDiffuse, z_stuff);
|
|
847 --v7;
|
|
848 v6 = v8;
|
|
849 }
|
|
850 while ( v7 );
|
|
851 }
|
|
852 do_draw_debug_line_d3d(&pLineVertices[v5], uDiffuse, pLineVertices, uDiffuse, z_stuff);
|
|
853 }
|
|
854
|
|
855
|
|
856 //----- (004379EE) --------------------------------------------------------
|
|
857 void IndoorCameraD3D::debug_outline_sw(RenderVertexSoft *a2, unsigned int uNumVertices, unsigned int uDiffuse, float a5)
|
|
858 {
|
|
859 unsigned int v5; // esi@1
|
|
860 RenderVertexSoft *v6; // eax@2
|
|
861 RenderVertexSoft *v7; // edi@3
|
|
862 char v8; // zf@3
|
|
863 IndoorCameraD3D *v9; // [sp+10h] [bp-4h]@1
|
|
864 unsigned int uNumVerticesa; // [sp+20h] [bp+Ch]@2
|
|
865
|
|
866 v9 = this;
|
|
867 v5 = 0;
|
|
868 if ( (signed int)(uNumVertices - 1) > 0 )
|
|
869 {
|
|
870 v6 = a2;
|
|
871 v5 = uNumVertices - 1;
|
|
872 uNumVerticesa = uNumVertices - 1;
|
|
873 do
|
|
874 {
|
|
875 v7 = v6 + 1;
|
|
876 do_draw_debug_line_sw(v6, uDiffuse, v6 + 1, uDiffuse, 0, a5);
|
|
877 v8 = uNumVerticesa-- == 1;
|
|
878 v6 = v7;
|
|
879 }
|
|
880 while ( !v8 );
|
|
881 }
|
|
882 do_draw_debug_line_sw(&a2[v5], uDiffuse, a2, uDiffuse, 0, a5);
|
|
883 }
|
|
884
|
|
885
|
|
886 //----- (00437906) --------------------------------------------------------
|
|
887 void IndoorCameraD3D::PrepareAndDrawDebugOutline(BLVFace *pFace, unsigned int uDiffuse)
|
|
888 {
|
|
889 char *v3; // eax@2
|
|
890 signed int v4; // ecx@2
|
|
891 signed int v5; // ebx@5
|
|
892 Vec3_short_ *v6; // edx@6
|
|
893 char *v7; // esi@6
|
|
894 signed int v8; // ecx@7
|
|
895 IndoorCameraD3D *thisa; // [sp+8h] [bp-4h]@1
|
|
896
|
|
897 thisa = this;
|
|
898
|
|
899
|
|
900 static RenderVertexSoft static_sub_437906_array_50CDD0[64];
|
|
901 static bool __init_flag1 = false;
|
|
902 if (!__init_flag1)
|
|
903 {
|
|
904 __init_flag1 = true;
|
|
905
|
|
906 for (uint i = 0; i < 64; ++i)
|
|
907 static_sub_437906_array_50CDD0[i].flt_2C = 0.0f;
|
|
908 }
|
|
909
|
|
910 v5 = 0;
|
|
911 if ( pFace->uNumVertices )
|
|
912 {
|
|
913 v6 = pIndoor->pVertices;
|
|
914 v7 = (char *)&static_sub_437906_array_50CDD0[0].vWorldPosition.y;
|
|
915 do
|
|
916 {
|
|
917 v8 = v5++;
|
|
918 *((float *)v7 - 1) = (double)v6[pFace->pVertexIDs[v8]].x;
|
|
919 *(float *)v7 = (double)v6[pFace->pVertexIDs[v8]].y;
|
|
920 v7 += 48;
|
|
921 *((float *)v7 - 11) = (double)v6[pFace->pVertexIDs[v8]].z;
|
|
922 *((float *)v7 - 4) = (double)pFace->pVertexUIDs[v8];
|
|
923 *((float *)v7 - 3) = (double)pFace->pVertexVIDs[v8];
|
|
924 }
|
|
925 while ( v5 < pFace->uNumVertices );
|
|
926 }
|
|
927 debug_outline_sw(static_sub_437906_array_50CDD0, pFace->uNumVertices, uDiffuse, 0.0);
|
|
928 }
|
|
929 // 50D9D0: using guessed type char static_sub_437906_byte_50D9D0_init_flag;
|
|
930
|
|
931
|
|
932 //----- (004378BA) --------------------------------------------------------
|
|
933 void IndoorCameraD3D::MatrixMultiply(Matrix3x3_float_ *a1, Matrix3x3_float_ *a2, Matrix3x3_float_ *a3)
|
|
934 {
|
|
935 float *v4; // ecx@1
|
|
936 float *v5; // eax@1
|
|
937 signed int v6; // ebx@1
|
|
938 float *v7; // edx@2
|
|
939 float *v8; // ecx@2
|
|
940 signed int v9; // edi@2
|
|
941 double v10; // st7@3
|
|
942 double v11; // st6@3
|
|
943
|
|
944 v4 = (float *)a3;
|
|
945 v5 = &a1->_12;
|
|
946 v6 = 3;
|
|
947 do
|
|
948 {
|
|
949 v7 = v4;
|
|
950 v8 = &a2->_21;
|
|
951 v9 = 3;
|
|
952 do
|
|
953 {
|
|
954 v10 = v8[3] * v5[1] + *(v8 - 3) * *(v5 - 1);
|
|
955 v11 = *v8 * *v5;
|
|
956 ++v8;
|
|
957 *v7 = v10 + v11;
|
|
958 ++v7;
|
|
959 --v9;
|
|
960 }
|
|
961 while ( v9 );
|
|
962 v5 += 3;
|
|
963 --v6;
|
|
964 v4 = v7;
|
|
965 }
|
|
966 while ( v6 );
|
|
967 }
|
|
968
|
|
969
|
|
970 //----- (004376E7) --------------------------------------------------------
|
|
971 void IndoorCameraD3D::CreateWorldMatrixAndSomeStuff()
|
|
972 {
|
|
973 IndoorCameraD3D *v1; // esi@1
|
|
974 double v2; // st7@1
|
|
975 signed int v3; // edi@1
|
|
976 int v4; // eax@1
|
|
977 double v5; // st7@2
|
|
978 double v6; // st7@3
|
|
979 Matrix3x3_float_ a3; // [sp+10h] [bp-B8h]@1
|
|
980 Matrix3x3_float_ v8; // [sp+34h] [bp-94h]@1
|
|
981 Matrix3x3_float_ a2; // [sp+58h] [bp-70h]@1
|
|
982 Matrix3x3_float_ v10; // [sp+7Ch] [bp-4Ch]@1
|
|
983 Matrix3x3_float_ a1; // [sp+A0h] [bp-28h]@1
|
|
984 float v12; // [sp+C4h] [bp-4h]@1
|
|
985
|
|
986 v1 = this;
|
|
987 a1._13 = 0.0;
|
|
988 a1._23 = 0.0;
|
|
989 a1._31 = 0.0;
|
|
990 a1._32 = 0.0;
|
|
991 a1._33 = 1.0;
|
|
992 v10._11 = 1.0;
|
|
993 v10._12 = 0.0;
|
|
994 v10._13 = 0.0;
|
|
995 v10._21 = 0.0;
|
|
996 v10._31 = 0.0;
|
|
997 a2._12 = 0.0;
|
|
998 a2._21 = 0.0;
|
|
999 a2._22 = 1.0;
|
|
1000 a2._23 = 0.0;
|
|
1001 a2._32 = 0.0;
|
|
1002 v12 = cos(0.0);
|
|
1003 v2 = sin(0.0);
|
|
1004 a1._11 = v12;
|
|
1005 a1._12 = v2;
|
|
1006 a1._21 = -v2;
|
|
1007 a1._22 = v12;
|
|
1008 v10._22 = pIndoorCamera->fRotationXCosine;
|
|
1009 v10._32 = -pIndoorCamera->fRotationXSine;
|
|
1010 v10._23 = pIndoorCamera->fRotationXSine;
|
|
1011 v10._33 = pIndoorCamera->fRotationXCosine;
|
|
1012 a2._11 = pIndoorCamera->fRotationYCosine;
|
|
1013 a2._13 = -pIndoorCamera->fRotationYSine;
|
|
1014 a2._31 = pIndoorCamera->fRotationYSine;
|
|
1015 a2._33 = pIndoorCamera->fRotationYCosine;
|
|
1016 MatrixMultiply(&a1, &a2, &a3);
|
|
1017 MatrixMultiply(&v10, &a3, &v8);
|
|
1018 v3 = 0;
|
|
1019 v4 = (int)&v1->field_4.x;
|
|
1020 do
|
|
1021 {
|
|
1022 v5 = *(&v8._11 + v3++);
|
|
1023 *(float *)(v4 + 16) = v5;
|
|
1024 *(float *)v4 = *(float *)((char *)&v8._12 - (char *)v1 + v4);
|
|
1025 *(float *)(v4 + 32) = *(float *)((char *)&v8._22 - (char *)v1 + v4);
|
|
1026 v4 += 4;
|
|
1027 }
|
|
1028 while ( v3 < 3 );
|
|
1029 LODWORD(v1->field_D8) = 0x3F91361Du;
|
|
1030 v1->flt_D0 = (double)pViewport->uScreenWidth * 0.8814736;
|
|
1031 v6 = 0.8814736 * (double)pViewport->uScreenHeight;
|
|
1032 v1->flt_D4 = v6;
|
|
1033 if ( v1->flt_D0 > v6 )
|
|
1034 v6 = v1->flt_D0;
|
|
1035 v1->flt_fov = v6;
|
|
1036 v1->field_C8 = (double)pViewport->uScreenCenterX;
|
|
1037 v1->field_CC = (double)(pViewport->uScreenCenterY - pViewport->uScreenY);
|
|
1038 }
|
|
1039
|
|
1040
|
|
1041 //----- (00437691) --------------------------------------------------------
|
|
1042 IndoorCameraD3D_Vec3 *IndoorCameraD3D::Vec3Transform(const IndoorCameraD3D_Vec3 *pVector, IndoorCameraD3D_Vec3 *pOut)
|
|
1043 {
|
|
1044 IndoorCameraD3D_Vec3 *result; // eax@1
|
|
1045
|
|
1046 result = (IndoorCameraD3D_Vec3 *)pVector;
|
|
1047 pOut->y = this->field_14.x * pVector->x + this->field_4.x * pVector->y + this->field_24.x * pVector->z;
|
|
1048 pOut->z = this->field_14.y * result->x + this->field_4.y * result->y + this->field_24.y * result->z;
|
|
1049 pOut->x = this->field_14.z * result->x + this->field_4.z * result->y + this->field_24.z * pVector->z;
|
|
1050 return result;
|
|
1051 }
|
|
1052
|
|
1053 //----- (00437607) --------------------------------------------------------
|
|
1054 void IndoorCameraD3D::_437607(IndoorCameraD3D_Vec3 *a1, IndoorCameraD3D_Vec4 *a2)
|
|
1055 {
|
|
1056 IndoorCameraD3D *v3; // edi@1
|
|
1057 double v4; // st7@1
|
|
1058 signed int v5; // ecx@1
|
|
1059 char *v6; // eax@1
|
|
1060 double v7; // st6@2
|
|
1061 IndoorCameraD3D_Vec3 v8; // [sp+8h] [bp-1Ch]@1
|
|
1062 Vec3_float_ v9; // [sp+Ch] [bp-18h]@1
|
|
1063 int v10; // [sp+20h] [bp-4h]@1
|
|
1064
|
|
1065 v3 = this;
|
|
1066 //IndoorCameraD3D_Vec3::IndoorCameraD3D_Vec3(&v8);
|
|
1067 v10 = 0;
|
|
1068 v9.x = (double)pIndoorCamera->pos.x;
|
|
1069 v9.y = (double)pIndoorCamera->pos.y;
|
|
1070 v9.z = (double)pIndoorCamera->pos.z;
|
|
1071 Vec3Transform(a1, a2);
|
|
1072 v4 = 0.0;
|
|
1073 v5 = 0;
|
|
1074 v6 = (char *)&a2->x;
|
|
1075 do
|
|
1076 {
|
|
1077 v7 = *(&v9.x + v5++) * *(float *)v6;
|
|
1078 v6 += 4;
|
|
1079 v4 = v4 + v7;
|
|
1080 }
|
|
1081 while ( v5 < 3 );
|
|
1082 v10 = -1;
|
|
1083 a2->dot = v4 + 0.000099999997;
|
|
1084 //IndoorCameraD3D_Vec3::dtor(&v8);
|
|
1085 }
|
|
1086
|
|
1087 //----- (004374E8) --------------------------------------------------------
|
|
1088 void IndoorCameraD3D::_4374E8_ProllyBuildFrustrum()
|
|
1089 {
|
|
1090 IndoorCameraD3D *v1; // esi@1
|
|
1091 double v2; // st7@1
|
|
1092 double v3; // st7@1
|
|
1093 double v4; // st7@1
|
|
1094 double v5; // st7@1
|
|
1095 double v6; // st7@1
|
|
1096 IndoorCameraD3D_Vec3 v7; // [sp+Ch] [bp-24h]@1
|
|
1097 float v8; // [sp+10h] [bp-20h]@1
|
|
1098 float v9; // [sp+14h] [bp-1Ch]@1
|
|
1099 float v10; // [sp+18h] [bp-18h]@1
|
|
1100 float v11; // [sp+1Ch] [bp-14h]@1
|
|
1101 float v12; // [sp+20h] [bp-10h]@1
|
|
1102 int v13; // [sp+2Ch] [bp-4h]@1
|
|
1103
|
|
1104 v1 = this;
|
|
1105 //IndoorCameraD3D_Vec3::IndoorCameraD3D_Vec3(&v7);
|
|
1106 v2 = 2.0 / v1->field_D8;
|
|
1107 v13 = 0;
|
|
1108 v3 = atan(v2 * v1->flt_fov / v1->flt_D0);
|
|
1109 v12 = v3;
|
|
1110 v11 = sin(v3);
|
|
1111 v4 = cos(v12);
|
|
1112 v8 = -v11;
|
|
1113 v9 = 0.0;
|
|
1114 v10 = v4;
|
|
1115 _437607(&v7, v1->std__vector_000034_prolly_frustrum);
|
|
1116 v8 = v11;
|
|
1117 _437607(&v7, &v1->std__vector_000034_prolly_frustrum[1]);
|
|
1118 v5 = atan(2.0 / v1->field_D8 * v1->flt_fov / (v1->flt_D4 + 0.5));
|
|
1119 v12 = v5;
|
|
1120 v11 = sin(v5);
|
|
1121 v6 = cos(v12);
|
|
1122 v9 = v11;
|
|
1123 v8 = 0.0;
|
|
1124 v10 = v6;
|
|
1125 _437607(&v7, &v1->std__vector_000034_prolly_frustrum[2]);
|
|
1126 v9 = -v11;
|
|
1127 _437607(&v7, &v1->std__vector_000034_prolly_frustrum[3]);
|
|
1128 v13 = -1;
|
|
1129 //IndoorCameraD3D_Vec3::dtor(&v7);
|
|
1130 }
|
|
1131
|
|
1132 //----- (00437376) --------------------------------------------------------
|
|
1133 char IndoorCameraD3D::_437376(stru154 *thisa, RenderVertexSoft *a2, unsigned int *pOutNumVertices)
|
|
1134 {
|
|
1135 unsigned int v4; // ebx@1
|
|
1136 RenderVertexSoft *v5; // edx@2
|
|
1137 double v6; // st7@3
|
|
1138 unsigned int v7; // edi@5
|
|
1139 signed int v8; // esi@6
|
|
1140 int v9; // ebx@8
|
|
1141 int v10; // eax@8
|
|
1142 int v11; // ecx@14
|
|
1143 int v12; // eax@14
|
|
1144 int v13; // eax@15
|
|
1145 signed int v14; // ebx@17
|
|
1146 RenderVertexSoft *v15; // eax@18
|
|
1147 unsigned int *v16; // eax@20
|
|
1148 char result; // al@24
|
|
1149 RenderVertexSoft v18; // [sp+Ch] [bp-34h]@2
|
|
1150 int v19; // [sp+3Ch] [bp-4h]@8
|
|
1151 signed int thisb; // [sp+48h] [bp+8h]@6
|
|
1152 char a2_3; // [sp+4Fh] [bp+Fh]@5
|
|
1153
|
|
1154 v4 = *pOutNumVertices;
|
|
1155 if ( (signed int)*pOutNumVertices <= 3
|
|
1156 || ((v5 = a2,
|
|
1157 memcpy(&v18, a2, sizeof(v18)),
|
|
1158 (v18.vWorldPosition.z - (double)pBLVRenderParams->vPartyPos.z) * thisa->vNormal.z
|
|
1159 + (v18.vWorldPosition.y - (double)pBLVRenderParams->vPartyPos.y) * thisa->vNormal.y
|
|
1160 + (v18.vWorldPosition.x - (double)pBLVRenderParams->vPartyPos.x) * thisa->vNormal.x < 0.0) ? (v6 = 1.0) : (v6 = -1.0),
|
|
1161 a2_3 = 0,
|
|
1162 memcpy(&v5[v4], v5, sizeof(v5[v4])),
|
|
1163 memcpy(&v5[*pOutNumVertices + 1], &v5[1], sizeof(v5[*pOutNumVertices + 1])),
|
|
1164 v7 = *pOutNumVertices,
|
|
1165 (signed int)*pOutNumVertices <= 0) )
|
|
1166 goto LABEL_28;
|
|
1167 v8 = 1;
|
|
1168 for ( thisb = 1; ; v8 = thisb )
|
|
1169 {
|
|
1170 v9 = v8 - 1;
|
|
1171 v10 = v8 + 1;
|
|
1172 v19 = v8 + 1;
|
|
1173 if ( v8 - 1 >= (signed int)v7 )
|
|
1174 v9 -= v7;
|
|
1175 if ( v8 >= (signed int)v7 )
|
|
1176 v8 -= v7;
|
|
1177 if ( v19 >= (signed int)v7 )
|
|
1178 v10 = v19 - v7;
|
|
1179 v11 = (int)&v5[v10];
|
|
1180 v12 = (int)&v5[v9];
|
|
1181 if ( -0.009999999776482582 > ((v5[v8].vWorldViewProjX - *(float *)(v12 + 24))
|
|
1182 * (*(float *)(v11 + 28) - *(float *)(v12 + 28))
|
|
1183 - (v5[v8].vWorldViewProjY - *(float *)(v12 + 28))
|
|
1184 * (*(float *)(v11 + 24) - *(float *)(v12 + 24)))
|
|
1185 * v6 )
|
|
1186 {
|
|
1187 thisb = v19;
|
|
1188 v16 = pOutNumVertices;
|
|
1189 }
|
|
1190 else
|
|
1191 {
|
|
1192 v13 = thisb;
|
|
1193 if ( thisb >= (signed int)v7 )
|
|
1194 v13 = thisb - v7;
|
|
1195 v14 = v13;
|
|
1196 if ( v13 < (signed int)v7 )
|
|
1197 {
|
|
1198 v15 = &v5[v13];
|
|
1199 do
|
|
1200 {
|
|
1201 memcpy(v15, &v15[1], 0x30u);
|
|
1202 ++v14;
|
|
1203 ++v15;
|
|
1204 }
|
|
1205 while ( v14 < (signed int)*pOutNumVertices );
|
|
1206 }
|
|
1207 v16 = pOutNumVertices;
|
|
1208 a2_3 = 1;
|
|
1209 --*v16;
|
|
1210 }
|
|
1211 v7 = *v16;
|
|
1212 if ( thisb - 1 >= (signed int)*v16 )
|
|
1213 break;
|
|
1214 }
|
|
1215 if ( a2_3 )
|
|
1216 result = 1;
|
|
1217 else
|
|
1218 LABEL_28:
|
|
1219 result = 0;
|
|
1220 return result;
|
|
1221 }
|
|
1222
|
|
1223 //----- (00437285) --------------------------------------------------------
|
|
1224 bool IndoorCameraD3D::_437285_prolly_colide_vertices_against_frustrum(RenderVertexSoft *a1, unsigned int *pOutNumVertices, RenderVertexSoft *pVertices, IndoorCameraD3D_Vec4 *a4, signed int uNumVertices, char a6, int _unused)
|
|
1225 {
|
|
1226 char *v8; // eax@2
|
|
1227 signed int v9; // ecx@2
|
|
1228 bool result; // eax@5
|
|
1229 int v11; // ecx@5
|
|
1230 signed int v12; // ecx@6
|
|
1231 char *v13; // esi@6
|
|
1232 RenderVertexSoft *v14; // eax@8
|
|
1233 RenderVertexSoft *v15; // edx@8
|
|
1234 Vec3_float_ a5; // [sp+18h] [bp-3Ch]@12
|
|
1235 float v17; // [sp+44h] [bp-10h]@1
|
|
1236 int v18; // [sp+48h] [bp-Ch]@5
|
|
1237 stru9 *thisa; // [sp+4Ch] [bp-8h]@1
|
|
1238 int a7a; // [sp+53h] [bp-1h]@5
|
|
1239 bool a6a; // [sp+70h] [bp+1Ch]@5
|
|
1240
|
|
1241 v17 = 0.0;
|
|
1242 thisa = pGame->pStru9Instance;
|
|
1243
|
|
1244
|
|
1245 static RenderVertexSoft sr_vertices_50D9D8[64];
|
|
1246 static bool __init_flag1 = false;
|
|
1247 if (!__init_flag1)
|
|
1248 {
|
|
1249 __init_flag1 = true;
|
|
1250
|
|
1251 for (uint i = 0; i < 64; ++i)
|
|
1252 sr_vertices_50D9D8[i].flt_2C = 0.0f;
|
|
1253 }
|
|
1254
|
|
1255 result = 0;
|
|
1256 LOBYTE(a7a) = 0;
|
|
1257 v11 = 2 * (a6 == 0) + 1;
|
|
1258 a6a = 0;
|
|
1259 v18 = v11;
|
|
1260 if ( uNumVertices <= 0 )
|
|
1261 {
|
|
1262 LABEL_14:
|
|
1263 LOBYTE(result) = a7a;
|
|
1264 }
|
|
1265 else
|
|
1266 {
|
|
1267 v12 = *pOutNumVertices;
|
|
1268 v13 = (char *)&a4->y;
|
|
1269 while ( 1 )
|
|
1270 {
|
|
1271 if ( result % 2 )
|
|
1272 {
|
|
1273 v14 = a1;
|
|
1274 v15 = sr_vertices_50D9D8;
|
|
1275 }
|
|
1276 else
|
|
1277 {
|
|
1278 v15 = a1;
|
|
1279 v14 = sr_vertices_50D9D8;
|
|
1280 }
|
|
1281 ++a6a;
|
|
1282 if ( a6a == uNumVertices )
|
|
1283 v14 = pVertices;
|
|
1284 a5.x = *((float *)v13 - 1);
|
|
1285 a5.y = *(float *)v13;
|
|
1286 a5.z = *((float *)v13 + 1);
|
|
1287 result = thisa->_4985FB(v15, v12, v14, pOutNumVertices, &a5, *((float *)v13 + 2), (char *)&a7a, _unused);
|
|
1288 v12 = *pOutNumVertices;
|
|
1289 if ( (signed int)*pOutNumVertices < v18 )
|
|
1290 break;
|
|
1291 result = a6a;
|
|
1292 v13 += 24;
|
|
1293 if ( a6a >= uNumVertices )
|
|
1294 goto LABEL_14;
|
|
1295 }
|
|
1296 *pOutNumVertices = 0;
|
|
1297 LOBYTE(result) = 1;
|
|
1298 }
|
|
1299 return result;
|
|
1300 }
|
|
1301 // 50E5D8: using guessed type char static_50D9D8_init_flag_bit1;
|
|
1302
|
|
1303 //----- (004371C3) --------------------------------------------------------
|
|
1304 bool IndoorCameraD3D::_4371C3(RenderVertexSoft *pVertices, unsigned int *pOutNumVertices, int _unused)
|
|
1305 {
|
|
1306 char *v4; // eax@2
|
|
1307 signed int v5; // ecx@2
|
|
1308 RenderVertexSoft *v6; // esi@5
|
|
1309 unsigned int *v7; // edi@5
|
|
1310 char *v8; // ecx@6
|
|
1311 int v9; // eax@6
|
|
1312 IndoorCameraD3D *thisa; // [sp+0h] [bp-Ch]@1
|
|
1313 signed int v12; // [sp+4h] [bp-8h]@5
|
|
1314 unsigned int pVerticesa; // [sp+14h] [bp+8h]@6
|
|
1315 unsigned int pOutNumVerticesa; // [sp+18h] [bp+Ch]@6
|
|
1316
|
|
1317 thisa = this;
|
|
1318
|
|
1319
|
|
1320 static RenderVertexSoft static_4371C3_array_50E5E0[64];
|
|
1321 static bool __init_flag1 = false;
|
|
1322 if (!__init_flag1)
|
|
1323 {
|
|
1324 __init_flag1 = true;
|
|
1325
|
|
1326 for (uint i = 0; i < 64; ++i)
|
|
1327 static_4371C3_array_50E5E0[i].flt_2C = 0.0f;
|
|
1328 }
|
|
1329
|
|
1330 v12 = 0;
|
|
1331 v6 = pVertices;
|
|
1332 v7 = pOutNumVertices;
|
|
1333 if ( (signed int)*pOutNumVertices > 0 )
|
|
1334 {
|
|
1335 pOutNumVerticesa = (char *)static_4371C3_array_50E5E0 - (char *)pVertices;
|
|
1336 pVerticesa = (char *)&static_4371C3_array_50E5E0[0].vWorldViewProjY - (char *)pVertices;
|
|
1337 v8 = (char *)&static_4371C3_array_50E5E0[0].vWorldPosition.y;
|
|
1338 v9 = (int)&v6->vWorldPosition.z;
|
|
1339 do
|
|
1340 {
|
|
1341 ++v12;
|
|
1342 *((int *)v8 - 1) = *(int *)(v9 - 8);
|
|
1343 *(int *)v8 = *(int *)(v9 - 4);
|
|
1344 v8 += 48;
|
|
1345 *(float *)(pOutNumVerticesa + v9) = *(float *)v9;
|
|
1346 *(float *)(pVerticesa + v9) = *(float *)(v9 + 28);
|
|
1347 *(float *)((char *)&static_4371C3_array_50E5E0[0].flt_20 - (char *)v6 + v9) = *(float *)(v9 + 32);
|
|
1348 v9 += 48;
|
|
1349 }
|
|
1350 while ( v12 < (signed int)*v7 );
|
|
1351 }
|
|
1352 return _437285_prolly_colide_vertices_against_frustrum(
|
|
1353 static_4371C3_array_50E5E0,
|
|
1354 v7,
|
|
1355 v6,
|
|
1356 thisa->std__vector_000034_prolly_frustrum,
|
|
1357 4,
|
|
1358 0,
|
|
1359 _unused);
|
|
1360 }
|
|
1361 // 50F1E0: using guessed type char static_sub_4371C3_byte_50F1E0_init_flags;
|
|
1362
|
|
1363 //----- (00437143) --------------------------------------------------------
|
|
1364 int IndoorCameraD3D::_437143(unsigned int uNumInVertices, RenderVertexSoft *pOutVertices, RenderVertexSoft *pInVertices, unsigned int *pOutNumVertices)
|
|
1365 {
|
|
1366 unsigned int v5; // edi@1
|
|
1367 char *pOutVertices_; // edx@2
|
|
1368 char *v7; // eax@2
|
|
1369 unsigned int v8; // ebx@2
|
|
1370 double v9; // st7@3
|
|
1371 double v10; // st6@3
|
|
1372 int result; // eax@5
|
|
1373 unsigned int a2a; // [sp+10h] [bp+Ch]@2
|
|
1374
|
|
1375 v5 = uNumInVertices;
|
|
1376 if ( (signed int)uNumInVertices > 0 )
|
|
1377 {
|
|
1378 pOutVertices_ = (char *)&pOutVertices->vWorldViewProjY;
|
|
1379 v7 = (char *)&pInVertices->flt_20;
|
|
1380 v8 = (char *)pOutVertices - (char *)pInVertices;
|
|
1381 a2a = uNumInVertices;
|
|
1382 do
|
|
1383 {
|
|
1384 *(float *)v7 = 1.0 / (*((float *)v7 - 5) + 0.0000001);
|
|
1385 memcpy(pOutVertices_ - 28, v7 - 32, 0x30u);
|
|
1386 v9 = (double)pOutdoorCamera->int_fov_rad * *(float *)&v7[v8];
|
|
1387 v10 = (double)pViewport->uScreenCenterX - v9 * *((float *)v7 - 4);
|
|
1388 v7 += 48;
|
|
1389 *((float *)pOutVertices_ - 1) = v10;
|
|
1390 *(float *)pOutVertices_ = (double)pViewport->uScreenCenterY - v9 * *((float *)v7 - 15);
|
|
1391 pOutVertices_ += 48;
|
|
1392 --a2a;
|
|
1393 }
|
|
1394 while ( a2a );
|
|
1395 v5 = uNumInVertices;
|
|
1396 }
|
|
1397 result = (int)pOutNumVertices;
|
|
1398 *pOutNumVertices = v5;
|
|
1399 return result;
|
|
1400 }
|
|
1401 //----- (00436F09) --------------------------------------------------------
|
|
1402 void IndoorCameraD3D::_436F09(RenderVertexSoft *pInVertices, int uNumInVertices, RenderVertexSoft *pOutVertices, unsigned int *pOutNumVertices)
|
|
1403 {
|
|
1404 unsigned int *pOutNumVertices_; // ebx@1
|
|
1405 double v6; // st7@2
|
|
1406 signed int v7; // esi@2
|
|
1407 char *v8; // edx@5
|
|
1408 unsigned int v9; // eax@10
|
|
1409 RenderVertexSoft *v10; // ecx@11
|
|
1410 double v11; // st6@11
|
|
1411 double v12; // st6@12
|
|
1412 unsigned int v13; // edi@14
|
|
1413 unsigned __int8 v14; // c2@16
|
|
1414 unsigned __int8 v15; // c3@16
|
|
1415 unsigned int v16; // edi@17
|
|
1416 bool a1a; // [sp+Ch] [bp+8h]@7
|
|
1417 int a4a; // [sp+18h] [bp+14h]@5
|
|
1418
|
|
1419 pOutNumVertices_ = pOutNumVertices;
|
|
1420 *pOutNumVertices = 0;
|
|
1421 if ( uNumInVertices )
|
|
1422 {
|
|
1423 memcpy(&pInVertices[uNumInVertices], pInVertices, sizeof(pInVertices[uNumInVertices]));
|
|
1424 v6 = (double)pOutdoorCamera->shading_dist_mist;
|
|
1425 v7 = 0;
|
|
1426 if ( v6 >= pInVertices->vWorldViewPosition.x )
|
|
1427 v7 = 1;
|
|
1428 if ( uNumInVertices + 1 > 1 )
|
|
1429 {
|
|
1430 a4a = uNumInVertices;
|
|
1431 v8 = (char *)&pInVertices[1].u;
|
|
1432 do
|
|
1433 {
|
|
1434 a1a = v6 >= *((float *)v8 - 6);
|
|
1435 if ( v7 == a1a )
|
|
1436 {
|
|
1437 v10 = pOutVertices;
|
|
1438 goto LABEL_23;
|
|
1439 }
|
|
1440 v9 = *pOutNumVertices_;
|
|
1441 if ( a1a )
|
|
1442 {
|
|
1443 v10 = pOutVertices;
|
|
1444 v11 = (v6 - *((float *)v8 - 18)) / (*((float *)v8 - 6) - *((float *)v8 - 18));
|
|
1445 pOutVertices[v9].vWorldViewPosition.y = (*((float *)v8 - 5) - *((float *)v8 - 17)) * v11 + *((float *)v8 - 17);
|
|
1446 pOutVertices[*pOutNumVertices_].vWorldViewPosition.z = (*((float *)v8 - 4) - *((float *)v8 - 16)) * v11
|
|
1447 + *((float *)v8 - 16);
|
|
1448 pOutVertices[*pOutNumVertices_].u = (*(float *)v8 - *((float *)v8 - 12)) * v11 + *((float *)v8 - 12);
|
|
1449 pOutVertices[*pOutNumVertices_].v = (*((float *)v8 + 1) - *((float *)v8 - 11)) * v11 + *((float *)v8 - 11);
|
|
1450 }
|
|
1451 else
|
|
1452 {
|
|
1453 v12 = (v6 - *((float *)v8 - 6)) / (*((float *)v8 - 18) - *((float *)v8 - 6));
|
|
1454 pOutVertices[v9].vWorldViewPosition.y = (*((float *)v8 - 17) - *((float *)v8 - 5)) * v12 + *((float *)v8 - 5);
|
|
1455 pOutVertices[*pOutNumVertices_].vWorldViewPosition.z = (*((float *)v8 - 16) - *((float *)v8 - 4)) * v12
|
|
1456 + *((float *)v8 - 4);
|
|
1457 pOutVertices[*pOutNumVertices_].u = (*((float *)v8 - 12) - *(float *)v8) * v12 + *(float *)v8;
|
|
1458 pOutVertices[*pOutNumVertices_].v = (*((float *)v8 - 11) - *((float *)v8 + 1)) * v12 + *((float *)v8 + 1);
|
|
1459 v10 = pOutVertices;
|
|
1460 }
|
|
1461 v10[*pOutNumVertices_].vWorldViewPosition.x = v6;
|
|
1462 v10[*pOutNumVertices_].flt_20 = 1.0 / v6;
|
|
1463 if ( v7 )
|
|
1464 {
|
|
1465 v13 = (unsigned int)&v10[*pOutNumVertices_];
|
|
1466 if ( *(float *)(v13 + 12) != *((float *)v8 - 18) || *(float *)(v13 + 16) != *((float *)v8 - 17) )
|
|
1467 goto LABEL_21;
|
|
1468 v14 = 0;
|
|
1469 v15 = *(float *)(v13 + 20) == *((float *)v8 - 16);
|
|
1470 }
|
|
1471 else
|
|
1472 {
|
|
1473 v16 = (unsigned int)&v10[*pOutNumVertices_];
|
|
1474 if ( *(float *)(v16 + 12) != *((float *)v8 - 6) || *(float *)(v16 + 16) != *((float *)v8 - 5) )
|
|
1475 {
|
|
1476 LABEL_21:
|
|
1477 ++*pOutNumVertices_;
|
|
1478 goto LABEL_23;
|
|
1479 }
|
|
1480 v14 = 0;
|
|
1481 v15 = *(float *)(v16 + 20) == *((float *)v8 - 4);
|
|
1482 }
|
|
1483 if ( !(v15 | v14) )
|
|
1484 goto LABEL_21;
|
|
1485 LABEL_23:
|
|
1486 if ( a1a )
|
|
1487 {
|
|
1488 memcpy(&v10[*pOutNumVertices_], v8 - 36, sizeof(v10[*pOutNumVertices_]));
|
|
1489 pOutVertices[*pOutNumVertices_].flt_20 = 1.0 / (*((float *)v8 - 6) + 0.0000001);
|
|
1490 pOutVertices[(*pOutNumVertices_)++].flt_2C = *((float *)v8 + 2);
|
|
1491 }
|
|
1492 v7 = a1a;
|
|
1493 v8 += 48;
|
|
1494 --a4a;
|
|
1495 }
|
|
1496 while ( a4a );
|
|
1497 }
|
|
1498 if ( (signed int)*pOutNumVertices_ < 3 )
|
|
1499 *pOutNumVertices_ = 0;
|
|
1500 }
|
|
1501 }
|
|
1502
|
|
1503
|
|
1504 //----- (00436CDC) --------------------------------------------------------
|
|
1505 void IndoorCameraD3D::_436CDC(RenderVertexSoft *pInVertices, int uNumInVertices, RenderVertexSoft *pOutVertices, unsigned int *pOutNumVertices)
|
|
1506 {
|
|
1507 signed int v5; // esi@2
|
|
1508 char *v6; // edx@5
|
|
1509 unsigned int v7; // eax@10
|
|
1510 RenderVertexSoft *v8; // ecx@11
|
|
1511 double v9; // st6@11
|
|
1512 double v10; // st6@12
|
|
1513 unsigned int v11; // edi@14
|
|
1514 unsigned __int8 v12; // c2@16
|
|
1515 unsigned __int8 v13; // c3@16
|
|
1516 unsigned int v14; // edi@17
|
|
1517 bool a1a; // [sp+Ch] [bp+8h]@7
|
|
1518
|
|
1519 if ( uNumInVertices )
|
|
1520 {
|
|
1521 *pOutNumVertices = 0;
|
|
1522 memcpy(&pInVertices[uNumInVertices], pInVertices, sizeof(pInVertices[uNumInVertices]));
|
|
1523 v5 = 0;
|
|
1524 if ( pInVertices->vWorldViewPosition.x >= 8.0 )
|
|
1525 v5 = 1;
|
|
1526 if ( uNumInVertices + 1 > 1 )
|
|
1527 {
|
|
1528 v6 = (char *)&pInVertices[1].u;
|
|
1529 do
|
|
1530 {
|
|
1531 a1a = *((float *)v6 - 6) >= 8.0;
|
|
1532 if ( v5 == a1a )
|
|
1533 {
|
|
1534 v8 = pOutVertices;
|
|
1535 goto LABEL_23;
|
|
1536 }
|
|
1537 v7 = *pOutNumVertices;
|
|
1538 if ( a1a )
|
|
1539 {
|
|
1540 v8 = pOutVertices;
|
|
1541 v9 = (8.0 - *((float *)v6 - 18)) / (*((float *)v6 - 6) - *((float *)v6 - 18));
|
|
1542 pOutVertices[v7].vWorldViewPosition.y = (*((float *)v6 - 5) - *((float *)v6 - 17)) * v9 + *((float *)v6 - 17);
|
|
1543 pOutVertices[*pOutNumVertices].vWorldViewPosition.z = (*((float *)v6 - 4) - *((float *)v6 - 16)) * v9
|
|
1544 + *((float *)v6 - 16);
|
|
1545 pOutVertices[*pOutNumVertices].u = (*(float *)v6 - *((float *)v6 - 12)) * v9 + *((float *)v6 - 12);
|
|
1546 pOutVertices[*pOutNumVertices].v = (*((float *)v6 + 1) - *((float *)v6 - 11)) * v9 + *((float *)v6 - 11);
|
|
1547 }
|
|
1548 else
|
|
1549 {
|
|
1550 v10 = (8.0 - *((float *)v6 - 6)) / (*((float *)v6 - 18) - *((float *)v6 - 6));
|
|
1551 pOutVertices[v7].vWorldViewPosition.y = (*((float *)v6 - 17) - *((float *)v6 - 5)) * v10 + *((float *)v6 - 5);
|
|
1552 pOutVertices[*pOutNumVertices].vWorldViewPosition.z = (*((float *)v6 - 16) - *((float *)v6 - 4)) * v10
|
|
1553 + *((float *)v6 - 4);
|
|
1554 pOutVertices[*pOutNumVertices].u = (*((float *)v6 - 12) - *(float *)v6) * v10 + *(float *)v6;
|
|
1555 pOutVertices[*pOutNumVertices].v = (*((float *)v6 - 11) - *((float *)v6 + 1)) * v10 + *((float *)v6 + 1);
|
|
1556 v8 = pOutVertices;
|
|
1557 }
|
|
1558 v8[*pOutNumVertices].vWorldViewPosition.x = 8.0;
|
|
1559 v8[*pOutNumVertices].flt_20 = 0.125;
|
|
1560 if ( v5 )
|
|
1561 {
|
|
1562 v11 = (unsigned int)&v8[*pOutNumVertices];
|
|
1563 if ( *(float *)(v11 + 12) != *((float *)v6 - 18) || *(float *)(v11 + 16) != *((float *)v6 - 17) )
|
|
1564 goto LABEL_21;
|
|
1565 v12 = 0;
|
|
1566 v13 = *(float *)(v11 + 20) == *((float *)v6 - 16);
|
|
1567 }
|
|
1568 else
|
|
1569 {
|
|
1570 v14 = (unsigned int)&v8[*pOutNumVertices];
|
|
1571 if ( *(float *)(v14 + 12) != *((float *)v6 - 6) || *(float *)(v14 + 16) != *((float *)v6 - 5) )
|
|
1572 {
|
|
1573 LABEL_21:
|
|
1574 ++*pOutNumVertices;
|
|
1575 goto LABEL_23;
|
|
1576 }
|
|
1577 v12 = 0;
|
|
1578 v13 = *(float *)(v14 + 20) == *((float *)v6 - 4);
|
|
1579 }
|
|
1580 if ( !(v13 | v12) )
|
|
1581 goto LABEL_21;
|
|
1582 LABEL_23:
|
|
1583 if ( a1a )
|
|
1584 {
|
|
1585 memcpy(&v8[*pOutNumVertices], v6 - 36, sizeof(v8[*pOutNumVertices]));
|
|
1586 pOutVertices[(*pOutNumVertices)++].flt_20 = 1.0 / (*((float *)v6 - 6) + 0.0000001);
|
|
1587 }
|
|
1588 v5 = a1a;
|
|
1589 v6 += 48;
|
|
1590 --uNumInVertices;
|
|
1591 }
|
|
1592 while ( uNumInVertices );
|
|
1593 }
|
|
1594 if ( (signed int)*pOutNumVertices < 3 )
|
|
1595 *pOutNumVertices = 0;
|
|
1596 }
|
|
1597 }
|
|
1598
|
|
1599
|
|
1600 //----- (00436BB7) --------------------------------------------------------
|
|
1601 void IndoorCameraD3D::_436BB7_project_and_stuff(RenderVertexSoft *pVertices, unsigned int uNumVertices, char a4)
|
|
1602 {
|
|
1603 unsigned int v4; // ebx@1
|
|
1604 IndoorCameraD3D *v5; // edi@1
|
|
1605 float *v6; // esi@2
|
|
1606 double v7; // st7@7
|
|
1607 double v8; // st7@9
|
|
1608 double v9; // st6@10
|
|
1609 double v10; // st5@12
|
|
1610 double v11; // st7@16
|
|
1611 double v12; // st6@17
|
|
1612 double v13; // st5@19
|
|
1613 float uNumVerticesa; // [sp+14h] [bp+Ch]@13
|
|
1614 float uNumVerticesb; // [sp+14h] [bp+Ch]@20
|
|
1615
|
|
1616 v4 = uNumVertices;
|
|
1617 v5 = this;
|
|
1618 if ( (signed int)uNumVertices > 0 )
|
|
1619 {
|
|
1620 v6 = &pVertices->vWorldViewProjX;
|
|
1621 do
|
|
1622 {
|
|
1623 if ( byte_4D864C && pGame->uFlags & 0x80 || uCurrentlyLoadedLevelType == LEVEL_Indoor)
|
|
1624 {
|
|
1625 v7 = 1.0 / *(v6 - 3);
|
|
1626 *v6 = *(v6 - 2) * v5->flt_fov * v7 + v5->field_C8;
|
|
1627 v6[1] = (double)(signed int)pViewport->uViewportW - (*(v6 - 1) * v5->flt_fov * v7 + v5->field_CC);
|
|
1628 }
|
|
1629 else
|
|
1630 {
|
|
1631 extern void _outdoor_project(RenderVertexSoft *v);
|
|
1632 _outdoor_project((RenderVertexSoft *)(v6 - 6));
|
|
1633 }
|
|
1634 if ( a4 )
|
|
1635 {
|
|
1636 v8 = (double)(signed int)pViewport->uViewportZ;
|
|
1637 if ( v8 >= *v6 )
|
|
1638 v9 = *v6;
|
|
1639 else
|
|
1640 v9 = v8;
|
|
1641 v10 = (double)(signed int)pViewport->uViewportX;
|
|
1642 if ( v10 <= v9 )
|
|
1643 {
|
|
1644 if ( v8 >= *v6 )
|
|
1645 v8 = *v6;
|
|
1646 }
|
|
1647 else
|
|
1648 {
|
|
1649 uNumVerticesa = v10;
|
|
1650 v8 = uNumVerticesa;
|
|
1651 }
|
|
1652 *v6 = v8;
|
|
1653 v11 = (double)(signed int)pViewport->uViewportW;
|
|
1654 if ( v11 >= v6[1] )
|
|
1655 v12 = v6[1];
|
|
1656 else
|
|
1657 v12 = v11;
|
|
1658 v13 = (double)(signed int)pViewport->uViewportY;
|
|
1659 if ( v13 <= v12 )
|
|
1660 {
|
|
1661 if ( v11 >= v6[1] )
|
|
1662 v11 = v6[1];
|
|
1663 }
|
|
1664 else
|
|
1665 {
|
|
1666 uNumVerticesb = v13;
|
|
1667 v11 = uNumVerticesb;
|
|
1668 }
|
|
1669 v6[1] = v11;
|
|
1670 }
|
|
1671 v6 += 12;
|
|
1672 --v4;
|
|
1673 }
|
|
1674 while ( v4 );
|
|
1675 }
|
|
1676 }
|
|
1677
|
|
1678
|
|
1679 //----- (00436A9A) --------------------------------------------------------
|
|
1680 void IndoorCameraD3D::Project(signed int x, signed int y, signed int z, int *a5, int *a6)
|
|
1681 {
|
|
1682 double v6; // ST00_8@2
|
|
1683 double v7; // ST08_8@2
|
|
1684 double v8; // ST00_8@2
|
|
1685 signed __int64 v9; // qtt@3
|
|
1686 int v10; // ST04_4@3
|
|
1687 float a2a; // [sp+18h] [bp+8h]@2
|
|
1688 float a2b; // [sp+18h] [bp+8h]@2
|
|
1689
|
|
1690 if ( pRenderer->pRenderD3D )
|
|
1691 {
|
|
1692 v6 = 1.0 / (double)x;
|
|
1693 a2a = (double)y * this->flt_fov * v6 + this->field_C8;
|
|
1694 v7 = a2a + 6.7553994e15;
|
|
1695 *a5 = LODWORD(v7);
|
|
1696 a2b = (double)z * this->flt_fov * v6 + this->field_CC;
|
|
1697 v8 = a2b + 6.7553994e15;
|
|
1698 *a6 = pViewport->uViewportW - LODWORD(v8);
|
|
1699 }
|
|
1700 else
|
|
1701 {
|
|
1702 LODWORD(v9) = pBLVRenderParams->field_40 << 16;
|
|
1703 HIDWORD(v9) = pBLVRenderParams->field_40 >> 16;
|
|
1704 v10 = v9 / x;
|
|
1705 LODWORD(v9) = pBLVRenderParams->field_40 << 16;
|
|
1706 HIDWORD(v9) = pBLVRenderParams->field_40 >> 16;
|
|
1707 *a5 = pBLVRenderParams->uViewportCenterX
|
|
1708 - ((signed int)(((unsigned __int64)(v10 * (signed __int64)y) >> 16) + 32768) >> 16);
|
|
1709 *a6 = pBLVRenderParams->uViewportCenterY - ((signed int)(((unsigned __int64)(v9 / x * z) >> 16) + 32768) >> 16);
|
|
1710 }
|
|
1711 }
|
|
1712
|
|
1713 //----- (00436A6D) --------------------------------------------------------
|
|
1714 double IndoorCameraD3D::GetPolygonMinZ(RenderVertexSoft *pVertices, unsigned int uStripType)
|
|
1715 {
|
|
1716 unsigned int v3; // edx@1
|
|
1717 double result; // st7@1
|
|
1718 float *v5; // ecx@2
|
|
1719
|
|
1720 v3 = uStripType;
|
|
1721 result = 3.4028235e38;
|
|
1722 if ( (signed int)uStripType > 0 )
|
|
1723 {
|
|
1724 v5 = &pVertices->vWorldPosition.z;
|
|
1725 do
|
|
1726 {
|
|
1727 if ( *v5 < result )
|
|
1728 result = *v5;
|
|
1729 v5 += 12;
|
|
1730 --v3;
|
|
1731 }
|
|
1732 while ( v3 );
|
|
1733 }
|
|
1734 return result;
|
|
1735 }
|
|
1736
|
|
1737
|
|
1738 //----- (00436A24) --------------------------------------------------------
|
|
1739 struct IDirect3DTexture2 *IndoorCameraD3D::LoadTextureAndGetHardwarePtr(char *Str1)
|
|
1740 {
|
|
1741 return pBitmaps_LOD->pHardwareTextures[pBitmaps_LOD->LoadTexture(Str1)];
|
|
1742 }
|
|
1743
|
|
1744 //----- (00436A40) --------------------------------------------------------
|
|
1745 double IndoorCameraD3D::GetPolygonMaxZ(RenderVertexSoft *pVertex, unsigned int uStripType)
|
|
1746 {
|
|
1747 unsigned int v3; // edx@1
|
|
1748 double result; // st7@1
|
|
1749 float *v5; // ecx@2
|
|
1750
|
|
1751 v3 = uStripType;
|
|
1752 result = 1.1754944e-38;
|
|
1753 if ( (signed int)uStripType > 0 )
|
|
1754 {
|
|
1755 v5 = &pVertex->vWorldPosition.z;
|
|
1756 do
|
|
1757 {
|
|
1758 if ( *v5 > result )
|
|
1759 result = *v5;
|
|
1760 v5 += 12;
|
|
1761 --v3;
|
|
1762 }
|
|
1763 while ( v3 );
|
|
1764 }
|
|
1765 return result;
|
|
1766 } |