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
|
|
508 double v24; // [sp+670h] [bp-10h]@25
|
|
509 double v25; // [sp+678h] [bp-8h]@1
|
|
510
|
|
511 v7 = this;
|
|
512 a1.flt_2C = 0.0;
|
|
513 HIDWORD(v25) = (int)this;
|
|
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);
|
|
643 v25 = a7 + 6.7553994e15;
|
|
644 v24 = *((float *)v13 - 4) + 6.7553994e15;
|
|
645 v14 = *(int *)v13;
|
|
646 v15 = *(int *)v13;
|
|
647 v16 = (*(int *)v13 >> 3) & 0x1F;
|
|
648 if ( pRenderer->uTargetGBits == 5 )
|
|
649 {
|
|
650 v17 = (v15 >> 6) & 0x3E0;
|
|
651 v18 = (v14 >> 9) & 0x7C00;
|
|
652 }
|
|
653 else
|
|
654 {
|
|
655 v17 = (v15 >> 5) & 0x7E0;
|
|
656 v18 = (v14 >> 8) & 0xF800;
|
|
657 }
|
|
658 v13 += 32;
|
|
659 --uNumD3DVertices;
|
|
660 pRenderer->pTargetSurface[LODWORD(v24) + pRenderer->uTargetSurfacePitch * LODWORD(v25)] = v18 | v16 | (unsigned __int16)v17;
|
|
661 }
|
|
662 while ( uNumD3DVertices );
|
|
663 }
|
|
664 }
|
|
665 }
|
|
666 }
|
|
667
|
|
668
|
|
669 //----- (00437C96) --------------------------------------------------------
|
|
670 void IndoorCameraD3D::do_draw_debug_line_d3d(const RenderVertexD3D3 *pLineBegin, unsigned int uDiffuseBegin, const RenderVertexD3D3 *pLineEnd, unsigned int uDiffuseEnd, float z_stuff)
|
|
671 {
|
|
672 double v6; // st7@2
|
|
673 IDirect3DDevice3 *v7; // eax@2
|
|
674 HRESULT v8; // eax@2
|
|
675 std::string v9; // [sp-18h] [bp-60h]@3
|
|
676 const char *v10; // [sp-Ch] [bp-54h]@2
|
|
677 const char *v11; // [sp-8h] [bp-50h]@2
|
|
678 int v12; // [sp-4h] [bp-4Ch]@2
|
|
679 RenderVertexD3D3 v13[2]; // [sp+8h] [bp-40h]@2
|
|
680
|
|
681 if ( pRenderer->pRenderD3D )
|
|
682 {
|
|
683 v6 = 0.001 - z_stuff;
|
|
684 memcpy(v13, pLineBegin, 0x20u);
|
|
685 memcpy(&v13[1], pLineEnd, sizeof(v13[1]));
|
|
686 v13[0].pos.z = v6;
|
|
687 v13[1].pos.z = v6;
|
|
688 v12 = 0;
|
|
689 v13[0].diffuse = uDiffuseBegin;
|
|
690 v13[1].diffuse = uDiffuseEnd;
|
|
691 v7 = pRenderer->pRenderD3D->pDevice;
|
|
692 v11 = 0;
|
|
693 //v10 = (const char *)v7;
|
|
694 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTexture(0, nullptr));
|
|
695 ErrD3D(pRenderer->pRenderD3D->pDevice->DrawPrimitive(
|
|
696 D3DPT_LINELIST,
|
|
697 452,
|
|
698 v13,
|
|
699 2,
|
|
700 16));
|
|
701 }
|
|
702 else
|
|
703 {
|
|
704 MessageBoxW(nullptr, L"draw_debug_line() not implemented for SW rendering", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Core3D.cpp:1415", 0);
|
|
705 }
|
|
706 }
|
|
707
|
|
708 //----- (00437AB5) --------------------------------------------------------
|
|
709 void IndoorCameraD3D::do_draw_debug_line_sw(RenderVertexSoft *pLineBegin, unsigned int uStartDiffuse, RenderVertexSoft *pLineEnd, unsigned int uEndDiffuse, unsigned int uOutNumVertices, float z_stuff)
|
|
710 {
|
|
711 char *v7; // eax@2
|
|
712 signed int v8; // edx@2
|
|
713 float v9; // ecx@5
|
|
714 float v10; // eax@5
|
|
715 char *v11; // eax@6
|
|
716 signed int v12; // edx@6
|
|
717 float v13; // edx@8
|
|
718 float v14; // eax@8
|
|
719 float v15; // eax@8
|
|
720 double v16; // st7@11
|
|
721 HRESULT v17; // eax@11
|
|
722 std::string v18; // [sp-18h] [bp-7E4h]@12
|
|
723 IDirect3DDevice3 *v19; // [sp-Ch] [bp-7D8h]@8
|
|
724 const char *v20; // [sp-8h] [bp-7D4h]@8
|
|
725 int v21; // [sp-4h] [bp-7D0h]@8
|
|
726 RenderVertexSoft a1[20]; // [sp+8h] [bp-7C4h]@6
|
|
727 RenderVertexSoft pVertices[20]; // [sp+3C8h] [bp-404h]@2
|
|
728 RenderVertexD3D3 v24[2]; // [sp+788h] [bp-44h]@11
|
|
729 IndoorCameraD3D *v25; // [sp+7C8h] [bp-4h]@1
|
|
730
|
|
731 v25 = this;
|
|
732 if ( pRenderer->pRenderD3D )
|
|
733 {
|
|
734 v7 = (char *)&pVertices[0].flt_2C;
|
|
735 v8 = 20;
|
|
736 do
|
|
737 {
|
|
738 *(float *)v7 = 0.0;
|
|
739 v7 += 48;
|
|
740 --v8;
|
|
741 }
|
|
742 while ( v8 );
|
|
743 if ( (char)uOutNumVertices )
|
|
744 {
|
|
745 v9 = pLineBegin->vWorldViewProjX;
|
|
746 pVertices[0].vWorldViewProjY = pLineBegin->vWorldViewProjY;
|
|
747 pVertices[0].vWorldViewProjX = v9;
|
|
748 v10 = pLineEnd->vWorldViewProjY;
|
|
749 pVertices[1].vWorldViewProjX = pLineEnd->vWorldViewProjX;
|
|
750 pVertices[1].vWorldViewProjY = v10;
|
|
751 LABEL_11:
|
|
752 v16 = 0.001 - z_stuff;
|
|
753 v24[0].specular = 0;
|
|
754 v24[0].pos.x = pVertices[0].vWorldViewProjX;
|
|
755 v24[0].pos.y = pVertices[0].vWorldViewProjY;
|
|
756 v24[0].pos.z = v16;
|
|
757 v24[0].diffuse = uStartDiffuse;
|
|
758 v24[0].rhw = 0.001;
|
|
759 v24[1].pos.x = pVertices[1].vWorldViewProjX;
|
|
760 v24[0].texcoord.x = 0.0;
|
|
761 v24[1].pos.y = pVertices[1].vWorldViewProjY;
|
|
762 v24[0].texcoord.y = 0.0;
|
|
763 v24[1].diffuse = uEndDiffuse;
|
|
764 v24[1].pos.z = v16;
|
|
765 v24[1].specular = 0;
|
|
766 v21 = 0;
|
|
767 v24[1].rhw = 0.001;
|
|
768 v20 = 0;
|
|
769 v24[1].texcoord.x = 0.0;
|
|
770 v24[1].texcoord.y = 0.0;
|
|
771 //v19 = pRenderer->pRenderD3D->pDevice;
|
|
772 ErrD3D(pRenderer->pRenderD3D->pDevice->SetTexture(0, nullptr));
|
|
773 ErrD3D(pRenderer->pRenderD3D->pDevice->DrawPrimitive(
|
|
774 D3DPT_LINELIST,
|
|
775 452,
|
|
776 v24,
|
|
777 2,
|
|
778 16));
|
|
779 return;
|
|
780 }
|
|
781 v11 = (char *)&a1[0].flt_2C;
|
|
782 v12 = 20;
|
|
783 do
|
|
784 {
|
|
785 *(float *)v11 = 0.0;
|
|
786 v11 += 48;
|
|
787 --v12;
|
|
788 }
|
|
789 while ( v12 );
|
|
790 v21 = 0;
|
|
791 v20 = (const char *)1;
|
|
792 v19 = (IDirect3DDevice3 *)4;
|
|
793 v13 = pLineBegin->vWorldPosition.x;
|
|
794 uOutNumVertices = 2;
|
|
795 a1[0].vWorldPosition.x = v13;
|
|
796 v14 = pLineBegin->vWorldPosition.z;
|
|
797 a1[0].vWorldPosition.y = pLineBegin->vWorldPosition.y;
|
|
798 a1[0].vWorldPosition.z = v14;
|
|
799 a1[1].vWorldPosition.x = pLineEnd->vWorldPosition.x;
|
|
800 v15 = pLineEnd->vWorldPosition.z;
|
|
801 a1[1].vWorldPosition.y = pLineEnd->vWorldPosition.y;
|
|
802 a1[1].vWorldPosition.z = v15;
|
|
803 if ( _437285_prolly_colide_vertices_against_frustrum(
|
|
804 a1,
|
|
805 &uOutNumVertices,
|
|
806 pVertices,
|
|
807 this->std__vector_000034_prolly_frustrum,
|
|
808 4,
|
|
809 1,
|
|
810 0) != 1
|
|
811 || (signed int)uOutNumVertices >= 2 )
|
|
812 {
|
|
813 ViewTransform(pVertices, 2u);
|
|
814 _436BB7_project_and_stuff(pVertices, 2u, 0);
|
|
815 goto LABEL_11;
|
|
816 }
|
|
817 }
|
|
818 else
|
|
819 MessageBoxW(nullptr, L"draw_debug_line() not implemented for SW rendering", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Core3D.cpp:1383", 0);
|
|
820 }
|
|
821
|
|
822
|
|
823 //----- (00437A55) --------------------------------------------------------
|
|
824 void IndoorCameraD3D::debug_outline_d3d(const RenderVertexD3D3 *pLineVertices, unsigned int uNumLines, int uDiffuse, float z_stuff)
|
|
825 {
|
|
826 unsigned int v5; // esi@1
|
|
827 const RenderVertexD3D3 *v6; // ecx@2
|
|
828 unsigned int v7; // ebx@2
|
|
829 const RenderVertexD3D3 *v8; // edi@3
|
|
830 IndoorCameraD3D *thisa; // [sp+10h] [bp-4h]@1
|
|
831
|
|
832 v5 = 0;
|
|
833 thisa = this;
|
|
834 if ( (signed int)(uNumLines - 1) > 0 )
|
|
835 {
|
|
836 v6 = pLineVertices;
|
|
837 v7 = uNumLines - 1;
|
|
838 v5 = uNumLines - 1;
|
|
839 do
|
|
840 {
|
|
841 v8 = v6 + 1;
|
|
842 do_draw_debug_line_d3d(v6, uDiffuse, v6 + 1, uDiffuse, z_stuff);
|
|
843 --v7;
|
|
844 v6 = v8;
|
|
845 }
|
|
846 while ( v7 );
|
|
847 }
|
|
848 do_draw_debug_line_d3d(&pLineVertices[v5], uDiffuse, pLineVertices, uDiffuse, z_stuff);
|
|
849 }
|
|
850
|
|
851
|
|
852 //----- (004379EE) --------------------------------------------------------
|
|
853 void IndoorCameraD3D::debug_outline_sw(RenderVertexSoft *a2, unsigned int uNumVertices, unsigned int uDiffuse, float a5)
|
|
854 {
|
|
855 unsigned int v5; // esi@1
|
|
856 RenderVertexSoft *v6; // eax@2
|
|
857 RenderVertexSoft *v7; // edi@3
|
|
858 char v8; // zf@3
|
|
859 IndoorCameraD3D *v9; // [sp+10h] [bp-4h]@1
|
|
860 unsigned int uNumVerticesa; // [sp+20h] [bp+Ch]@2
|
|
861
|
|
862 v9 = this;
|
|
863 v5 = 0;
|
|
864 if ( (signed int)(uNumVertices - 1) > 0 )
|
|
865 {
|
|
866 v6 = a2;
|
|
867 v5 = uNumVertices - 1;
|
|
868 uNumVerticesa = uNumVertices - 1;
|
|
869 do
|
|
870 {
|
|
871 v7 = v6 + 1;
|
|
872 do_draw_debug_line_sw(v6, uDiffuse, v6 + 1, uDiffuse, 0, a5);
|
|
873 v8 = uNumVerticesa-- == 1;
|
|
874 v6 = v7;
|
|
875 }
|
|
876 while ( !v8 );
|
|
877 }
|
|
878 do_draw_debug_line_sw(&a2[v5], uDiffuse, a2, uDiffuse, 0, a5);
|
|
879 }
|
|
880
|
|
881
|
|
882 //----- (00437906) --------------------------------------------------------
|
|
883 void IndoorCameraD3D::PrepareAndDrawDebugOutline(BLVFace *pFace, unsigned int uDiffuse)
|
|
884 {
|
|
885 char *v3; // eax@2
|
|
886 signed int v4; // ecx@2
|
|
887 signed int v5; // ebx@5
|
|
888 Vec3_short_ *v6; // edx@6
|
|
889 char *v7; // esi@6
|
|
890 signed int v8; // ecx@7
|
|
891 IndoorCameraD3D *thisa; // [sp+8h] [bp-4h]@1
|
|
892
|
|
893 thisa = this;
|
|
894
|
|
895
|
|
896 static RenderVertexSoft static_sub_437906_array_50CDD0[64];
|
|
897 static bool __init_flag1 = false;
|
|
898 if (!__init_flag1)
|
|
899 {
|
|
900 __init_flag1 = true;
|
|
901
|
|
902 for (uint i = 0; i < 64; ++i)
|
|
903 static_sub_437906_array_50CDD0[i].flt_2C = 0.0f;
|
|
904 }
|
|
905
|
|
906 v5 = 0;
|
|
907 if ( pFace->uNumVertices )
|
|
908 {
|
|
909 v6 = pIndoor->pVertices;
|
|
910 v7 = (char *)&static_sub_437906_array_50CDD0[0].vWorldPosition.y;
|
|
911 do
|
|
912 {
|
|
913 v8 = v5++;
|
|
914 *((float *)v7 - 1) = (double)v6[pFace->pVertexIDs[v8]].x;
|
|
915 *(float *)v7 = (double)v6[pFace->pVertexIDs[v8]].y;
|
|
916 v7 += 48;
|
|
917 *((float *)v7 - 11) = (double)v6[pFace->pVertexIDs[v8]].z;
|
|
918 *((float *)v7 - 4) = (double)pFace->pVertexUIDs[v8];
|
|
919 *((float *)v7 - 3) = (double)pFace->pVertexVIDs[v8];
|
|
920 }
|
|
921 while ( v5 < pFace->uNumVertices );
|
|
922 }
|
|
923 debug_outline_sw(static_sub_437906_array_50CDD0, pFace->uNumVertices, uDiffuse, 0.0);
|
|
924 }
|
|
925 // 50D9D0: using guessed type char static_sub_437906_byte_50D9D0_init_flag;
|
|
926
|
|
927
|
|
928 //----- (004378BA) --------------------------------------------------------
|
|
929 void IndoorCameraD3D::MatrixMultiply(Matrix3x3_float_ *a1, Matrix3x3_float_ *a2, Matrix3x3_float_ *a3)
|
|
930 {
|
|
931 float *v4; // ecx@1
|
|
932 float *v5; // eax@1
|
|
933 signed int v6; // ebx@1
|
|
934 float *v7; // edx@2
|
|
935 float *v8; // ecx@2
|
|
936 signed int v9; // edi@2
|
|
937 double v10; // st7@3
|
|
938 double v11; // st6@3
|
|
939
|
|
940 v4 = (float *)a3;
|
|
941 v5 = &a1->_12;
|
|
942 v6 = 3;
|
|
943 do
|
|
944 {
|
|
945 v7 = v4;
|
|
946 v8 = &a2->_21;
|
|
947 v9 = 3;
|
|
948 do
|
|
949 {
|
|
950 v10 = v8[3] * v5[1] + *(v8 - 3) * *(v5 - 1);
|
|
951 v11 = *v8 * *v5;
|
|
952 ++v8;
|
|
953 *v7 = v10 + v11;
|
|
954 ++v7;
|
|
955 --v9;
|
|
956 }
|
|
957 while ( v9 );
|
|
958 v5 += 3;
|
|
959 --v6;
|
|
960 v4 = v7;
|
|
961 }
|
|
962 while ( v6 );
|
|
963 }
|
|
964
|
|
965
|
|
966 //----- (004376E7) --------------------------------------------------------
|
|
967 void IndoorCameraD3D::CreateWorldMatrixAndSomeStuff()
|
|
968 {
|
|
969 IndoorCameraD3D *v1; // esi@1
|
|
970 double v2; // st7@1
|
|
971 signed int v3; // edi@1
|
|
972 int v4; // eax@1
|
|
973 double v5; // st7@2
|
|
974 double v6; // st7@3
|
|
975 Matrix3x3_float_ a3; // [sp+10h] [bp-B8h]@1
|
|
976 Matrix3x3_float_ v8; // [sp+34h] [bp-94h]@1
|
|
977 Matrix3x3_float_ a2; // [sp+58h] [bp-70h]@1
|
|
978 Matrix3x3_float_ v10; // [sp+7Ch] [bp-4Ch]@1
|
|
979 Matrix3x3_float_ a1; // [sp+A0h] [bp-28h]@1
|
|
980 float v12; // [sp+C4h] [bp-4h]@1
|
|
981
|
|
982 v1 = this;
|
|
983 a1._13 = 0.0;
|
|
984 a1._23 = 0.0;
|
|
985 a1._31 = 0.0;
|
|
986 a1._32 = 0.0;
|
|
987 a1._33 = 1.0;
|
|
988 v10._11 = 1.0;
|
|
989 v10._12 = 0.0;
|
|
990 v10._13 = 0.0;
|
|
991 v10._21 = 0.0;
|
|
992 v10._31 = 0.0;
|
|
993 a2._12 = 0.0;
|
|
994 a2._21 = 0.0;
|
|
995 a2._22 = 1.0;
|
|
996 a2._23 = 0.0;
|
|
997 a2._32 = 0.0;
|
|
998 v12 = cos(0.0);
|
|
999 v2 = sin(0.0);
|
|
1000 a1._11 = v12;
|
|
1001 a1._12 = v2;
|
|
1002 a1._21 = -v2;
|
|
1003 a1._22 = v12;
|
|
1004 v10._22 = pIndoorCamera->fRotationXCosine;
|
|
1005 v10._32 = -pIndoorCamera->fRotationXSine;
|
|
1006 v10._23 = pIndoorCamera->fRotationXSine;
|
|
1007 v10._33 = pIndoorCamera->fRotationXCosine;
|
|
1008 a2._11 = pIndoorCamera->fRotationYCosine;
|
|
1009 a2._13 = -pIndoorCamera->fRotationYSine;
|
|
1010 a2._31 = pIndoorCamera->fRotationYSine;
|
|
1011 a2._33 = pIndoorCamera->fRotationYCosine;
|
|
1012 MatrixMultiply(&a1, &a2, &a3);
|
|
1013 MatrixMultiply(&v10, &a3, &v8);
|
|
1014 v3 = 0;
|
|
1015 v4 = (int)&v1->field_4.x;
|
|
1016 do
|
|
1017 {
|
|
1018 v5 = *(&v8._11 + v3++);
|
|
1019 *(float *)(v4 + 16) = v5;
|
|
1020 *(float *)v4 = *(float *)((char *)&v8._12 - (char *)v1 + v4);
|
|
1021 *(float *)(v4 + 32) = *(float *)((char *)&v8._22 - (char *)v1 + v4);
|
|
1022 v4 += 4;
|
|
1023 }
|
|
1024 while ( v3 < 3 );
|
|
1025 LODWORD(v1->field_D8) = 0x3F91361Du;
|
|
1026 v1->flt_D0 = (double)pViewport->uScreenWidth * 0.8814736;
|
|
1027 v6 = 0.8814736 * (double)pViewport->uScreenHeight;
|
|
1028 v1->flt_D4 = v6;
|
|
1029 if ( v1->flt_D0 > v6 )
|
|
1030 v6 = v1->flt_D0;
|
|
1031 v1->flt_fov = v6;
|
|
1032 v1->field_C8 = (double)pViewport->uScreenCenterX;
|
|
1033 v1->field_CC = (double)(pViewport->uScreenCenterY - pViewport->uScreenY);
|
|
1034 }
|
|
1035
|
|
1036
|
|
1037 //----- (00437691) --------------------------------------------------------
|
|
1038 IndoorCameraD3D_Vec3 *IndoorCameraD3D::Vec3Transform(const IndoorCameraD3D_Vec3 *pVector, IndoorCameraD3D_Vec3 *pOut)
|
|
1039 {
|
|
1040 IndoorCameraD3D_Vec3 *result; // eax@1
|
|
1041
|
|
1042 result = (IndoorCameraD3D_Vec3 *)pVector;
|
|
1043 pOut->y = this->field_14.x * pVector->x + this->field_4.x * pVector->y + this->field_24.x * pVector->z;
|
|
1044 pOut->z = this->field_14.y * result->x + this->field_4.y * result->y + this->field_24.y * result->z;
|
|
1045 pOut->x = this->field_14.z * result->x + this->field_4.z * result->y + this->field_24.z * pVector->z;
|
|
1046 return result;
|
|
1047 }
|
|
1048
|
|
1049 //----- (00437607) --------------------------------------------------------
|
|
1050 void IndoorCameraD3D::_437607(IndoorCameraD3D_Vec3 *a1, IndoorCameraD3D_Vec4 *a2)
|
|
1051 {
|
|
1052 IndoorCameraD3D *v3; // edi@1
|
|
1053 double v4; // st7@1
|
|
1054 signed int v5; // ecx@1
|
|
1055 char *v6; // eax@1
|
|
1056 double v7; // st6@2
|
|
1057 IndoorCameraD3D_Vec3 v8; // [sp+8h] [bp-1Ch]@1
|
|
1058 Vec3_float_ v9; // [sp+Ch] [bp-18h]@1
|
|
1059 int v10; // [sp+20h] [bp-4h]@1
|
|
1060
|
|
1061 v3 = this;
|
|
1062 //IndoorCameraD3D_Vec3::IndoorCameraD3D_Vec3(&v8);
|
|
1063 v10 = 0;
|
|
1064 v9.x = (double)pIndoorCamera->pos.x;
|
|
1065 v9.y = (double)pIndoorCamera->pos.y;
|
|
1066 v9.z = (double)pIndoorCamera->pos.z;
|
|
1067 Vec3Transform(a1, a2);
|
|
1068 v4 = 0.0;
|
|
1069 v5 = 0;
|
|
1070 v6 = (char *)&a2->x;
|
|
1071 do
|
|
1072 {
|
|
1073 v7 = *(&v9.x + v5++) * *(float *)v6;
|
|
1074 v6 += 4;
|
|
1075 v4 = v4 + v7;
|
|
1076 }
|
|
1077 while ( v5 < 3 );
|
|
1078 v10 = -1;
|
|
1079 a2->dot = v4 + 0.000099999997;
|
|
1080 //IndoorCameraD3D_Vec3::dtor(&v8);
|
|
1081 }
|
|
1082
|
|
1083 //----- (004374E8) --------------------------------------------------------
|
|
1084 void IndoorCameraD3D::_4374E8_ProllyBuildFrustrum()
|
|
1085 {
|
|
1086 IndoorCameraD3D *v1; // esi@1
|
|
1087 double v2; // st7@1
|
|
1088 double v3; // st7@1
|
|
1089 double v4; // st7@1
|
|
1090 double v5; // st7@1
|
|
1091 double v6; // st7@1
|
|
1092 IndoorCameraD3D_Vec3 v7; // [sp+Ch] [bp-24h]@1
|
|
1093 float v8; // [sp+10h] [bp-20h]@1
|
|
1094 float v9; // [sp+14h] [bp-1Ch]@1
|
|
1095 float v10; // [sp+18h] [bp-18h]@1
|
|
1096 float v11; // [sp+1Ch] [bp-14h]@1
|
|
1097 float v12; // [sp+20h] [bp-10h]@1
|
|
1098 int v13; // [sp+2Ch] [bp-4h]@1
|
|
1099
|
|
1100 v1 = this;
|
|
1101 //IndoorCameraD3D_Vec3::IndoorCameraD3D_Vec3(&v7);
|
|
1102 v2 = 2.0 / v1->field_D8;
|
|
1103 v13 = 0;
|
|
1104 v3 = atan(v2 * v1->flt_fov / v1->flt_D0);
|
|
1105 v12 = v3;
|
|
1106 v11 = sin(v3);
|
|
1107 v4 = cos(v12);
|
|
1108 v8 = -v11;
|
|
1109 v9 = 0.0;
|
|
1110 v10 = v4;
|
|
1111 _437607(&v7, v1->std__vector_000034_prolly_frustrum);
|
|
1112 v8 = v11;
|
|
1113 _437607(&v7, &v1->std__vector_000034_prolly_frustrum[1]);
|
|
1114 v5 = atan(2.0 / v1->field_D8 * v1->flt_fov / (v1->flt_D4 + 0.5));
|
|
1115 v12 = v5;
|
|
1116 v11 = sin(v5);
|
|
1117 v6 = cos(v12);
|
|
1118 v9 = v11;
|
|
1119 v8 = 0.0;
|
|
1120 v10 = v6;
|
|
1121 _437607(&v7, &v1->std__vector_000034_prolly_frustrum[2]);
|
|
1122 v9 = -v11;
|
|
1123 _437607(&v7, &v1->std__vector_000034_prolly_frustrum[3]);
|
|
1124 v13 = -1;
|
|
1125 //IndoorCameraD3D_Vec3::dtor(&v7);
|
|
1126 }
|
|
1127
|
|
1128 //----- (00437376) --------------------------------------------------------
|
|
1129 char IndoorCameraD3D::_437376(stru154 *thisa, RenderVertexSoft *a2, unsigned int *pOutNumVertices)
|
|
1130 {
|
|
1131 unsigned int v4; // ebx@1
|
|
1132 RenderVertexSoft *v5; // edx@2
|
|
1133 double v6; // st7@3
|
|
1134 unsigned int v7; // edi@5
|
|
1135 signed int v8; // esi@6
|
|
1136 int v9; // ebx@8
|
|
1137 int v10; // eax@8
|
|
1138 int v11; // ecx@14
|
|
1139 int v12; // eax@14
|
|
1140 int v13; // eax@15
|
|
1141 signed int v14; // ebx@17
|
|
1142 RenderVertexSoft *v15; // eax@18
|
|
1143 unsigned int *v16; // eax@20
|
|
1144 char result; // al@24
|
|
1145 RenderVertexSoft v18; // [sp+Ch] [bp-34h]@2
|
|
1146 int v19; // [sp+3Ch] [bp-4h]@8
|
|
1147 signed int thisb; // [sp+48h] [bp+8h]@6
|
|
1148 char a2_3; // [sp+4Fh] [bp+Fh]@5
|
|
1149
|
|
1150 v4 = *pOutNumVertices;
|
|
1151 if ( (signed int)*pOutNumVertices <= 3
|
|
1152 || ((v5 = a2,
|
|
1153 memcpy(&v18, a2, sizeof(v18)),
|
|
1154 (v18.vWorldPosition.z - (double)pBLVRenderParams->vPartyPos.z) * thisa->vNormal.z
|
|
1155 + (v18.vWorldPosition.y - (double)pBLVRenderParams->vPartyPos.y) * thisa->vNormal.y
|
|
1156 + (v18.vWorldPosition.x - (double)pBLVRenderParams->vPartyPos.x) * thisa->vNormal.x < 0.0) ? (v6 = 1.0) : (v6 = -1.0),
|
|
1157 a2_3 = 0,
|
|
1158 memcpy(&v5[v4], v5, sizeof(v5[v4])),
|
|
1159 memcpy(&v5[*pOutNumVertices + 1], &v5[1], sizeof(v5[*pOutNumVertices + 1])),
|
|
1160 v7 = *pOutNumVertices,
|
|
1161 (signed int)*pOutNumVertices <= 0) )
|
|
1162 goto LABEL_28;
|
|
1163 v8 = 1;
|
|
1164 for ( thisb = 1; ; v8 = thisb )
|
|
1165 {
|
|
1166 v9 = v8 - 1;
|
|
1167 v10 = v8 + 1;
|
|
1168 v19 = v8 + 1;
|
|
1169 if ( v8 - 1 >= (signed int)v7 )
|
|
1170 v9 -= v7;
|
|
1171 if ( v8 >= (signed int)v7 )
|
|
1172 v8 -= v7;
|
|
1173 if ( v19 >= (signed int)v7 )
|
|
1174 v10 = v19 - v7;
|
|
1175 v11 = (int)&v5[v10];
|
|
1176 v12 = (int)&v5[v9];
|
|
1177 if ( -0.009999999776482582 > ((v5[v8].vWorldViewProjX - *(float *)(v12 + 24))
|
|
1178 * (*(float *)(v11 + 28) - *(float *)(v12 + 28))
|
|
1179 - (v5[v8].vWorldViewProjY - *(float *)(v12 + 28))
|
|
1180 * (*(float *)(v11 + 24) - *(float *)(v12 + 24)))
|
|
1181 * v6 )
|
|
1182 {
|
|
1183 thisb = v19;
|
|
1184 v16 = pOutNumVertices;
|
|
1185 }
|
|
1186 else
|
|
1187 {
|
|
1188 v13 = thisb;
|
|
1189 if ( thisb >= (signed int)v7 )
|
|
1190 v13 = thisb - v7;
|
|
1191 v14 = v13;
|
|
1192 if ( v13 < (signed int)v7 )
|
|
1193 {
|
|
1194 v15 = &v5[v13];
|
|
1195 do
|
|
1196 {
|
|
1197 memcpy(v15, &v15[1], 0x30u);
|
|
1198 ++v14;
|
|
1199 ++v15;
|
|
1200 }
|
|
1201 while ( v14 < (signed int)*pOutNumVertices );
|
|
1202 }
|
|
1203 v16 = pOutNumVertices;
|
|
1204 a2_3 = 1;
|
|
1205 --*v16;
|
|
1206 }
|
|
1207 v7 = *v16;
|
|
1208 if ( thisb - 1 >= (signed int)*v16 )
|
|
1209 break;
|
|
1210 }
|
|
1211 if ( a2_3 )
|
|
1212 result = 1;
|
|
1213 else
|
|
1214 LABEL_28:
|
|
1215 result = 0;
|
|
1216 return result;
|
|
1217 }
|
|
1218
|
|
1219 //----- (00437285) --------------------------------------------------------
|
|
1220 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)
|
|
1221 {
|
|
1222 char *v8; // eax@2
|
|
1223 signed int v9; // ecx@2
|
|
1224 bool result; // eax@5
|
|
1225 int v11; // ecx@5
|
|
1226 signed int v12; // ecx@6
|
|
1227 char *v13; // esi@6
|
|
1228 RenderVertexSoft *v14; // eax@8
|
|
1229 RenderVertexSoft *v15; // edx@8
|
|
1230 Vec3_float_ a5; // [sp+18h] [bp-3Ch]@12
|
|
1231 float v17; // [sp+44h] [bp-10h]@1
|
|
1232 int v18; // [sp+48h] [bp-Ch]@5
|
|
1233 stru9 *thisa; // [sp+4Ch] [bp-8h]@1
|
|
1234 int a7a; // [sp+53h] [bp-1h]@5
|
|
1235 bool a6a; // [sp+70h] [bp+1Ch]@5
|
|
1236
|
|
1237 v17 = 0.0;
|
|
1238 thisa = pGame->pStru9Instance;
|
|
1239
|
|
1240
|
|
1241 static RenderVertexSoft sr_vertices_50D9D8[64];
|
|
1242 static bool __init_flag1 = false;
|
|
1243 if (!__init_flag1)
|
|
1244 {
|
|
1245 __init_flag1 = true;
|
|
1246
|
|
1247 for (uint i = 0; i < 64; ++i)
|
|
1248 sr_vertices_50D9D8[i].flt_2C = 0.0f;
|
|
1249 }
|
|
1250
|
|
1251 result = 0;
|
|
1252 LOBYTE(a7a) = 0;
|
|
1253 v11 = 2 * (a6 == 0) + 1;
|
|
1254 a6a = 0;
|
|
1255 v18 = v11;
|
|
1256 if ( uNumVertices <= 0 )
|
|
1257 {
|
|
1258 LABEL_14:
|
|
1259 LOBYTE(result) = a7a;
|
|
1260 }
|
|
1261 else
|
|
1262 {
|
|
1263 v12 = *pOutNumVertices;
|
|
1264 v13 = (char *)&a4->y;
|
|
1265 while ( 1 )
|
|
1266 {
|
|
1267 if ( result % 2 )
|
|
1268 {
|
|
1269 v14 = a1;
|
|
1270 v15 = sr_vertices_50D9D8;
|
|
1271 }
|
|
1272 else
|
|
1273 {
|
|
1274 v15 = a1;
|
|
1275 v14 = sr_vertices_50D9D8;
|
|
1276 }
|
|
1277 ++a6a;
|
|
1278 if ( a6a == uNumVertices )
|
|
1279 v14 = pVertices;
|
|
1280 a5.x = *((float *)v13 - 1);
|
|
1281 a5.y = *(float *)v13;
|
|
1282 a5.z = *((float *)v13 + 1);
|
|
1283 result = thisa->_4985FB(v15, v12, v14, pOutNumVertices, &a5, *((float *)v13 + 2), (char *)&a7a, _unused);
|
|
1284 v12 = *pOutNumVertices;
|
|
1285 if ( (signed int)*pOutNumVertices < v18 )
|
|
1286 break;
|
|
1287 result = a6a;
|
|
1288 v13 += 24;
|
|
1289 if ( a6a >= uNumVertices )
|
|
1290 goto LABEL_14;
|
|
1291 }
|
|
1292 *pOutNumVertices = 0;
|
|
1293 LOBYTE(result) = 1;
|
|
1294 }
|
|
1295 return result;
|
|
1296 }
|
|
1297 // 50E5D8: using guessed type char static_50D9D8_init_flag_bit1;
|
|
1298
|
|
1299 //----- (004371C3) --------------------------------------------------------
|
|
1300 bool IndoorCameraD3D::_4371C3(RenderVertexSoft *pVertices, unsigned int *pOutNumVertices, int _unused)
|
|
1301 {
|
|
1302 char *v4; // eax@2
|
|
1303 signed int v5; // ecx@2
|
|
1304 RenderVertexSoft *v6; // esi@5
|
|
1305 unsigned int *v7; // edi@5
|
|
1306 char *v8; // ecx@6
|
|
1307 int v9; // eax@6
|
|
1308 IndoorCameraD3D *thisa; // [sp+0h] [bp-Ch]@1
|
|
1309 signed int v12; // [sp+4h] [bp-8h]@5
|
|
1310 unsigned int pVerticesa; // [sp+14h] [bp+8h]@6
|
|
1311 unsigned int pOutNumVerticesa; // [sp+18h] [bp+Ch]@6
|
|
1312
|
|
1313 thisa = this;
|
|
1314
|
|
1315
|
|
1316 static RenderVertexSoft static_4371C3_array_50E5E0[64];
|
|
1317 static bool __init_flag1 = false;
|
|
1318 if (!__init_flag1)
|
|
1319 {
|
|
1320 __init_flag1 = true;
|
|
1321
|
|
1322 for (uint i = 0; i < 64; ++i)
|
|
1323 static_4371C3_array_50E5E0[i].flt_2C = 0.0f;
|
|
1324 }
|
|
1325
|
|
1326 v12 = 0;
|
|
1327 v6 = pVertices;
|
|
1328 v7 = pOutNumVertices;
|
|
1329 if ( (signed int)*pOutNumVertices > 0 )
|
|
1330 {
|
|
1331 pOutNumVerticesa = (char *)static_4371C3_array_50E5E0 - (char *)pVertices;
|
|
1332 pVerticesa = (char *)&static_4371C3_array_50E5E0[0].vWorldViewProjY - (char *)pVertices;
|
|
1333 v8 = (char *)&static_4371C3_array_50E5E0[0].vWorldPosition.y;
|
|
1334 v9 = (int)&v6->vWorldPosition.z;
|
|
1335 do
|
|
1336 {
|
|
1337 ++v12;
|
|
1338 *((int *)v8 - 1) = *(int *)(v9 - 8);
|
|
1339 *(int *)v8 = *(int *)(v9 - 4);
|
|
1340 v8 += 48;
|
|
1341 *(float *)(pOutNumVerticesa + v9) = *(float *)v9;
|
|
1342 *(float *)(pVerticesa + v9) = *(float *)(v9 + 28);
|
|
1343 *(float *)((char *)&static_4371C3_array_50E5E0[0].flt_20 - (char *)v6 + v9) = *(float *)(v9 + 32);
|
|
1344 v9 += 48;
|
|
1345 }
|
|
1346 while ( v12 < (signed int)*v7 );
|
|
1347 }
|
|
1348 return _437285_prolly_colide_vertices_against_frustrum(
|
|
1349 static_4371C3_array_50E5E0,
|
|
1350 v7,
|
|
1351 v6,
|
|
1352 thisa->std__vector_000034_prolly_frustrum,
|
|
1353 4,
|
|
1354 0,
|
|
1355 _unused);
|
|
1356 }
|
|
1357 // 50F1E0: using guessed type char static_sub_4371C3_byte_50F1E0_init_flags;
|
|
1358
|
|
1359 //----- (00437143) --------------------------------------------------------
|
|
1360 int IndoorCameraD3D::_437143(unsigned int uNumInVertices, RenderVertexSoft *pOutVertices, RenderVertexSoft *pInVertices, unsigned int *pOutNumVertices)
|
|
1361 {
|
|
1362 unsigned int v5; // edi@1
|
|
1363 char *pOutVertices_; // edx@2
|
|
1364 char *v7; // eax@2
|
|
1365 unsigned int v8; // ebx@2
|
|
1366 double v9; // st7@3
|
|
1367 double v10; // st6@3
|
|
1368 int result; // eax@5
|
|
1369 unsigned int a2a; // [sp+10h] [bp+Ch]@2
|
|
1370
|
|
1371 v5 = uNumInVertices;
|
|
1372 if ( (signed int)uNumInVertices > 0 )
|
|
1373 {
|
|
1374 pOutVertices_ = (char *)&pOutVertices->vWorldViewProjY;
|
|
1375 v7 = (char *)&pInVertices->flt_20;
|
|
1376 v8 = (char *)pOutVertices - (char *)pInVertices;
|
|
1377 a2a = uNumInVertices;
|
|
1378 do
|
|
1379 {
|
|
1380 *(float *)v7 = 1.0 / (*((float *)v7 - 5) + 0.0000001);
|
|
1381 memcpy(pOutVertices_ - 28, v7 - 32, 0x30u);
|
|
1382 v9 = (double)pOutdoorCamera->int_fov_rad * *(float *)&v7[v8];
|
|
1383 v10 = (double)pViewport->uScreenCenterX - v9 * *((float *)v7 - 4);
|
|
1384 v7 += 48;
|
|
1385 *((float *)pOutVertices_ - 1) = v10;
|
|
1386 *(float *)pOutVertices_ = (double)pViewport->uScreenCenterY - v9 * *((float *)v7 - 15);
|
|
1387 pOutVertices_ += 48;
|
|
1388 --a2a;
|
|
1389 }
|
|
1390 while ( a2a );
|
|
1391 v5 = uNumInVertices;
|
|
1392 }
|
|
1393 result = (int)pOutNumVertices;
|
|
1394 *pOutNumVertices = v5;
|
|
1395 return result;
|
|
1396 }
|
|
1397 //----- (00436F09) --------------------------------------------------------
|
|
1398 void IndoorCameraD3D::_436F09(RenderVertexSoft *pInVertices, int uNumInVertices, RenderVertexSoft *pOutVertices, unsigned int *pOutNumVertices)
|
|
1399 {
|
|
1400 unsigned int *pOutNumVertices_; // ebx@1
|
|
1401 double v6; // st7@2
|
|
1402 signed int v7; // esi@2
|
|
1403 char *v8; // edx@5
|
|
1404 unsigned int v9; // eax@10
|
|
1405 RenderVertexSoft *v10; // ecx@11
|
|
1406 double v11; // st6@11
|
|
1407 double v12; // st6@12
|
|
1408 unsigned int v13; // edi@14
|
|
1409 unsigned __int8 v14; // c2@16
|
|
1410 unsigned __int8 v15; // c3@16
|
|
1411 unsigned int v16; // edi@17
|
|
1412 bool a1a; // [sp+Ch] [bp+8h]@7
|
|
1413 int a4a; // [sp+18h] [bp+14h]@5
|
|
1414
|
|
1415 pOutNumVertices_ = pOutNumVertices;
|
|
1416 *pOutNumVertices = 0;
|
|
1417 if ( uNumInVertices )
|
|
1418 {
|
|
1419 memcpy(&pInVertices[uNumInVertices], pInVertices, sizeof(pInVertices[uNumInVertices]));
|
|
1420 v6 = (double)pOutdoorCamera->shading_dist_mist;
|
|
1421 v7 = 0;
|
|
1422 if ( v6 >= pInVertices->vWorldViewPosition.x )
|
|
1423 v7 = 1;
|
|
1424 if ( uNumInVertices + 1 > 1 )
|
|
1425 {
|
|
1426 a4a = uNumInVertices;
|
|
1427 v8 = (char *)&pInVertices[1].u;
|
|
1428 do
|
|
1429 {
|
|
1430 a1a = v6 >= *((float *)v8 - 6);
|
|
1431 if ( v7 == a1a )
|
|
1432 {
|
|
1433 v10 = pOutVertices;
|
|
1434 goto LABEL_23;
|
|
1435 }
|
|
1436 v9 = *pOutNumVertices_;
|
|
1437 if ( a1a )
|
|
1438 {
|
|
1439 v10 = pOutVertices;
|
|
1440 v11 = (v6 - *((float *)v8 - 18)) / (*((float *)v8 - 6) - *((float *)v8 - 18));
|
|
1441 pOutVertices[v9].vWorldViewPosition.y = (*((float *)v8 - 5) - *((float *)v8 - 17)) * v11 + *((float *)v8 - 17);
|
|
1442 pOutVertices[*pOutNumVertices_].vWorldViewPosition.z = (*((float *)v8 - 4) - *((float *)v8 - 16)) * v11
|
|
1443 + *((float *)v8 - 16);
|
|
1444 pOutVertices[*pOutNumVertices_].u = (*(float *)v8 - *((float *)v8 - 12)) * v11 + *((float *)v8 - 12);
|
|
1445 pOutVertices[*pOutNumVertices_].v = (*((float *)v8 + 1) - *((float *)v8 - 11)) * v11 + *((float *)v8 - 11);
|
|
1446 }
|
|
1447 else
|
|
1448 {
|
|
1449 v12 = (v6 - *((float *)v8 - 6)) / (*((float *)v8 - 18) - *((float *)v8 - 6));
|
|
1450 pOutVertices[v9].vWorldViewPosition.y = (*((float *)v8 - 17) - *((float *)v8 - 5)) * v12 + *((float *)v8 - 5);
|
|
1451 pOutVertices[*pOutNumVertices_].vWorldViewPosition.z = (*((float *)v8 - 16) - *((float *)v8 - 4)) * v12
|
|
1452 + *((float *)v8 - 4);
|
|
1453 pOutVertices[*pOutNumVertices_].u = (*((float *)v8 - 12) - *(float *)v8) * v12 + *(float *)v8;
|
|
1454 pOutVertices[*pOutNumVertices_].v = (*((float *)v8 - 11) - *((float *)v8 + 1)) * v12 + *((float *)v8 + 1);
|
|
1455 v10 = pOutVertices;
|
|
1456 }
|
|
1457 v10[*pOutNumVertices_].vWorldViewPosition.x = v6;
|
|
1458 v10[*pOutNumVertices_].flt_20 = 1.0 / v6;
|
|
1459 if ( v7 )
|
|
1460 {
|
|
1461 v13 = (unsigned int)&v10[*pOutNumVertices_];
|
|
1462 if ( *(float *)(v13 + 12) != *((float *)v8 - 18) || *(float *)(v13 + 16) != *((float *)v8 - 17) )
|
|
1463 goto LABEL_21;
|
|
1464 v14 = 0;
|
|
1465 v15 = *(float *)(v13 + 20) == *((float *)v8 - 16);
|
|
1466 }
|
|
1467 else
|
|
1468 {
|
|
1469 v16 = (unsigned int)&v10[*pOutNumVertices_];
|
|
1470 if ( *(float *)(v16 + 12) != *((float *)v8 - 6) || *(float *)(v16 + 16) != *((float *)v8 - 5) )
|
|
1471 {
|
|
1472 LABEL_21:
|
|
1473 ++*pOutNumVertices_;
|
|
1474 goto LABEL_23;
|
|
1475 }
|
|
1476 v14 = 0;
|
|
1477 v15 = *(float *)(v16 + 20) == *((float *)v8 - 4);
|
|
1478 }
|
|
1479 if ( !(v15 | v14) )
|
|
1480 goto LABEL_21;
|
|
1481 LABEL_23:
|
|
1482 if ( a1a )
|
|
1483 {
|
|
1484 memcpy(&v10[*pOutNumVertices_], v8 - 36, sizeof(v10[*pOutNumVertices_]));
|
|
1485 pOutVertices[*pOutNumVertices_].flt_20 = 1.0 / (*((float *)v8 - 6) + 0.0000001);
|
|
1486 pOutVertices[(*pOutNumVertices_)++].flt_2C = *((float *)v8 + 2);
|
|
1487 }
|
|
1488 v7 = a1a;
|
|
1489 v8 += 48;
|
|
1490 --a4a;
|
|
1491 }
|
|
1492 while ( a4a );
|
|
1493 }
|
|
1494 if ( (signed int)*pOutNumVertices_ < 3 )
|
|
1495 *pOutNumVertices_ = 0;
|
|
1496 }
|
|
1497 }
|
|
1498
|
|
1499
|
|
1500 //----- (00436CDC) --------------------------------------------------------
|
|
1501 void IndoorCameraD3D::_436CDC(RenderVertexSoft *pInVertices, int uNumInVertices, RenderVertexSoft *pOutVertices, unsigned int *pOutNumVertices)
|
|
1502 {
|
|
1503 signed int v5; // esi@2
|
|
1504 char *v6; // edx@5
|
|
1505 unsigned int v7; // eax@10
|
|
1506 RenderVertexSoft *v8; // ecx@11
|
|
1507 double v9; // st6@11
|
|
1508 double v10; // st6@12
|
|
1509 unsigned int v11; // edi@14
|
|
1510 unsigned __int8 v12; // c2@16
|
|
1511 unsigned __int8 v13; // c3@16
|
|
1512 unsigned int v14; // edi@17
|
|
1513 bool a1a; // [sp+Ch] [bp+8h]@7
|
|
1514
|
|
1515 if ( uNumInVertices )
|
|
1516 {
|
|
1517 *pOutNumVertices = 0;
|
|
1518 memcpy(&pInVertices[uNumInVertices], pInVertices, sizeof(pInVertices[uNumInVertices]));
|
|
1519 v5 = 0;
|
|
1520 if ( pInVertices->vWorldViewPosition.x >= 8.0 )
|
|
1521 v5 = 1;
|
|
1522 if ( uNumInVertices + 1 > 1 )
|
|
1523 {
|
|
1524 v6 = (char *)&pInVertices[1].u;
|
|
1525 do
|
|
1526 {
|
|
1527 a1a = *((float *)v6 - 6) >= 8.0;
|
|
1528 if ( v5 == a1a )
|
|
1529 {
|
|
1530 v8 = pOutVertices;
|
|
1531 goto LABEL_23;
|
|
1532 }
|
|
1533 v7 = *pOutNumVertices;
|
|
1534 if ( a1a )
|
|
1535 {
|
|
1536 v8 = pOutVertices;
|
|
1537 v9 = (8.0 - *((float *)v6 - 18)) / (*((float *)v6 - 6) - *((float *)v6 - 18));
|
|
1538 pOutVertices[v7].vWorldViewPosition.y = (*((float *)v6 - 5) - *((float *)v6 - 17)) * v9 + *((float *)v6 - 17);
|
|
1539 pOutVertices[*pOutNumVertices].vWorldViewPosition.z = (*((float *)v6 - 4) - *((float *)v6 - 16)) * v9
|
|
1540 + *((float *)v6 - 16);
|
|
1541 pOutVertices[*pOutNumVertices].u = (*(float *)v6 - *((float *)v6 - 12)) * v9 + *((float *)v6 - 12);
|
|
1542 pOutVertices[*pOutNumVertices].v = (*((float *)v6 + 1) - *((float *)v6 - 11)) * v9 + *((float *)v6 - 11);
|
|
1543 }
|
|
1544 else
|
|
1545 {
|
|
1546 v10 = (8.0 - *((float *)v6 - 6)) / (*((float *)v6 - 18) - *((float *)v6 - 6));
|
|
1547 pOutVertices[v7].vWorldViewPosition.y = (*((float *)v6 - 17) - *((float *)v6 - 5)) * v10 + *((float *)v6 - 5);
|
|
1548 pOutVertices[*pOutNumVertices].vWorldViewPosition.z = (*((float *)v6 - 16) - *((float *)v6 - 4)) * v10
|
|
1549 + *((float *)v6 - 4);
|
|
1550 pOutVertices[*pOutNumVertices].u = (*((float *)v6 - 12) - *(float *)v6) * v10 + *(float *)v6;
|
|
1551 pOutVertices[*pOutNumVertices].v = (*((float *)v6 - 11) - *((float *)v6 + 1)) * v10 + *((float *)v6 + 1);
|
|
1552 v8 = pOutVertices;
|
|
1553 }
|
|
1554 v8[*pOutNumVertices].vWorldViewPosition.x = 8.0;
|
|
1555 v8[*pOutNumVertices].flt_20 = 0.125;
|
|
1556 if ( v5 )
|
|
1557 {
|
|
1558 v11 = (unsigned int)&v8[*pOutNumVertices];
|
|
1559 if ( *(float *)(v11 + 12) != *((float *)v6 - 18) || *(float *)(v11 + 16) != *((float *)v6 - 17) )
|
|
1560 goto LABEL_21;
|
|
1561 v12 = 0;
|
|
1562 v13 = *(float *)(v11 + 20) == *((float *)v6 - 16);
|
|
1563 }
|
|
1564 else
|
|
1565 {
|
|
1566 v14 = (unsigned int)&v8[*pOutNumVertices];
|
|
1567 if ( *(float *)(v14 + 12) != *((float *)v6 - 6) || *(float *)(v14 + 16) != *((float *)v6 - 5) )
|
|
1568 {
|
|
1569 LABEL_21:
|
|
1570 ++*pOutNumVertices;
|
|
1571 goto LABEL_23;
|
|
1572 }
|
|
1573 v12 = 0;
|
|
1574 v13 = *(float *)(v14 + 20) == *((float *)v6 - 4);
|
|
1575 }
|
|
1576 if ( !(v13 | v12) )
|
|
1577 goto LABEL_21;
|
|
1578 LABEL_23:
|
|
1579 if ( a1a )
|
|
1580 {
|
|
1581 memcpy(&v8[*pOutNumVertices], v6 - 36, sizeof(v8[*pOutNumVertices]));
|
|
1582 pOutVertices[(*pOutNumVertices)++].flt_20 = 1.0 / (*((float *)v6 - 6) + 0.0000001);
|
|
1583 }
|
|
1584 v5 = a1a;
|
|
1585 v6 += 48;
|
|
1586 --uNumInVertices;
|
|
1587 }
|
|
1588 while ( uNumInVertices );
|
|
1589 }
|
|
1590 if ( (signed int)*pOutNumVertices < 3 )
|
|
1591 *pOutNumVertices = 0;
|
|
1592 }
|
|
1593 }
|
|
1594
|
|
1595
|
|
1596 //----- (00436BB7) --------------------------------------------------------
|
|
1597 void IndoorCameraD3D::_436BB7_project_and_stuff(RenderVertexSoft *pVertices, unsigned int uNumVertices, char a4)
|
|
1598 {
|
|
1599 unsigned int v4; // ebx@1
|
|
1600 IndoorCameraD3D *v5; // edi@1
|
|
1601 float *v6; // esi@2
|
|
1602 double v7; // st7@7
|
|
1603 double v8; // st7@9
|
|
1604 double v9; // st6@10
|
|
1605 double v10; // st5@12
|
|
1606 double v11; // st7@16
|
|
1607 double v12; // st6@17
|
|
1608 double v13; // st5@19
|
|
1609 float uNumVerticesa; // [sp+14h] [bp+Ch]@13
|
|
1610 float uNumVerticesb; // [sp+14h] [bp+Ch]@20
|
|
1611
|
|
1612 v4 = uNumVertices;
|
|
1613 v5 = this;
|
|
1614 if ( (signed int)uNumVertices > 0 )
|
|
1615 {
|
|
1616 v6 = &pVertices->vWorldViewProjX;
|
|
1617 do
|
|
1618 {
|
|
1619 if ( byte_4D864C && pGame->uFlags & 0x80 || uCurrentlyLoadedLevelType == LEVEL_Indoor)
|
|
1620 {
|
|
1621 v7 = 1.0 / *(v6 - 3);
|
|
1622 *v6 = *(v6 - 2) * v5->flt_fov * v7 + v5->field_C8;
|
|
1623 v6[1] = (double)(signed int)pViewport->uViewportW - (*(v6 - 1) * v5->flt_fov * v7 + v5->field_CC);
|
|
1624 }
|
|
1625 else
|
|
1626 {
|
|
1627 extern void _outdoor_project(RenderVertexSoft *v);
|
|
1628 _outdoor_project((RenderVertexSoft *)(v6 - 6));
|
|
1629 }
|
|
1630 if ( a4 )
|
|
1631 {
|
|
1632 v8 = (double)(signed int)pViewport->uViewportZ;
|
|
1633 if ( v8 >= *v6 )
|
|
1634 v9 = *v6;
|
|
1635 else
|
|
1636 v9 = v8;
|
|
1637 v10 = (double)(signed int)pViewport->uViewportX;
|
|
1638 if ( v10 <= v9 )
|
|
1639 {
|
|
1640 if ( v8 >= *v6 )
|
|
1641 v8 = *v6;
|
|
1642 }
|
|
1643 else
|
|
1644 {
|
|
1645 uNumVerticesa = v10;
|
|
1646 v8 = uNumVerticesa;
|
|
1647 }
|
|
1648 *v6 = v8;
|
|
1649 v11 = (double)(signed int)pViewport->uViewportW;
|
|
1650 if ( v11 >= v6[1] )
|
|
1651 v12 = v6[1];
|
|
1652 else
|
|
1653 v12 = v11;
|
|
1654 v13 = (double)(signed int)pViewport->uViewportY;
|
|
1655 if ( v13 <= v12 )
|
|
1656 {
|
|
1657 if ( v11 >= v6[1] )
|
|
1658 v11 = v6[1];
|
|
1659 }
|
|
1660 else
|
|
1661 {
|
|
1662 uNumVerticesb = v13;
|
|
1663 v11 = uNumVerticesb;
|
|
1664 }
|
|
1665 v6[1] = v11;
|
|
1666 }
|
|
1667 v6 += 12;
|
|
1668 --v4;
|
|
1669 }
|
|
1670 while ( v4 );
|
|
1671 }
|
|
1672 }
|
|
1673
|
|
1674
|
|
1675 //----- (00436A9A) --------------------------------------------------------
|
|
1676 void IndoorCameraD3D::Project(signed int x, signed int y, signed int z, int *a5, int *a6)
|
|
1677 {
|
|
1678 double v6; // ST00_8@2
|
|
1679 double v7; // ST08_8@2
|
|
1680 double v8; // ST00_8@2
|
|
1681 signed __int64 v9; // qtt@3
|
|
1682 int v10; // ST04_4@3
|
|
1683 float a2a; // [sp+18h] [bp+8h]@2
|
|
1684 float a2b; // [sp+18h] [bp+8h]@2
|
|
1685
|
|
1686 if ( pRenderer->pRenderD3D )
|
|
1687 {
|
|
1688 v6 = 1.0 / (double)x;
|
|
1689 a2a = (double)y * this->flt_fov * v6 + this->field_C8;
|
|
1690 v7 = a2a + 6.7553994e15;
|
|
1691 *a5 = LODWORD(v7);
|
|
1692 a2b = (double)z * this->flt_fov * v6 + this->field_CC;
|
|
1693 v8 = a2b + 6.7553994e15;
|
|
1694 *a6 = pViewport->uViewportW - LODWORD(v8);
|
|
1695 }
|
|
1696 else
|
|
1697 {
|
|
1698 LODWORD(v9) = pBLVRenderParams->field_40 << 16;
|
|
1699 HIDWORD(v9) = pBLVRenderParams->field_40 >> 16;
|
|
1700 v10 = v9 / x;
|
|
1701 LODWORD(v9) = pBLVRenderParams->field_40 << 16;
|
|
1702 HIDWORD(v9) = pBLVRenderParams->field_40 >> 16;
|
|
1703 *a5 = pBLVRenderParams->uViewportCenterX
|
|
1704 - ((signed int)(((unsigned __int64)(v10 * (signed __int64)y) >> 16) + 32768) >> 16);
|
|
1705 *a6 = pBLVRenderParams->uViewportCenterY - ((signed int)(((unsigned __int64)(v9 / x * z) >> 16) + 32768) >> 16);
|
|
1706 }
|
|
1707 }
|
|
1708
|
|
1709 //----- (00436A6D) --------------------------------------------------------
|
|
1710 double IndoorCameraD3D::GetPolygonMinZ(RenderVertexSoft *pVertices, unsigned int uStripType)
|
|
1711 {
|
|
1712 unsigned int v3; // edx@1
|
|
1713 double result; // st7@1
|
|
1714 float *v5; // ecx@2
|
|
1715
|
|
1716 v3 = uStripType;
|
|
1717 result = 3.4028235e38;
|
|
1718 if ( (signed int)uStripType > 0 )
|
|
1719 {
|
|
1720 v5 = &pVertices->vWorldPosition.z;
|
|
1721 do
|
|
1722 {
|
|
1723 if ( *v5 < result )
|
|
1724 result = *v5;
|
|
1725 v5 += 12;
|
|
1726 --v3;
|
|
1727 }
|
|
1728 while ( v3 );
|
|
1729 }
|
|
1730 return result;
|
|
1731 }
|
|
1732
|
|
1733
|
|
1734 //----- (00436A24) --------------------------------------------------------
|
|
1735 struct IDirect3DTexture2 *IndoorCameraD3D::LoadTextureAndGetHardwarePtr(char *Str1)
|
|
1736 {
|
|
1737 return pBitmaps_LOD->pHardwareTextures[pBitmaps_LOD->LoadTexture(Str1)];
|
|
1738 }
|
|
1739
|
|
1740 //----- (00436A40) --------------------------------------------------------
|
|
1741 double IndoorCameraD3D::GetPolygonMaxZ(RenderVertexSoft *pVertex, unsigned int uStripType)
|
|
1742 {
|
|
1743 unsigned int v3; // edx@1
|
|
1744 double result; // st7@1
|
|
1745 float *v5; // ecx@2
|
|
1746
|
|
1747 v3 = uStripType;
|
|
1748 result = 1.1754944e-38;
|
|
1749 if ( (signed int)uStripType > 0 )
|
|
1750 {
|
|
1751 v5 = &pVertex->vWorldPosition.z;
|
|
1752 do
|
|
1753 {
|
|
1754 if ( *v5 > result )
|
|
1755 result = *v5;
|
|
1756 v5 += 12;
|
|
1757 --v3;
|
|
1758 }
|
|
1759 while ( v3 );
|
|
1760 }
|
|
1761 return result;
|
|
1762 } |