0
|
1 #include "Vis.h"
|
|
2 #include "Outdoor.h"
|
|
3 #include "Game.h"
|
|
4 #include "Actor.h"
|
|
5 #include "IndoorCamera.h"
|
|
6 #include "Viewport.h"
|
|
7 #include "stru157.h"
|
|
8
|
|
9 #include "mm7_data.h"
|
|
10 //#include "MM7.h"
|
|
11
|
|
12
|
|
13 static Vis_stru1 Vis_static_sub_4C1944_stru_F8BDE8;
|
|
14
|
|
15
|
|
16
|
|
17 //----- (004C1026) --------------------------------------------------------
|
|
18 Vis_stru1_stru0 *Vis::_4C1026(BLVFace *a2, unsigned int a3, float a4)
|
|
19 {
|
|
20 char *v4; // eax@4
|
|
21 signed int v5; // ecx@4
|
|
22 BLVFace *v6; // ecx@7
|
|
23 unsigned int v7; // edi@7
|
|
24 Vec3_short_ *v8; // eax@9
|
|
25 char *v9; // edx@9
|
|
26 signed int v10; // esi@10
|
|
27 Vec3_int_ **v11; // edx@13
|
|
28 char *v12; // eax@13
|
|
29 double v13; // st7@14
|
|
30 signed int v14; // ebx@14
|
|
31 Vis *v15; // ebx@15
|
|
32 Vis_stru1_stru0 *result; // eax@21
|
|
33 Vis_stru1_stru0 *v17; // ecx@24
|
|
34 RenderVertexSoft pRay[2]; // [sp+20h] [bp-70h]@17
|
|
35 int v20; // [sp+84h] [bp-Ch]@10
|
|
36 int v21; // [sp+88h] [bp-8h]@16
|
|
37 int v22; // [sp+8Ch] [bp-4h]@16
|
|
38 signed int v23; // [sp+98h] [bp+8h]@7
|
|
39
|
|
40 auto ecx0 = this;
|
|
41
|
|
42 static Vis_stru1 static_sub_4C1026_stru_F8FE00;
|
|
43 static_sub_4C1026_stru_F8FE00.uNumPointers = 0;
|
|
44
|
|
45 static bool _init_flag = false;
|
|
46 static RenderVertexSoft static_sub_4C1026_array_F8F200[64];
|
|
47 if (!_init_flag)
|
|
48 {
|
|
49 _init_flag = true;
|
|
50 for (uint i = 0; i < 64; ++i)
|
|
51 static_sub_4C1026_array_F8F200[i].flt_2C = 0.0f;
|
|
52 }
|
|
53
|
|
54 v6 = a2;
|
|
55 v23 = 0;
|
|
56 v7 = v6->uNumVertices;
|
|
57 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
|
|
58 {
|
|
59 if ( (signed int)v7 > 0 )
|
|
60 {
|
|
61 v8 = pIndoor->pVertices;
|
|
62 v9 = (char *)&static_sub_4C1026_array_F8F200[0].vWorldPosition.y;
|
|
63 do
|
|
64 {
|
|
65 v10 = v23++;
|
|
66 v20 = v8[v6->pVertexIDs[v10]].x;
|
|
67 *((float *)v9 - 1) = (double)v20;
|
|
68 v20 = v8[v6->pVertexIDs[v10]].y;
|
|
69 *(float *)v9 = (double)v20;
|
|
70 v9 += 48;
|
|
71 v20 = v8[v6->pVertexIDs[v10]].z;
|
|
72 *((float *)v9 - 11) = (double)v20;
|
|
73 }
|
|
74 while ( v23 < (signed int)v7 );
|
|
75 }
|
|
76 }
|
|
77 else
|
|
78 {
|
|
79 if ( (signed int)v7 > 0 )
|
|
80 {
|
|
81 v11 = &pOutdoor->pBModels[a3 >> 9].pVertices.pVertices;
|
|
82 v12 = (char *)&static_sub_4C1026_array_F8F200[0].vWorldPosition.y;
|
|
83 do
|
|
84 {
|
|
85 *((float *)v12 - 1) = (double)(*v11)[v6->pVertexIDs[v23]].x;
|
|
86 v13 = (double)(*v11)[v6->pVertexIDs[v23]].y;
|
|
87 v14 = v23++;
|
|
88 *(float *)v12 = v13;
|
|
89 v12 += 48;
|
|
90 *((float *)v12 - 11) = (double)(*v11)[v6->pVertexIDs[v14]].z;
|
|
91 }
|
|
92 while ( v23 < (signed int)v7 );
|
|
93 }
|
|
94 }
|
|
95 pGame->pIndoorCameraD3D->ViewTransform(static_sub_4C1026_array_F8F200, v7);
|
59
|
96 pGame->pIndoorCameraD3D->Project(static_sub_4C1026_array_F8F200, v7, 1);
|
0
|
97 v15 = this;
|
|
98 SortVectors_x(static_sub_4C1026_array_F8F200, 0, v7 - 1);
|
|
99 if ( static_sub_4C1026_array_F8F200[0].vWorldViewPosition.x > (double)a4
|
|
100 || (_4C1495(static_sub_4C1026_array_F8F200, v7, (float *)&v21, (float *)&v22),
|
|
101 _4C12C3_FindSomeBillboard(static_sub_4C1026_array_F8F200, v7, *(float *)&v21, *(float *)&v22))
|
|
102 || ((CastPickRay(pRay, *(float *)&v21, *(float *)&v22, a4), uCurrentlyLoadedLevelType != LEVEL_Indoor) ? PickOutdoor(a4, pRay, &static_sub_4C1026_stru_F8FE00, &a5, 1) : PickIndoor(a4, pRay, &static_sub_4C1026_stru_F8FE00, &a5),
|
|
103 (static_sub_4C1026_stru_F8FE00.create_object_pointers(0),
|
|
104 sort_object_pointers(
|
|
105 static_sub_4C1026_stru_F8FE00.array_1804,
|
|
106 0,
|
|
107 static_sub_4C1026_stru_F8FE00.uNumPointers - 1),
|
|
108 !static_sub_4C1026_stru_F8FE00.uNumPointers)
|
|
109 || (result = static_sub_4C1026_stru_F8FE00.sub_4C2551(2, a3)) == 0
|
|
110 || (signed int)static_sub_4C1026_stru_F8FE00.uNumPointers > 1
|
|
111 && ((signed int)static_sub_4C1026_stru_F8FE00.uNumPointers <= 0 ? (v17 = 0) : (v17 = static_sub_4C1026_stru_F8FE00.array_1804[0]),
|
|
112 result != v17)) )
|
|
113 result = 0;
|
|
114 return result;
|
|
115 }
|
|
116 // F91E08: using guessed type char static_sub_4C1026_byte_F91E08__init_flags;
|
|
117
|
|
118 //----- (004C12C3) --------------------------------------------------------
|
|
119 char Vis::_4C12C3_FindSomeBillboard(RenderVertexSoft *a1, int a2, float a3, float a4)
|
|
120 {
|
|
121 signed int v5; // esi@1
|
|
122 char *v6; // edi@2
|
|
123 double v7; // st7@9
|
|
124 int v8; // edx@9
|
|
125 char *v9; // ecx@10
|
|
126 char result; // al@24
|
|
127 Vis *thisa; // [sp+10h] [bp-8h]@1
|
|
128 float thisb; // [sp+10h] [bp-8h]@9
|
|
129 signed int v13; // [sp+14h] [bp-4h]@1
|
|
130 float a3a; // [sp+28h] [bp+10h]@9
|
|
131 float a4a; // [sp+2Ch] [bp+14h]@9
|
|
132
|
|
133 v13 = -1;
|
|
134 v5 = 0;
|
|
135 thisa = this;
|
|
136 if ( (signed int)pRenderer->uNumBillboardsToDraw <= 0 )
|
|
137 goto LABEL_28;
|
|
138 v6 = (char *)&pRenderer->pBillboardRenderListD3D[0].uParentBillboardID;
|
|
139 do
|
|
140 {
|
|
141 if ( IsPointInsideD3DBillboard((RenderBillboardD3D *)(v6 - 152), a3, a4)
|
|
142 && (v13 == -1
|
|
143 || (unsigned int)pBillboardRenderList[*(int *)v6].sZValue < pBillboardRenderList[pRenderer->pBillboardRenderListD3D[v13].uParentBillboardID].sZValue) )
|
|
144 v13 = v5;
|
|
145 ++v5;
|
|
146 v6 += 156;
|
|
147 }
|
|
148 while ( v5 < (signed int)pRenderer->uNumBillboardsToDraw );
|
|
149 if ( v13 == -1 )
|
|
150 goto LABEL_28;
|
|
151 v7 = 3.4028235e38;
|
|
152 v8 = a2;
|
|
153 a4a = 3.4028235e38;
|
|
154 a3a = -3.4028235e38;
|
|
155 thisb = -3.4028235e38;
|
|
156 if ( a2 > 0 )
|
|
157 {
|
|
158 v9 = (char *)&a1->vWorldViewProjY;
|
|
159 do
|
|
160 {
|
|
161 if ( *((float *)v9 - 1) < v7 )
|
|
162 v7 = *((float *)v9 - 1);
|
|
163 if ( *((float *)v9 - 1) > (double)a3a )
|
|
164 a3a = *((float *)v9 - 1);
|
|
165 if ( *(float *)v9 < (double)a4a )
|
|
166 a4a = *(float *)v9;
|
|
167 if ( *(float *)v9 > (double)thisb )
|
|
168 thisb = *(float *)v9;
|
|
169 v9 += 48;
|
|
170 --v8;
|
|
171 }
|
|
172 while ( v8 );
|
|
173 }
|
|
174 if ( v7 < pRenderer->pBillboardRenderListD3D[v13].pQuards[0].pos.x
|
|
175 || pRenderer->pBillboardRenderListD3D[v13].pQuards[0].pos.y > (double)a4a
|
|
176 || pRenderer->pBillboardRenderListD3D[v13].pQuards[3].pos.x < (double)a3a
|
|
177 || pRenderer->pBillboardRenderListD3D[v13].pQuards[1].pos.y < (double)thisb )
|
|
178 LABEL_28:
|
|
179 result = 0;
|
|
180 else
|
|
181 result = 1;
|
|
182 return result;
|
|
183 }
|
|
184
|
|
185 //----- (004C1417) --------------------------------------------------------
|
|
186 void Vis::GetPolygonCenter(RenderVertexD3D3 *pVertices, unsigned int uNumVertices, float *pCenterX, float *pCenterY)
|
|
187 {
|
|
188 static RenderVertexD3D3 unk_F8EA00[64];
|
|
189
|
|
190 memcpy(unk_F8EA00, pVertices, 32 * uNumVertices);
|
|
191
|
|
192 SortVerticesByX(unk_F8EA00, 0, uNumVertices - 1);
|
|
193 *pCenterX = (unk_F8EA00[uNumVertices - 1].pos.x - unk_F8EA00[0].pos.x) * 0.5 + unk_F8EA00[0].pos.x;
|
|
194
|
|
195 SortVerticesByY(unk_F8EA00, 0, uNumVertices - 1);
|
|
196 *pCenterY = (unk_F8EA00[uNumVertices - 1].pos.y - unk_F8EA00[0].pos.y) * 0.5 + unk_F8EA00[0].pos.y;
|
|
197 }
|
|
198
|
|
199 //----- (004C1495) --------------------------------------------------------
|
|
200 float *Vis::_4C1495(RenderVertexSoft *Src, int a2, float *a3, float *a4)
|
|
201 {
|
|
202 char *v5; // eax@2
|
|
203 signed int v6; // ecx@2
|
|
204 float *result; // eax@5
|
|
205 Vis *thisa; // [sp+0h] [bp-4h]@1
|
|
206
|
|
207 thisa = this;
|
|
208
|
|
209 static bool static_sub_4C1495_byte_F8E9F8__init_flags = false; // weak
|
|
210 static RenderVertexSoft static_sub_4C1495_array_F8DDF8[64];
|
|
211 if ( !static_sub_4C1495_byte_F8E9F8__init_flags )
|
|
212 {
|
|
213 static_sub_4C1495_byte_F8E9F8__init_flags = true;
|
|
214
|
|
215 for (uint i = 0; i < 64; ++i)
|
|
216 static_sub_4C1495_array_F8DDF8[i].flt_2C = 0.0f;
|
|
217 }
|
|
218
|
|
219 memcpy(static_sub_4C1495_array_F8DDF8, Src, 48 * a2);
|
|
220 sort_objects_2(static_sub_4C1495_array_F8DDF8, 0, a2 - 1);
|
|
221 *a3 = (*(float *)&Vis_static_sub_4C1944_stru_F8BDE8.array_1804[12 * a2 + 509]
|
|
222 - static_sub_4C1495_array_F8DDF8[0].vWorldViewProjX)
|
|
223 * 0.5
|
|
224 + static_sub_4C1495_array_F8DDF8[0].vWorldViewProjX;
|
|
225 sort_objects_3(static_sub_4C1495_array_F8DDF8, 0, a2 - 1);
|
|
226 result = a4;
|
|
227 *a4 = (*(float *)&Vis_static_sub_4C1944_stru_F8BDE8.array_1804[12 * a2 + 510]
|
|
228 - static_sub_4C1495_array_F8DDF8[0].vWorldViewProjY)
|
|
229 * 0.5
|
|
230 + static_sub_4C1495_array_F8DDF8[0].vWorldViewProjY;
|
|
231 return result;
|
|
232 }
|
|
233
|
|
234 //----- (004C1542) --------------------------------------------------------
|
|
235 void Vis::PickBillboards(float fPickDepth, float fX, float fY, Vis_stru1 *a4, stru157 *a2)
|
|
236 {
|
|
237 int v6; // ST1C_4@6
|
|
238 Vis_stru1_stru0 *v7; // edi@6
|
|
239 Vis *thisa; // [sp+20h] [bp-Ch]@1
|
|
240 void **v9; // [sp+24h] [bp-8h]@2
|
|
241 unsigned int uD3DBillboardIdx; // [sp+28h] [bp-4h]@1
|
|
242
|
|
243 uD3DBillboardIdx = 0;
|
|
244 thisa = this;
|
|
245 if ( (signed int)pRenderer->uNumBillboardsToDraw > 0 )
|
|
246 {
|
|
247 v9 = (void **)&pRenderer->pBillboardRenderListD3D[0].uParentBillboardID;
|
|
248 do
|
|
249 {
|
|
250 if ( is_part_of_selection((BLVFace *)uD3DBillboardIdx, a2)
|
|
251 && IsPointInsideD3DBillboard((RenderBillboardD3D *)(v9 - 38), fX, fY) )
|
|
252 {
|
|
253 if ( DoesRayIntersectBillboard(fPickDepth, uD3DBillboardIdx) )
|
|
254 {
|
|
255 v6 = pBillboardRenderList[(int)*v9].sZValue;
|
|
256 v7 = &a4->array_0004[a4->uNumPointers];
|
|
257 v7->pObjectInfo = *v9;
|
|
258 v7 = (Vis_stru1_stru0 *)((char *)v7 + 4);
|
|
259 v7->pObjectInfo = (void *)v6;
|
|
260 v7->sZValue = 1;
|
|
261 ++a4->uNumPointers;
|
|
262 }
|
|
263 }
|
|
264 ++uD3DBillboardIdx;
|
|
265 v9 += 39;
|
|
266 }
|
|
267 while ( (signed int)uD3DBillboardIdx < (signed int)pRenderer->uNumBillboardsToDraw );
|
|
268 }
|
|
269 }
|
|
270
|
|
271 //----- (004C1607) --------------------------------------------------------
|
|
272 bool Vis::IsPointInsideD3DBillboard(RenderBillboardD3D *a1, float x, float y)
|
|
273 {
|
|
274 RenderBillboardD3D *result; // eax@1
|
|
275 double v5; // st7@2
|
|
276 float v6; // ecx@2
|
|
277 float v7; // ST00_4@3
|
|
278 __int16 v8; // fps@6
|
|
279 double v9; // st6@6
|
|
280 char v10; // c0@6
|
|
281 char v11; // c2@6
|
|
282 char v12; // c3@6
|
|
283 __int16 v13; // fps@7
|
|
284 double v14; // st6@7
|
|
285 unsigned __int8 v15; // c0@7
|
|
286 char v16; // c2@7
|
|
287 unsigned __int8 v17; // c3@7
|
|
288 __int16 v18; // fps@8
|
|
289 double v19; // st6@8
|
|
290 char v20; // c0@8
|
|
291 char v21; // c2@8
|
|
292 char v22; // c3@8
|
|
293 __int16 v23; // fps@9
|
|
294 double v24; // st6@9
|
|
295 unsigned __int8 v25; // c0@9
|
|
296 char v26; // c2@9
|
|
297 unsigned __int8 v27; // c3@9
|
|
298 float v28; // [sp+4h] [bp-8h]@2
|
|
299 float v29; // [sp+8h] [bp-4h]@2
|
|
300 float a1a; // [sp+14h] [bp+8h]@2
|
|
301
|
|
302 result = a1;
|
|
303 if ( a1->uParentBillboardID == -1 )
|
|
304 goto LABEL_14;
|
|
305 v5 = a1->pQuards[0].pos.x;
|
|
306 a1a = a1->pQuards[3].pos.x;
|
|
307 v6 = result->pQuards[0].pos.y;
|
|
308 result = (RenderBillboardD3D *)LODWORD(result->pQuards[1].pos.y);
|
|
309 v29 = v6;
|
|
310 LODWORD(v28) = (int)result;
|
|
311 if ( v5 > a1a )
|
|
312 {
|
|
313 v7 = v5;
|
|
314 HIWORD(result) = HIWORD(v7);
|
|
315 v5 = a1a;
|
|
316 a1a = v7;
|
|
317 }
|
|
318 if ( v6 > (double)v28 )
|
|
319 {
|
|
320 result = (RenderBillboardD3D *)LODWORD(v28);
|
|
321 v28 = v6;
|
|
322 LODWORD(v29) = (int)result;
|
|
323 }
|
|
324 v9 = x + 1.0;
|
|
325 //UNDEF(v8);
|
|
326 v10 = v9 < v5;
|
|
327 v11 = 0;
|
|
328 v12 = v9 == v5;
|
|
329 BYTE1(result) = HIBYTE(v8);
|
|
330 if ( v9 >= v5
|
|
331 && (v14 = x - 1.0, /*UNDEF(v13),*/ v15 = v14 < a1a, v16 = 0, v17 = v14 == a1a, BYTE1(result) = HIBYTE(v13), v15 | v17)
|
|
332 && (v19 = y + 1.0, /*UNDEF(v18),*/ v20 = v19 < v29, v21 = 0, v22 = v19 == v29, BYTE1(result) = HIBYTE(v18), v19 >= v29)
|
|
333 && (v24 = y - 1.0, /*UNDEF(v23),*/ v25 = v24 < v28, v26 = 0, v27 = v24 == v28, BYTE1(result) = HIBYTE(v23), v25 | v27) )
|
|
334 LOBYTE(result) = 1;
|
|
335 else
|
|
336 LABEL_14:
|
|
337 LOBYTE(result) = 0;
|
|
338 return (bool)result;
|
|
339 }
|
|
340
|
|
341 //----- (004C16B4) --------------------------------------------------------
|
|
342 void Vis::PickIndoor(float fDepth, RenderVertexSoft *pRay, Vis_stru1 *a4, stru157 *a5)
|
|
343 {
|
|
344 int v5; // eax@1
|
|
345 signed int v6; // edi@2
|
|
346 signed int v7; // esi@4
|
|
347 int v8; // ecx@7
|
|
348 int v9; // eax@7
|
|
349 unsigned int *pNumPointers; // eax@7
|
|
350 unsigned int v11; // ecx@7
|
|
351 Vis_stru1_stru0 *v12; // edi@7
|
|
352 RenderVertexSoft a1; // [sp+Ch] [bp-44h]@1
|
|
353 BLVFace *v14; // [sp+3Ch] [bp-14h]@7
|
|
354 void *v15; // [sp+40h] [bp-10h]@7
|
|
355 int v16; // [sp+44h] [bp-Ch]@7
|
|
356 int v17; // [sp+48h] [bp-8h]@1
|
|
357 Vis *thisa; // [sp+4Ch] [bp-4h]@1
|
|
358
|
|
359 v5 = 0;
|
|
360 thisa = this;
|
|
361 v17 = 0;
|
|
362 for ( a1.flt_2C = 0.0; v17 < (signed int)pStru170->uNumFaceIDs; ++v17 )
|
|
363 {
|
|
364 v6 = pStru170->pFaceIDs[2 * v5];
|
|
365 if ( v6 >= 0 )
|
|
366 {
|
|
367 if ( v6 < (signed int)pIndoor->uNumFaces )
|
|
368 {
|
|
369 v7 = v6;
|
|
370 if ( is_part_of_selection(&pIndoor->pFaces[v6], a5) )
|
|
371 {
|
59
|
372 if ( !pGame->pIndoorCameraD3D->IsCulled(&pIndoor->pFaces[v7]) )
|
0
|
373 {
|
|
374 if ( Intersect_Ray_Face(pRay, pRay + 1, &fDepth, &a1, &pIndoor->pFaces[v7], 0xFFFFFFFFu) )
|
|
375 {
|
|
376 pGame->pIndoorCameraD3D->ViewTransform(&a1, 1u);
|
|
377 v9 = _48B561_mess_with_scaling_along_z(/*v8, */a1.vWorldViewPosition.x);
|
|
378 LOWORD(v9) = 0;
|
|
379 v15 = (void *)((8 * v6 | 6) + v9);
|
|
380 pNumPointers = &a4->uNumPointers;
|
|
381 v16 = 2;
|
|
382 v11 = a4->uNumPointers;
|
|
383 v14 = &pIndoor->pFaces[v7];
|
|
384 v12 = &a4->array_0004[v11];
|
|
385 v12->pObjectInfo = &pIndoor->pFaces[v7];
|
|
386 v12 = (Vis_stru1_stru0 *)((char *)v12 + 4);
|
|
387 v12->pObjectInfo = v15;
|
|
388 v12->sZValue = v16;
|
|
389 ++*pNumPointers;
|
|
390 }
|
|
391 }
|
|
392 }
|
|
393 }
|
|
394 }
|
|
395 v5 = v17 + 1;
|
|
396 }
|
|
397 }
|
|
398
|
|
399 //----- (004C17CF) --------------------------------------------------------
|
|
400 void Vis::PickOutdoor(float fDepth, RenderVertexSoft *pRay, Vis_stru1 *a4, stru157 *a5, char a6)
|
|
401 {
|
|
402 int v6; // esi@1
|
|
403 unsigned int v7; // ecx@1
|
|
404 BSPModel *v8; // ebx@3
|
|
405 bool v9; // eax@3
|
|
406 int v10; // eax@8
|
|
407 ODMFace *v11; // esi@10
|
|
408 int v12; // ecx@12
|
|
409 int v13; // eax@12
|
|
410 unsigned int *pNumPointers; // eax@12
|
|
411 Vis_stru1_stru0 *v15; // edi@12
|
|
412 BLVFace thisa; // [sp+10h] [bp-B8h]@1
|
|
413 RenderVertexSoft a1; // [sp+70h] [bp-58h]@1
|
|
414 void *v18; // [sp+A0h] [bp-28h]@12
|
|
415 void *v19; // [sp+A4h] [bp-24h]@12
|
|
416 int v20; // [sp+A8h] [bp-20h]@12
|
|
417 int v21; // [sp+ACh] [bp-1Ch]@8
|
|
418 Vis *v22; // [sp+B0h] [bp-18h]@1
|
|
419 int v23; // [sp+B4h] [bp-14h]@9
|
|
420 int v24; // [sp+B8h] [bp-10h]@1
|
|
421 unsigned int v25; // [sp+BCh] [bp-Ch]@2
|
|
422 unsigned int v26; // [sp+C0h] [bp-8h]@1
|
|
423 int v27; // [sp+C4h] [bp-4h]@8
|
|
424
|
|
425 v22 = this;
|
|
426 v6 = 0;
|
|
427 v7 = 0;
|
|
428 v24 = 0;
|
|
429 v26 = 0;
|
|
430 a1.flt_2C = 0.0;
|
3
|
431 if (!pOutdoor)
|
|
432 return;
|
0
|
433 if ( (signed int)pOutdoor->uNumBModels > 0 )
|
|
434 {
|
|
435 v25 = 0;
|
|
436 do
|
|
437 {
|
|
438 v8 = &pOutdoor->pBModels[v25 / 0xBC];
|
|
439 v9 = IsBModelVisible(v7, &v24);
|
|
440 if ( a6 )
|
|
441 {
|
|
442 if ( v9 && v24 != v6 )
|
|
443 {
|
|
444 LABEL_8:
|
|
445 v10 = v8->uNumFaces;
|
|
446 v27 = v6;
|
|
447 v21 = v10;
|
|
448 if ( v10 > v6 )
|
|
449 {
|
|
450 v23 = v6;
|
|
451 do
|
|
452 {
|
|
453 v11 = (ODMFace *)((char *)v8->pFaces + v23);
|
|
454 if ( is_part_of_selection((BLVFace *)((char *)v8->pFaces + v23), a5) )
|
|
455 {
|
|
456 thisa.FromODM(v11);
|
|
457 if ( Intersect_Ray_Face(pRay, pRay + 1, &fDepth, &a1, &thisa, v26) )
|
|
458 {
|
|
459 pGame->pIndoorCameraD3D->ViewTransform(&a1, 1u);
|
|
460 v18 = v11;
|
|
461 v13 = _48B561_mess_with_scaling_along_z(/*v12, */a1.vWorldViewPosition.x);
|
|
462 LOWORD(v13) = 0;
|
|
463 v20 = 2;
|
|
464 v19 = (void *)((8 * (v27 | (v26 << 6)) | 6) + v13);
|
|
465 pNumPointers = &a4->uNumPointers;
|
|
466 v15 = &a4->array_0004[a4->uNumPointers];
|
|
467 v15->pObjectInfo = v18;
|
|
468 v15 = (Vis_stru1_stru0 *)((char *)v15 + 4);
|
|
469 v15->pObjectInfo = v19;
|
|
470 v15->sZValue = v20;
|
|
471 ++*pNumPointers;
|
|
472 }
|
|
473 }
|
|
474 ++v27;
|
|
475 v23 += 308;
|
|
476 }
|
|
477 while ( v27 < v21 );
|
|
478 v6 = 0;
|
|
479 }
|
|
480 goto LABEL_15;
|
|
481 }
|
|
482 }
|
|
483 else
|
|
484 {
|
|
485 if ( v9 )
|
|
486 goto LABEL_8;
|
|
487 }
|
|
488 LABEL_15:
|
|
489 v25 += 188;
|
|
490 v7 = v26++ + 1;
|
|
491 }
|
|
492 while ( (signed int)v26 < (signed int)pOutdoor->uNumBModels );
|
|
493 }
|
|
494 }
|
|
495
|
|
496 //----- (004C1930) --------------------------------------------------------
|
|
497 //bool Vis::j_DoesRayIntersectBillboard(float fDepth, unsigned int uD3DBillboardIdx)
|
|
498 //{return DoesRayIntersectBillboard(fDepth, uD3DBillboardIdx);}
|
|
499
|
|
500 //----- (004C1944) --------------------------------------------------------
|
|
501 int Vis::_4C1944(int a2, unsigned int a3, int a4, int a5, int a6)
|
|
502 {
|
|
503 float v6; // ST00_4@3
|
|
504 int result; // eax@4
|
|
505 stru157 v8; // [sp+18h] [bp-20h]@3
|
|
506 __int64 v9; // [sp+2Ch] [bp-Ch]@3
|
|
507 Vis *v14; // [sp+34h] [bp-4h]@1
|
|
508
|
|
509 v14 = this;
|
|
510
|
|
511 static Vis_stru1 Vis_static_sub_4C1944_stru_F8BDE8;
|
|
512
|
|
513 v8.field_4 = a2;
|
|
514 v8.field_8 = a6;
|
|
515 v8.field_C = a5;
|
|
516 v8.field_10 = a4;
|
|
517 v9 = a3;
|
|
518 Vis_static_sub_4C1944_stru_F8BDE8.uNumPointers = 0;
|
|
519 v6 = (double)a3;
|
|
520 v8.field_0 = 1;
|
|
521 _4C06F8(v6, &Vis_static_sub_4C1944_stru_F8BDE8, &v8);
|
|
522 Vis_static_sub_4C1944_stru_F8BDE8.create_object_pointers(1u);
|
|
523 sort_object_pointers(
|
|
524 Vis_static_sub_4C1944_stru_F8BDE8.array_1804,
|
|
525 0,
|
|
526 Vis_static_sub_4C1944_stru_F8BDE8.uNumPointers - 1);
|
|
527 if ( (signed int)Vis_static_sub_4C1944_stru_F8BDE8.uNumPointers <= 0 )
|
|
528 result = -1;
|
|
529 else
|
|
530 result = Vis_static_sub_4C1944_stru_F8BDE8.array_1804[0]->sZValue;
|
|
531 return result;
|
|
532 }
|
|
533 // F8DDF0: using guessed type char Vis_static_sub_4C1944_byte_F8DDF0_init;
|
|
534
|
|
535 //----- (004C1A02) --------------------------------------------------------
|
|
536 void Vis::_4C1A02()
|
|
537 {
|
|
538 RenderVertexSoft v1; // [sp+8h] [bp-C0h]@1
|
|
539 RenderVertexSoft v2; // [sp+38h] [bp-90h]@1
|
|
540 RenderVertexSoft v3; // [sp+68h] [bp-60h]@1
|
|
541 RenderVertexSoft v4; // [sp+98h] [bp-30h]@1
|
|
542
|
|
543 v4.flt_2C = 0.0;
|
|
544 v4.vWorldPosition.x = 0.0;
|
|
545 v4.vWorldPosition.y = 65536.0;
|
|
546 v4.vWorldPosition.z = 0.0;
|
|
547 v3.flt_2C = 0.0;
|
|
548 v3.vWorldPosition.x = 65536.0;
|
|
549 v3.vWorldPosition.y = 0.0;
|
|
550 v3.vWorldPosition.z = 0.0;
|
|
551 memcpy(&v1, &v3, sizeof(v1));
|
|
552 v3.flt_2C = 0.0;
|
|
553 v3.vWorldPosition.x = 0.0;
|
|
554 v3.vWorldPosition.y = 65536.0;
|
|
555 v3.vWorldPosition.z = 0.0;
|
|
556 memcpy(&v2, &v4, sizeof(v2));
|
|
557 v4.flt_2C = 0.0;
|
|
558 v4.vWorldPosition.x = 65536.0;
|
|
559 v4.vWorldPosition.y = 0.0;
|
|
560 v4.vWorldPosition.z = 0.0;
|
|
561 memcpy(&this->stru_200C, &v1, 0x60u);
|
|
562 memcpy(&v1, &v4, sizeof(v1));
|
|
563 memcpy(&v2, &v3, sizeof(v2));
|
|
564 memcpy(&this->stru_206C, &v1, 0x60u);
|
|
565 }
|
|
566
|
|
567 //----- (004C1ABA) --------------------------------------------------------
|
|
568 bool Vis::SortVectors_x(RenderVertexSoft *a2, int a3, int a4)
|
|
569 {
|
|
570 bool result; // eax@1
|
|
571 RenderVertexSoft *v5; // edx@2
|
|
572 int v6; // ebx@2
|
|
573 int i; // ecx@2
|
|
574 int v8; // esi@3
|
|
575 int v9; // esi@5
|
|
576 RenderVertexSoft *v10; // eax@8
|
|
577 RenderVertexSoft v11; // [sp+4h] [bp-6Ch]@8
|
|
578 RenderVertexSoft v12; // [sp+34h] [bp-3Ch]@2
|
|
579 int v13; // [sp+64h] [bp-Ch]@7
|
|
580 Vis *thisa; // [sp+68h] [bp-8h]@1
|
|
581 RenderVertexSoft *v15; // [sp+6Ch] [bp-4h]@2
|
|
582
|
|
583 result = a4;
|
|
584 thisa = this;
|
|
585 if ( a4 > a3 )
|
|
586 {
|
|
587 v5 = a2;
|
|
588 v15 = &a2[a4];
|
|
589 v6 = a3 - 1;
|
|
590 memcpy(&v12, &a2[a4], sizeof(v12));
|
|
591 for ( i = a4; ; i = v13 )
|
|
592 {
|
|
593 v8 = (int)&v5[v6].vWorldViewPosition;
|
|
594 do
|
|
595 {
|
|
596 v8 += 48;
|
|
597 ++v6;
|
|
598 }
|
|
599 while ( *(float *)v8 < (double)v12.vWorldViewPosition.x );
|
|
600 v9 = (int)&v5[i].vWorldViewPosition;
|
|
601 do
|
|
602 {
|
|
603 v9 -= 48;
|
|
604 --i;
|
|
605 }
|
|
606 while ( *(float *)v9 > (double)v12.vWorldViewPosition.x );
|
|
607 v13 = i;
|
|
608 if ( v6 >= i )
|
|
609 break;
|
|
610 v10 = &v5[i];
|
|
611 memcpy(&v11, &a2[v6], sizeof(v11));
|
|
612 v5 = a2;
|
|
613 memcpy(&a2[v6], v10, sizeof(a2[v6]));
|
|
614 memcpy(v10, &v11, 0x30u);
|
|
615 }
|
|
616 memcpy(&v11, &v5[v6], sizeof(v11));
|
|
617 memcpy(&v5[v6], v15, sizeof(v5[v6]));
|
|
618 memcpy(v15, &v11, 0x30u);
|
|
619 SortVectors_x(v5, a3, v6 - 1);
|
|
620 SortVectors_x(a2, v6 + 1, a4);
|
|
621 }
|
|
622 return true;
|
|
623 }
|
|
624
|
|
625 //----- (004C1BAA) --------------------------------------------------------
|
|
626 int Vis::get_object_zbuf_val(Vis_stru1_stru0 *a2)
|
|
627 {
|
|
628 unsigned int v2; // eax@1
|
|
629 int result; // eax@3
|
|
630 std::string v4; // [sp-18h] [bp-1Ch]@4
|
|
631 const char *v5; // [sp-8h] [bp-Ch]@4
|
|
632 int v6; // [sp-4h] [bp-8h]@4
|
|
633 Vis *v7; // [sp+0h] [bp-4h]@1
|
|
634
|
|
635 v7 = this;
|
|
636 v2 = a2->uObjectType;
|
|
637 if ( (signed int)v2 <= 0 || (signed int)v2 > 2 )
|
|
638 {
|
|
639 MessageBoxW(nullptr, L"Undefined type requested for: CVis::get_object_zbuf_val()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Vis.cpp:1037", 0);
|
|
640 result = -1;
|
|
641 }
|
|
642 else
|
|
643 {
|
|
644 result = a2->sZValue;
|
|
645 }
|
|
646 return result;
|
|
647 }
|
|
648
|
|
649 //----- (004C1BF1) --------------------------------------------------------
|
|
650 int Vis::get_picked_object_zbuf_val()
|
|
651 {
|
|
652 int result; // eax@2
|
|
653
|
|
654 if ( (signed int)this->stru1.uNumPointers <= 0 )
|
|
655 result = -1;
|
|
656 else
|
|
657 result = get_object_zbuf_val(this->stru1.array_1804[0]);
|
|
658 return result;
|
|
659 }
|
|
660
|
|
661 //----- (004C1C0C) --------------------------------------------------------
|
|
662 bool Vis::Intersect_Ray_Face(RenderVertexSoft *pRayStart, RenderVertexSoft *pRayEnd, float *pDepth, RenderVertexSoft *a4, BLVFace *a5, unsigned int a6)
|
|
663 {
|
|
664 BLVFace *v7; // ebx@1
|
|
665 bool result; // eax@1
|
|
666 double v9; // st7@3
|
|
667 __int16 v10; // fps@3
|
|
668 char v11; // c0@3
|
|
669 char v12; // c2@3
|
|
670 char v13; // c3@3
|
|
671 __int16 v14; // fps@5
|
|
672 char v15; // c0@5
|
|
673 char v16; // c2@5
|
|
674 char v17; // c3@5
|
|
675 double v18; // st5@6
|
|
676 __int16 v19; // fps@6
|
|
677 char v20; // c0@6
|
|
678 char v21; // c2@6
|
|
679 char v22; // c3@6
|
|
680 unsigned __int8 v23; // c0@6
|
|
681 char v24; // c2@6
|
|
682 unsigned __int8 v25; // c3@6
|
|
683 char v26; // zf@6
|
|
684 double v27; // st6@10
|
|
685 __int16 v28; // fps@10
|
|
686 unsigned __int8 v29; // c0@10
|
|
687 char v30; // c2@10
|
|
688 unsigned __int8 v31; // c3@10
|
|
689 double v32; // st7@11
|
|
690 Vec2_short_ v33; // ST1E_4@11
|
|
691 Vec3_short_ v34; // ST04_6@11
|
|
692 float a5a; // [sp+30h] [bp+18h]@10
|
|
693 float a5b; // [sp+30h] [bp+18h]@13
|
|
694
|
|
695 v7 = a5;
|
|
696 result = a5->uAttributes;
|
|
697 if ( result & 1
|
|
698 || BYTE1(result) & 0x20
|
|
699 || (v9 = pRayEnd->vWorldPosition.z * a5->pFacePlane.vNormal.z
|
|
700 + a5->pFacePlane.vNormal.y * pRayEnd->vWorldPosition.y
|
|
701 + pRayEnd->vWorldPosition.x * a5->pFacePlane.vNormal.x,
|
|
702 //UNDEF(v10),
|
|
703 v11 = v9 < 0.0,
|
|
704 v12 = 0,
|
|
705 v13 = v9 == 0.0,
|
|
706 BYTE1(result) = HIBYTE(v10),
|
|
707 v9 == 0.0)
|
|
708 || (/*UNDEF(v14),*/ v15 = v9 < 0.0, v16 = 0, v17 = v9 == 0.0, BYTE1(result) = HIBYTE(v14), v9 > 0.0) )// ray's away (>) from face surface or parallel (==)
|
|
709 goto LABEL_12;
|
|
710 v18 = -(a5->pFacePlane.vNormal.y * pRayStart->vWorldPosition.y// ray-plane intersection
|
|
711 + pRayStart->vWorldPosition.x * a5->pFacePlane.vNormal.x
|
|
712 + pRayStart->vWorldPosition.z * a5->pFacePlane.vNormal.z
|
|
713 + a5->pFacePlane.dist);
|
|
714 //UNDEF(v19);
|
|
715 v20 = v9 < 0.0;
|
|
716 v21 = 0;
|
|
717 v22 = v9 == 0.0;
|
|
718 BYTE1(result) = HIBYTE(v19);
|
|
719 v23 = v18 < 0.0;
|
|
720 v24 = 0;
|
|
721 v25 = v18 == 0.0;
|
|
722 v26 = (BYTE1(result) & 0x41) == 0;
|
|
723 BYTE1(result) = HIBYTE(v19);
|
|
724 if ( v26 )
|
|
725 {
|
|
726 if ( v18 < 0.0 )
|
|
727 goto LABEL_12;
|
|
728 }
|
|
729 else
|
|
730 {
|
|
731 if ( !(v23 | v25) )
|
|
732 {
|
|
733 LABEL_12:
|
|
734 LOBYTE(result) = 0;
|
|
735 return result;
|
|
736 }
|
|
737 }
|
|
738 a5a = v18;
|
|
739 v27 = a5a / v9;
|
|
740 HIWORD(result) = HIWORD(pDepth);
|
|
741 //UNDEF(v28);
|
|
742 v29 = v27 < *pDepth;
|
|
743 v30 = 0;
|
|
744 v31 = v27 == *pDepth;
|
|
745 BYTE1(result) = HIBYTE(v28);
|
|
746 if ( !(v29 | v31)
|
|
747 || (a4->vWorldPosition.x = v27 * pRayEnd->vWorldPosition.x + pRayStart->vWorldPosition.x,
|
|
748 a4->vWorldPosition.y = v27 * pRayEnd->vWorldPosition.y + pRayStart->vWorldPosition.y,
|
|
749 v32 = v27 * pRayEnd->vWorldPosition.z + pRayStart->vWorldPosition.z,
|
|
750 a4->vWorldPosition.z = v32,
|
|
751 v33.x = (signed __int64)a4->vWorldPosition.x,
|
|
752 v33.y = (signed __int64)a4->vWorldPosition.y,
|
|
753 *(int *)&v34.x = v33.x,
|
|
754 v34.z = (signed __int64)v32,
|
|
755 result = _4C1D2B(v7, v34, a6),
|
|
756 *(float *)&result == 0.0) )
|
|
757 goto LABEL_12;
|
|
758 *(float *)&result = v27;
|
|
759 a5b = v27;
|
|
760 *(int *)pDepth = LODWORD(a5b);
|
|
761 LOBYTE(result) = 1;
|
|
762 return result;
|
|
763 }
|
|
764
|
|
765 //----- (004C1D2B) --------------------------------------------------------
|
|
766 int Vis::_4C1D2B(BLVFace *pFace, Vec3_short_ a2, unsigned int uModelID)
|
|
767 {
|
|
768 BLVFace *v4; // esi@1
|
|
769 int v5; // esi@10
|
|
770 bool v6; // edi@10
|
|
771 int v7; // ecx@12
|
|
772 signed int v8; // edx@12
|
|
773 signed int v9; // eax@13
|
|
774 signed int v10; // ebx@14
|
|
775 int v11; // edi@16
|
|
776 signed int v12; // ST28_4@18
|
|
777 signed __int64 v13; // qtt@18
|
|
778 signed int result; // eax@21
|
|
779 int v15; // [sp+10h] [bp-Ch]@10
|
|
780 signed int v16; // [sp+18h] [bp-4h]@10
|
|
781
|
|
782 v4 = pFace;
|
|
783 if ( a2.z < pFace->pBounding.z1
|
|
784 || a2.z > pFace->pBounding.z2
|
|
785 || a2.x < pFace->pBounding.x1
|
|
786 || a2.x > pFace->pBounding.x2
|
|
787 || a2.y < pFace->pBounding.y1
|
|
788 || a2.y > pFace->pBounding.y2
|
|
789 || (uModelID != -1 ? _4C2186_BLV_IntersectBModel(
|
|
790 (int *)&pFace,
|
|
791 (int *)&uModelID,
|
|
792 &word_F8BC48_displaced_face_intersect_plane_coords_a,
|
|
793 &word_F8BD18_displaced_face_intersect_plane_coords_b,
|
|
794 &a2,
|
|
795 pFace,
|
|
796 uModelID) : _4C1EE5_BLV_IntersectBModel_2(
|
|
797 (int *)&pFace,
|
|
798 (int *)&uModelID,
|
|
799 &word_F8BC48_displaced_face_intersect_plane_coords_a,
|
|
800 &word_F8BD18_displaced_face_intersect_plane_coords_b,
|
|
801 &a2,
|
|
802 pFace),
|
|
803 v5 = 2 * v4->uNumVertices,
|
|
804 v16 = 0,
|
|
805 *(&word_F8BC48_displaced_face_intersect_plane_coords_a + v5) = word_F8BC48_displaced_face_intersect_plane_coords_a,
|
|
806 *(&word_F8BD18_displaced_face_intersect_plane_coords_b + v5) = word_F8BD18_displaced_face_intersect_plane_coords_b,
|
|
807 v15 = 0,
|
|
808 v6 = word_F8BD18_displaced_face_intersect_plane_coords_b >= (signed int)uModelID,
|
|
809 v5 <= 0) )
|
|
810 goto LABEL_25;
|
|
811 do
|
|
812 {
|
|
813 if ( v16 >= 2 )
|
|
814 break;
|
|
815 v7 = 2 * v15;
|
|
816 v8 = *(&word_F8BD18_displaced_face_intersect_plane_coords_b + v15 + 1);
|
|
817 if ( v6 ^ v8 >= (signed int)uModelID )
|
|
818 {
|
|
819 v9 = *(__int16 *)((char *)&word_F8BC48_displaced_face_intersect_plane_coords_a + v7 + 2);
|
|
820 if ( v9 >= (signed int)pFace )
|
|
821 v10 = 0;
|
|
822 else
|
|
823 v10 = 2;
|
|
824 v11 = v10 | *(__int16 *)((char *)&word_F8BC48_displaced_face_intersect_plane_coords_a + v7) < (signed int)pFace;
|
|
825 if ( v11 != 3 )
|
|
826 {
|
|
827 if ( !v11
|
|
828 || (v12 = v9 - *(__int16 *)((char *)&word_F8BC48_displaced_face_intersect_plane_coords_a + v7),
|
|
829 LODWORD(v13) = v12 << 16,
|
|
830 HIDWORD(v13) = v12 >> 16,
|
|
831 *(__int16 *)((char *)&word_F8BC48_displaced_face_intersect_plane_coords_a + v7)
|
|
832 + ((signed int)(((unsigned __int64)(v13
|
|
833 / (v8
|
|
834 - *(__int16 *)((char *)&word_F8BD18_displaced_face_intersect_plane_coords_b
|
|
835 + v7))
|
|
836 * (signed int)((uModelID
|
|
837 - *(__int16 *)((char *)&word_F8BD18_displaced_face_intersect_plane_coords_b
|
|
838 + v7)) << 16)) >> 16)
|
|
839 + 32768) >> 16) >= (signed int)pFace) )
|
|
840 ++v16;
|
|
841 }
|
|
842 }
|
|
843 ++v15;
|
|
844 v6 = v8 >= (signed int)uModelID;
|
|
845 }
|
|
846 while ( v15 < v5 );
|
|
847 result = 1;
|
|
848 if ( v16 != 1 )
|
|
849 LABEL_25:
|
|
850 result = 0;
|
|
851 return result;
|
|
852 }
|
|
853
|
|
854 //----- (004C1EE5) --------------------------------------------------------
|
|
855 bool Vis::_4C1EE5_BLV_IntersectBModel_2(int *a1, int *a2, __int16 *a3, __int16 *a4, Vec3_short_ *a5, BLVFace *pFace)
|
|
856 {
|
|
857 bool result; // eax@1
|
|
858 unsigned int v8; // ecx@1
|
|
859 Vec3_short_ *v9; // ecx@2
|
|
860 __int16 *v10; // edx@3
|
|
861 signed int v11; // ecx@4
|
|
862 char v12; // zf@6
|
|
863 Vec3_short_ *v13; // ecx@6
|
|
864 int v14; // edx@7
|
|
865 __int16 *v15; // edx@8
|
|
866 signed int v16; // ecx@9
|
|
867 int v17; // edx@11
|
|
868 __int16 *v18; // edx@12
|
|
869 signed int v19; // ecx@13
|
|
870 signed int a5a; // [sp+24h] [bp+18h]@2
|
|
871 signed int a5b; // [sp+24h] [bp+18h]@7
|
|
872 signed int a5c; // [sp+24h] [bp+18h]@11
|
|
873
|
|
874 result = (bool)pFace;
|
|
875 v8 = pFace->uAttributes;
|
|
876 if ( BYTE1(v8) & 1 )
|
|
877 {
|
|
878 v9 = a5;
|
|
879 a5a = 0;
|
|
880 *a1 = v9->x;
|
|
881 *a2 = v9->y;
|
|
882 if ( pFace->uNumVertices )
|
|
883 {
|
|
884 v10 = a4 + 1;
|
|
885 do
|
|
886 {
|
|
887 v11 = a5a;
|
|
888 a3[2 * a5a] = pFace->pXInterceptDisplacements[a5a] + pIndoor->pVertices[pFace->pVertexIDs[a5a]].x;
|
|
889 *(v10 - 1) = pFace->pYInterceptDisplacements[v11] + pIndoor->pVertices[pFace->pVertexIDs[v11]].y;
|
|
890 *(__int16 *)((char *)v10 + (int)a3 - (int)a4) = pFace->pXInterceptDisplacements[v11 + 1]
|
|
891 + pIndoor->pVertices[pFace->pVertexIDs[v11 + 1]].x;
|
|
892 ++a5a;
|
|
893 *v10 = pFace->pYInterceptDisplacements[v11 + 1] + pIndoor->pVertices[pFace->pVertexIDs[v11 + 1]].y;
|
|
894 v10 += 2;
|
|
895 }
|
|
896 while ( a5a < pFace->uNumVertices );
|
|
897 }
|
|
898 }
|
|
899 else
|
|
900 {
|
|
901 v12 = (BYTE1(v8) & 2) == 0;
|
|
902 v13 = a5;
|
|
903 if ( v12 )
|
|
904 {
|
|
905 v17 = a5->y;
|
|
906 a5c = 0;
|
|
907 *a1 = v17;
|
|
908 *a2 = v13->z;
|
|
909 if ( pFace->uNumVertices )
|
|
910 {
|
|
911 v18 = a4 + 1;
|
|
912 do
|
|
913 {
|
|
914 v19 = a5c;
|
|
915 a3[2 * a5c] = pFace->pYInterceptDisplacements[a5c] + pIndoor->pVertices[pFace->pVertexIDs[a5c]].y;
|
|
916 *(v18 - 1) = pFace->pZInterceptDisplacements[v19] + pIndoor->pVertices[pFace->pVertexIDs[v19]].z;
|
|
917 *(__int16 *)((char *)v18 + (int)(char *)a3 - (char *)a4) = pFace->pYInterceptDisplacements[v19 + 1]
|
|
918 + pIndoor->pVertices[pFace->pVertexIDs[v19 + 1]].y;
|
|
919 ++a5c;
|
|
920 *v18 = pFace->pZInterceptDisplacements[v19 + 1] + pIndoor->pVertices[pFace->pVertexIDs[v19 + 1]].z;
|
|
921 v18 += 2;
|
|
922 }
|
|
923 while ( a5c < pFace->uNumVertices );
|
|
924 }
|
|
925 }
|
|
926 else
|
|
927 {
|
|
928 v14 = a5->x;
|
|
929 a5b = 0;
|
|
930 *a1 = v14;
|
|
931 *a2 = v13->z;
|
|
932 if ( pFace->uNumVertices )
|
|
933 {
|
|
934 v15 = a4 + 1;
|
|
935 do
|
|
936 {
|
|
937 v16 = a5b;
|
|
938 a3[2 * a5b] = pFace->pXInterceptDisplacements[a5b] + pIndoor->pVertices[pFace->pVertexIDs[a5b]].x;
|
|
939 *(v15 - 1) = pFace->pZInterceptDisplacements[v16] + pIndoor->pVertices[pFace->pVertexIDs[v16]].z;
|
|
940 *(__int16 *)((char *)v15 + (int)a3 - (int)a4) = pFace->pXInterceptDisplacements[v16 + 1]
|
|
941 + pIndoor->pVertices[pFace->pVertexIDs[v16 + 1]].x;
|
|
942 ++a5b;
|
|
943 *v15 = pFace->pZInterceptDisplacements[v16 + 1] + pIndoor->pVertices[pFace->pVertexIDs[v16 + 1]].z;
|
|
944 v15 += 2;
|
|
945 }
|
|
946 while ( a5b < pFace->uNumVertices );
|
|
947 }
|
|
948 }
|
|
949 }
|
|
950 LOBYTE(result) = 1;
|
|
951 return result;
|
|
952 }
|
|
953
|
|
954 //----- (004C2186) --------------------------------------------------------
|
|
955 bool Vis::_4C2186_BLV_IntersectBModel(int *a1, int *a2, __int16 *a3, __int16 *a4, Vec3_short_ *a5, BLVFace *a6, unsigned int uModelID)
|
|
956 {
|
|
957 bool result; // eax@1
|
|
958 int *v9; // esi@1
|
|
959 unsigned int v10; // ecx@1
|
|
960 unsigned int v11; // edx@3
|
|
961 signed int v12; // ecx@4
|
|
962 __int16 v13; // si@4
|
|
963 __int16 *v14; // ecx@4
|
|
964 unsigned int v15; // edx@8
|
|
965 signed int v16; // ecx@9
|
|
966 __int16 v17; // si@9
|
|
967 __int16 *v18; // ecx@9
|
|
968 unsigned int v19; // edx@12
|
|
969 signed int v20; // ecx@13
|
|
970 __int16 v21; // si@13
|
|
971 __int16 *v22; // ecx@13
|
|
972 signed int a1a; // [sp+14h] [bp+8h]@1
|
|
973 __int16 *a5a; // [sp+24h] [bp+18h]@3
|
|
974 __int16 *a5b; // [sp+24h] [bp+18h]@8
|
|
975 __int16 *a5c; // [sp+24h] [bp+18h]@12
|
|
976
|
|
977 result = (bool)a6;
|
|
978 v9 = a1;
|
|
979 v10 = a6->uAttributes;
|
|
980 a1a = 0;
|
|
981 if ( BYTE1(v10) & 1 )
|
|
982 {
|
|
983 *v9 = a5->x;
|
|
984 *a2 = a5->y;
|
|
985 if ( a6->uNumVertices )
|
|
986 {
|
|
987 v11 = 188 * uModelID + 72;
|
|
988 a5a = a4 + 1;
|
|
989 do
|
|
990 {
|
|
991 v12 = a1a;
|
|
992 a3[2 * a1a] = a6->pXInterceptDisplacements[a1a]
|
|
993 + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v11] + 12 * a6->pVertexIDs[a1a]);
|
|
994 *(a5a - 1) = a6->pYInterceptDisplacements[v12]
|
|
995 + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v11] + 12 * a6->pVertexIDs[v12] + 4);
|
|
996 *(__int16 *)((char *)a5a + (int)(char *)a3 - (char *)a4) = a6->pXInterceptDisplacements[v12 + 1]
|
|
997 + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v11]
|
|
998 + 12 * a6->pVertexIDs[v12 + 1]);
|
|
999 v13 = a6->pYInterceptDisplacements[v12 + 1]
|
|
1000 + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v11] + 12 * a6->pVertexIDs[v12 + 1] + 4);
|
|
1001 v14 = a5a;
|
|
1002 ++a1a;
|
|
1003 a5a += 2;
|
|
1004 *v14 = v13;
|
|
1005 }
|
|
1006 while ( a1a < a6->uNumVertices );
|
|
1007 }
|
|
1008 }
|
|
1009 else
|
|
1010 {
|
|
1011 if ( BYTE1(v10) & 2 )
|
|
1012 {
|
|
1013 *v9 = a5->x;
|
|
1014 *a2 = a5->z;
|
|
1015 if ( a6->uNumVertices )
|
|
1016 {
|
|
1017 v15 = 188 * uModelID + 72;
|
|
1018 a5b = a4 + 1;
|
|
1019 do
|
|
1020 {
|
|
1021 v16 = a1a;
|
|
1022 a3[2 * a1a] = a6->pXInterceptDisplacements[a1a]
|
|
1023 + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v15] + 12 * a6->pVertexIDs[a1a]);
|
|
1024 *(a5b - 1) = a6->pZInterceptDisplacements[v16]
|
|
1025 + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v15] + 12 * a6->pVertexIDs[v16] + 8);
|
|
1026 *(__int16 *)((char *)a5b + (int)a3 - (int)a4) = a6->pXInterceptDisplacements[v16 + 1]
|
|
1027 + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v15]
|
|
1028 + 12 * a6->pVertexIDs[v16 + 1]);
|
|
1029 v17 = a6->pZInterceptDisplacements[v16 + 1]
|
|
1030 + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v15] + 12 * a6->pVertexIDs[v16 + 1] + 8);
|
|
1031 v18 = a5b;
|
|
1032 ++a1a;
|
|
1033 a5b += 2;
|
|
1034 *v18 = v17;
|
|
1035 }
|
|
1036 while ( a1a < a6->uNumVertices );
|
|
1037 }
|
|
1038 }
|
|
1039 else
|
|
1040 {
|
|
1041 *v9 = a5->y;
|
|
1042 *a2 = a5->z;
|
|
1043 if ( a6->uNumVertices )
|
|
1044 {
|
|
1045 v19 = 188 * uModelID + 72;
|
|
1046 a5c = a4 + 1;
|
|
1047 do
|
|
1048 {
|
|
1049 v20 = a1a;
|
|
1050 a3[2 * a1a] = a6->pYInterceptDisplacements[a1a]
|
|
1051 + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v19] + 12 * a6->pVertexIDs[a1a] + 4);
|
|
1052 *(a5c - 1) = a6->pZInterceptDisplacements[v20]
|
|
1053 + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v19] + 12 * a6->pVertexIDs[v20] + 8);
|
|
1054 *(__int16 *)((char *)a5c + (int)(char *)a3 - (char *)a4) = a6->pYInterceptDisplacements[v20 + 1]
|
|
1055 + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v19]
|
|
1056 + 12 * a6->pVertexIDs[v20 + 1]
|
|
1057 + 4);
|
|
1058 v21 = a6->pZInterceptDisplacements[v20 + 1]
|
|
1059 + *(short *)(*(int *)&pOutdoor->pBModels->pModelName[v19] + 12 * a6->pVertexIDs[v20 + 1] + 8);
|
|
1060 v22 = a5c;
|
|
1061 ++a1a;
|
|
1062 a5c += 2;
|
|
1063 *v22 = v21;
|
|
1064 }
|
|
1065 while ( a1a < a6->uNumVertices );
|
|
1066 }
|
|
1067 }
|
|
1068 }
|
|
1069 LOBYTE(result) = 1;
|
|
1070 return result;
|
|
1071 }
|
|
1072
|
|
1073 //----- (004C248E) --------------------------------------------------------
|
|
1074 void Vis::CastPickRay(RenderVertexSoft *pRay, float fMouseX, float fMouseY, float fPickDepth)
|
|
1075 {
|
|
1076 int v5; // ebx@1
|
|
1077 int v6; // edi@1
|
|
1078 int v7; // esi@1
|
|
1079 Vec3_int_ v8; // ST08_12@1
|
|
1080 int v9; // ST04_4@1
|
|
1081 int v10; // eax@1
|
|
1082 RenderVertexSoft v11[2]; // [sp+2Ch] [bp-74h]@1
|
|
1083 int v12; // [sp+8Ch] [bp-14h]@1
|
|
1084 int v13; // [sp+90h] [bp-10h]@1
|
|
1085 int outz; // [sp+94h] [bp-Ch]@1
|
|
1086 int outy; // [sp+98h] [bp-8h]@1
|
|
1087 int v16; // [sp+9Ch] [bp-4h]@1
|
|
1088
|
|
1089 v5 = pIndoorCamera->pos.y;
|
|
1090 v6 = pIndoorCamera->pos.x;
|
|
1091 v13 = pIndoorCamera->pos.x;
|
|
1092 v12 = pIndoorCamera->pos.y;
|
|
1093 v16 = pIndoorCamera->pos.z;
|
|
1094 v7 = pIndoorCamera->sRotationY + UnprojectX((signed __int64)fMouseX);
|
|
1095 v8.z = v16;
|
|
1096 v8.x = v6;
|
|
1097 v8.y = v5;
|
|
1098 v9 = pIndoorCamera->sRotationX + UnprojectY((signed __int64)fMouseY);
|
|
1099 v10 = _48B561_mess_with_scaling_along_z(/*(int)&fMouseX, */fPickDepth);
|
|
1100 Vec3_int_::Rotate(v10, v7, v9, v8, (int *)&fMouseX, &outy, &outz);
|
|
1101 v11[0].flt_2C = 0.0;
|
|
1102 v11[0].vWorldPosition.x = (double)SLODWORD(fMouseX);
|
|
1103 v11[0].vWorldPosition.y = (double)outy;
|
|
1104 v11[0].vWorldPosition.z = (double)outz;
|
|
1105 v11[1].flt_2C = 0.0;
|
|
1106 v11[1].vWorldPosition.x = (double)v13;
|
|
1107 v11[1].vWorldPosition.y = (double)v12;
|
|
1108 v11[1].vWorldPosition.z = (double)v16;
|
|
1109 memcpy(pRay, &v11[1], 0x30u);
|
|
1110 memcpy(&pRay[1], v11, sizeof(pRay[1]));
|
|
1111 }
|
|
1112
|
|
1113 //----- (004C2551) --------------------------------------------------------
|
|
1114 Vis_stru1_stru0 *Vis_stru1::sub_4C2551(int a2, int a3)
|
|
1115 {
|
|
1116 unsigned int v3; // esi@1
|
|
1117 signed int v4; // edx@1
|
|
1118 char *v5; // eax@2
|
|
1119 Vis_stru1_stru0 *result; // eax@6
|
|
1120
|
|
1121 v3 = this->uNumPointers;
|
|
1122 v4 = 0;
|
|
1123 if ( (signed int)v3 <= 0 )
|
|
1124 {
|
|
1125 LABEL_6:
|
|
1126 result = 0;
|
|
1127 }
|
|
1128 else
|
|
1129 {
|
|
1130 v5 = (char *)&this->array_0004[0].sZValue;
|
|
1131 while ( *((int *)v5 + 1) != a2 || (*(int *)v5 & 0xFFFF) != a3 )
|
|
1132 {
|
|
1133 ++v4;
|
|
1134 v5 += 12;
|
|
1135 if ( v4 >= (signed int)v3 )
|
|
1136 goto LABEL_6;
|
|
1137 }
|
|
1138 result = &this->array_0004[v4];
|
|
1139 }
|
|
1140 return result;
|
|
1141 }
|
|
1142
|
|
1143 //----- (004C2591) --------------------------------------------------------
|
|
1144 Vis_stru1_stru0 **Vis_stru1::create_object_pointers(unsigned int flag)
|
|
1145 {
|
|
1146 Vis_stru1_stru0 **result; // eax@1
|
|
1147 signed int v3; // esi@2
|
|
1148 Vis_stru1_stru0 *v4; // edx@3
|
|
1149 unsigned __int8 v5; // zf@7
|
|
1150 unsigned __int8 v6; // sf@7
|
|
1151 Vis_stru1_stru0 **v7; // ebx@8
|
|
1152 Vis_stru1_stru0 *v8; // esi@8
|
|
1153 signed int v9; // edi@9
|
|
1154 Vis_stru1_stru0 **v10; // edx@10
|
|
1155 std::string v11; // [sp-18h] [bp-28h]@19
|
|
1156 const char *v12; // [sp-8h] [bp-18h]@19
|
|
1157 int v13; // [sp-4h] [bp-14h]@19
|
|
1158 char v14; // [sp+Ch] [bp-4h]@19
|
|
1159
|
|
1160 result = 0;
|
|
1161 if ( flag )
|
|
1162 {
|
|
1163 if ( flag == 1 )
|
|
1164 {
|
|
1165 v5 = this->uNumPointers == 0;
|
|
1166 v6 = (this->uNumPointers & 0x80000000u) != 0;
|
|
1167 BYTE3(flag) = 1;
|
|
1168 if ( !(v6 | v5) )
|
|
1169 {
|
|
1170 v7 = this->array_1804;
|
|
1171 v8 = this->array_0004;
|
|
1172 do
|
|
1173 {
|
|
1174 v9 = 0;
|
|
1175 if ( (signed int)result > 0 )
|
|
1176 {
|
|
1177 v10 = this->array_1804;
|
|
1178 while ( *v10 != v8 )
|
|
1179 {
|
|
1180 ++v9;
|
|
1181 ++v10;
|
|
1182 if ( v9 >= (signed int)result )
|
|
1183 goto LABEL_15;
|
|
1184 }
|
|
1185 BYTE3(flag) = 0;
|
|
1186 }
|
|
1187 LABEL_15:
|
|
1188 if ( BYTE3(flag) )
|
|
1189 *v7 = v8;
|
|
1190 result = (Vis_stru1_stru0 **)((char *)result + 1);
|
|
1191 ++v7;
|
|
1192 ++v8;
|
|
1193 }
|
|
1194 while ( (signed int)result < (signed int)this->uNumPointers );
|
|
1195 }
|
|
1196 }
|
|
1197 else
|
|
1198 {
|
|
1199 MessageBoxW(nullptr, L"Unknown pointer creation flag passed to ::create_object_pointers()", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Vis.cpp:1358", 0);
|
|
1200 }
|
|
1201 }
|
|
1202 else
|
|
1203 {
|
|
1204 v3 = 0;
|
|
1205 if ( (signed int)this->uNumPointers > 0 )
|
|
1206 {
|
|
1207 result = this->array_1804;
|
|
1208 v4 = this->array_0004;
|
|
1209 do
|
|
1210 {
|
|
1211 *result = v4;
|
|
1212 ++v3;
|
|
1213 ++result;
|
|
1214 ++v4;
|
|
1215 }
|
|
1216 while ( v3 < (signed int)this->uNumPointers );
|
|
1217 }
|
|
1218 }
|
|
1219 return result;
|
|
1220 }
|
|
1221
|
|
1222 //----- (004C264A) --------------------------------------------------------
|
|
1223 void Vis::sort_object_pointers(Vis_stru1_stru0 **pPointers, int left, int right)
|
|
1224 {
|
|
1225 int v4; // edx@1
|
|
1226 int v5; // ebx@1
|
|
1227 int v6; // esi@2
|
|
1228 signed int i; // ecx@2
|
|
1229 int v8; // eax@3
|
|
1230 int v9; // ebx@4
|
|
1231 int v10; // ebx@6
|
|
1232 Vis_stru1_stru0 *v11; // eax@7
|
|
1233 Vis *thisa; // [sp+4h] [bp-4h]@1
|
|
1234 Vis_stru1_stru0 *a3a; // [sp+14h] [bp+Ch]@2
|
|
1235
|
|
1236 v4 = left;
|
|
1237 v5 = right;
|
|
1238 thisa = this;
|
|
1239 if ( right > left )
|
|
1240 {
|
|
1241 do
|
|
1242 {
|
|
1243 v6 = v4 - 1;
|
|
1244 a3a = pPointers[v5];
|
|
1245 for ( i = v5; ; pPointers[i] = v11 )
|
|
1246 {
|
|
1247 v8 = a3a->sZValue;
|
|
1248 LOWORD(v8) = 0;
|
|
1249 do
|
|
1250 {
|
|
1251 ++v6;
|
|
1252 v9 = pPointers[v6]->sZValue;
|
|
1253 LOWORD(v9) = 0;
|
|
1254 }
|
|
1255 while ( v9 < (unsigned int)v8 );
|
|
1256 do
|
|
1257 {
|
|
1258 if ( i < 1 )
|
|
1259 break;
|
|
1260 --i;
|
|
1261 v10 = pPointers[i]->sZValue;
|
|
1262 LOWORD(v10) = 0;
|
|
1263 }
|
|
1264 while ( v10 > (unsigned int)v8 );
|
|
1265 v11 = pPointers[v6];
|
|
1266 if ( v6 >= i )
|
|
1267 break;
|
|
1268 pPointers[v6] = pPointers[i];
|
|
1269 }
|
|
1270 v5 = right;
|
|
1271 pPointers[v6] = pPointers[right];
|
|
1272 pPointers[right] = v11;
|
|
1273 sort_object_pointers(pPointers, v4, v6 - 1);
|
|
1274 v4 = v6 + 1;
|
|
1275 }
|
|
1276 while ( right > v6 + 1 );
|
|
1277 }
|
|
1278 }
|
|
1279
|
|
1280 //----- (004C26D0) --------------------------------------------------------
|
|
1281 bool Vis::SortVerticesByX(RenderVertexD3D3 *a2, unsigned int uStart, unsigned int uEnd)
|
|
1282 {
|
|
1283 bool result; // eax@1
|
|
1284 RenderVertexD3D3 *v5; // edx@2
|
|
1285 RenderVertexD3D3 *v6; // esi@2
|
|
1286 void *v7; // edi@2
|
|
1287 unsigned int v8; // ebx@2
|
|
1288 RenderVertexD3D3 *v9; // ecx@3
|
|
1289 RenderVertexD3D3 *v10; // ecx@5
|
|
1290 RenderVertexD3D3 *v11; // eax@8
|
|
1291 RenderVertexD3D3 v12; // [sp+4h] [bp-4Ch]@8
|
|
1292 RenderVertexD3D3 v13; // [sp+24h] [bp-2Ch]@2
|
|
1293 Vis *thisa; // [sp+44h] [bp-Ch]@1
|
|
1294 RenderVertexD3D3 *v15; // [sp+48h] [bp-8h]@2
|
|
1295 unsigned int v16; // [sp+4Ch] [bp-4h]@2
|
|
1296
|
|
1297 result = uEnd;
|
|
1298 thisa = this;
|
|
1299 if ( (signed int)uEnd > (signed int)uStart )
|
|
1300 {
|
|
1301 v5 = a2;
|
|
1302 v6 = &a2[uEnd];
|
|
1303 v7 = &v13;
|
|
1304 v15 = &a2[uEnd];
|
|
1305 v8 = uStart - 1;
|
|
1306 v16 = uEnd;
|
|
1307 while ( 1 )
|
|
1308 {
|
|
1309 memcpy(v7, v6, 0x20u);
|
|
1310 v9 = &v5[v8];
|
|
1311 do
|
|
1312 {
|
|
1313 ++v9;
|
|
1314 ++v8;
|
|
1315 }
|
|
1316 while ( v9->pos.x < (double)v13.pos.x );
|
|
1317 v10 = &v5[v16];
|
|
1318 do
|
|
1319 {
|
|
1320 --v10;
|
|
1321 --v16;
|
|
1322 }
|
|
1323 while ( v10->pos.x > (double)v13.pos.x );
|
|
1324 if ( (signed int)v8 >= (signed int)v16 )
|
|
1325 break;
|
|
1326 v11 = &v5[v16];
|
|
1327 memcpy(&v12, &a2[v8], sizeof(v12));
|
|
1328 v5 = a2;
|
|
1329 memcpy(&a2[v8], v11, sizeof(a2[v8]));
|
|
1330 v6 = &v12;
|
|
1331 v7 = v11;
|
|
1332 }
|
|
1333 memcpy(&v12, &v5[v8], sizeof(v12));
|
|
1334 memcpy(&v5[v8], v15, sizeof(v5[v8]));
|
|
1335 memcpy(v15, &v12, 0x20u);
|
|
1336 SortVerticesByX(v5, uStart, v8 - 1);
|
|
1337 SortVerticesByX(a2, v8 + 1, uEnd);
|
|
1338 }
|
|
1339 return true;
|
|
1340 }
|
|
1341
|
|
1342 //----- (004C27AD) --------------------------------------------------------
|
|
1343 bool Vis::SortVerticesByY(RenderVertexD3D3 *a2, unsigned int uStart, unsigned int uEnd)
|
|
1344 {
|
|
1345 bool result; // eax@1
|
|
1346 RenderVertexD3D3 *v5; // edx@2
|
|
1347 RenderVertexD3D3 *v6; // esi@2
|
|
1348 RenderVertexD3D3 v7; // qdi@2
|
|
1349 unsigned int v8; // ebx@2
|
|
1350 int v9; // ecx@3
|
|
1351 int v10; // ecx@5
|
|
1352 float v11; // eax@8
|
|
1353 RenderVertexD3D3 v12; // [sp+4h] [bp-4Ch]@8
|
|
1354 char v13; // [sp+24h] [bp-2Ch]@2
|
|
1355 float v14; // [sp+28h] [bp-28h]@4
|
|
1356 Vis *thisa; // [sp+44h] [bp-Ch]@1
|
|
1357 RenderVertexD3D3 *v16; // [sp+48h] [bp-8h]@2
|
|
1358 unsigned int v17; // [sp+4Ch] [bp-4h]@2
|
|
1359
|
|
1360 result = uEnd;
|
|
1361 thisa = this;
|
|
1362 if ( (signed int)uEnd > (signed int)uStart )
|
|
1363 {
|
|
1364 v5 = a2;
|
|
1365 v6 = &a2[uEnd];
|
|
1366 LODWORD(v7.pos.x) = (int)&v13;
|
|
1367 v16 = &a2[uEnd];
|
|
1368 v8 = uStart - 1;
|
|
1369 v17 = uEnd;
|
|
1370 while ( 1 )
|
|
1371 {
|
|
1372 memcpy(*(void **)&v7.pos.x, v6, 0x20u);
|
|
1373 v9 = (int)&v5[v8].pos.y;
|
|
1374 do
|
|
1375 {
|
|
1376 v9 += 32;
|
|
1377 ++v8;
|
|
1378 }
|
|
1379 while ( *(float *)v9 < (double)v14 );
|
|
1380 v10 = (int)&v5[v17].pos.y;
|
|
1381 do
|
|
1382 {
|
|
1383 v10 -= 32;
|
|
1384 --v17;
|
|
1385 }
|
|
1386 while ( *(float *)v10 > (double)v14 );
|
|
1387 if ( (signed int)v8 >= (signed int)v17 )
|
|
1388 break;
|
|
1389 LODWORD(v11) = (int)&v5[v17];
|
|
1390 memcpy(&v12, &a2[v8], sizeof(v12));
|
|
1391 v5 = a2;
|
|
1392 memcpy(&a2[v8], *(void **)&v11, sizeof(a2[v8]));
|
|
1393 v6 = &v12;
|
|
1394 v7.pos.x = v11;
|
|
1395 }
|
|
1396 memcpy(&v12, &v5[v8], sizeof(v12));
|
|
1397 memcpy(&v5[v8], v16, sizeof(v5[v8]));
|
|
1398 memcpy(v16, &v12, 0x20u);
|
|
1399 SortVerticesByY(v5, uStart, v8 - 1);
|
|
1400 SortVerticesByY(a2, v8 + 1, uEnd);
|
|
1401 }
|
|
1402 return true;
|
|
1403 }
|
|
1404
|
|
1405 //----- (004C288E) --------------------------------------------------------
|
|
1406 bool Vis::sort_objects_2(RenderVertexSoft *pArray, int sLeft, int sRight)
|
|
1407 {
|
|
1408 bool result; // eax@1
|
|
1409 RenderVertexSoft *v5; // edx@2
|
|
1410 int v6; // ebx@2
|
|
1411 int i; // ecx@2
|
|
1412 int v8; // esi@3
|
|
1413 int v9; // esi@5
|
|
1414 RenderVertexSoft *v10; // eax@8
|
|
1415 RenderVertexSoft v11; // [sp+4h] [bp-6Ch]@8
|
|
1416 RenderVertexSoft v12; // [sp+34h] [bp-3Ch]@2
|
|
1417 float v13; // [sp+4Ch] [bp-24h]@4
|
|
1418 int v14; // [sp+64h] [bp-Ch]@7
|
|
1419 Vis *thisa; // [sp+68h] [bp-8h]@1
|
|
1420 RenderVertexSoft *v16; // [sp+6Ch] [bp-4h]@2
|
|
1421
|
77
|
1422 __debugbreak();
|
|
1423
|
0
|
1424 result = sRight;
|
|
1425 thisa = this;
|
|
1426 if ( sRight > sLeft )
|
|
1427 {
|
|
1428 v5 = pArray;
|
|
1429 v16 = &pArray[sRight];
|
|
1430 v6 = sLeft - 1;
|
|
1431 memcpy(&v12, &pArray[sRight], sizeof(v12));
|
|
1432 for ( i = sRight; ; i = v14 )
|
|
1433 {
|
|
1434 v8 = (int)&v5[v6].vWorldViewProjX;
|
|
1435 do
|
|
1436 {
|
|
1437 v8 += 48;
|
|
1438 ++v6;
|
|
1439 }
|
|
1440 while ( *(float *)v8 < (double)v13 );
|
|
1441 v9 = (int)&v5[i].vWorldViewProjX;
|
|
1442 do
|
|
1443 {
|
|
1444 v9 -= 48;
|
|
1445 --i;
|
|
1446 }
|
|
1447 while ( *(float *)v9 > (double)v13 );
|
|
1448 v14 = i;
|
|
1449 if ( v6 >= i )
|
|
1450 break;
|
|
1451 v10 = &v5[i];
|
|
1452 memcpy(&v11, &pArray[v6], sizeof(v11));
|
|
1453 v5 = pArray;
|
|
1454 memcpy(&pArray[v6], v10, sizeof(pArray[v6]));
|
|
1455 memcpy(v10, &v11, 0x30u);
|
|
1456 }
|
|
1457 memcpy(&v11, &v5[v6], sizeof(v11));
|
|
1458 memcpy(&v5[v6], v16, sizeof(v5[v6]));
|
|
1459 memcpy(v16, &v11, 0x30u);
|
|
1460 sort_objects_2(v5, sLeft, v6 - 1);
|
|
1461 sort_objects_2(pArray, v6 + 1, sRight);
|
|
1462 }
|
|
1463 return true;
|
|
1464 }
|
|
1465
|
|
1466 //----- (004C297E) --------------------------------------------------------
|
|
1467 bool Vis::sort_objects_3(RenderVertexSoft *pArray, int sLeft, int sRight)
|
|
1468 {
|
|
1469 bool result; // eax@1
|
|
1470 RenderVertexSoft *v5; // edx@2
|
|
1471 int v6; // ebx@2
|
|
1472 int i; // ecx@2
|
|
1473 int v8; // esi@3
|
|
1474 int v9; // esi@5
|
|
1475 RenderVertexSoft *v10; // eax@8
|
|
1476 char v11; // [sp+4h] [bp-6Ch]@8
|
|
1477 RenderVertexSoft v12; // [sp+34h] [bp-3Ch]@2
|
|
1478 float v13; // [sp+50h] [bp-20h]@4
|
|
1479 int v14; // [sp+64h] [bp-Ch]@7
|
|
1480 Vis *thisa; // [sp+68h] [bp-8h]@1
|
|
1481 RenderVertexSoft *v16; // [sp+6Ch] [bp-4h]@2
|
|
1482
|
|
1483 result = sRight;
|
|
1484 thisa = this;
|
|
1485 if ( sRight > sLeft )
|
|
1486 {
|
|
1487 v5 = pArray;
|
|
1488 v16 = &pArray[sRight];
|
|
1489 v6 = sLeft - 1;
|
|
1490 memcpy(&v12, &pArray[sRight], sizeof(v12));
|
|
1491 for ( i = sRight; ; i = v14 )
|
|
1492 {
|
|
1493 v8 = (int)&v5[v6].vWorldViewProjY;
|
|
1494 do
|
|
1495 {
|
|
1496 v8 += 48;
|
|
1497 ++v6;
|
|
1498 }
|
|
1499 while ( *(float *)v8 < (double)v13 );
|
|
1500 v9 = (int)&v5[i].vWorldViewProjY;
|
|
1501 do
|
|
1502 {
|
|
1503 v9 -= 48;
|
|
1504 --i;
|
|
1505 }
|
|
1506 while ( *(float *)v9 > (double)v13 );
|
|
1507 v14 = i;
|
|
1508 if ( v6 >= i )
|
|
1509 break;
|
|
1510 v10 = &v5[i];
|
|
1511 memcpy(&v11, &pArray[v6], 0x30u);
|
|
1512 v5 = pArray;
|
|
1513 memcpy(&pArray[v6], v10, sizeof(pArray[v6]));
|
|
1514 memcpy(v10, &v11, 0x30u);
|
|
1515 }
|
|
1516 memcpy(&v11, &v5[v6], 0x30u);
|
|
1517 memcpy(&v5[v6], v16, sizeof(v5[v6]));
|
|
1518 memcpy(v16, &v11, 0x30u);
|
|
1519 sort_objects_3(v5, sLeft, v6 - 1);
|
|
1520 sort_objects_3(pArray, v6 + 1, sRight);
|
|
1521 }
|
|
1522 return true;
|
|
1523 }
|
|
1524
|
|
1525
|
|
1526 //----- (004C04AF) --------------------------------------------------------
|
|
1527 Vis::Vis()
|
|
1528 {
|
|
1529 Vis *v1; // ebx@1
|
|
1530 Vis *result; // eax@1
|
|
1531 RenderVertexSoft v3; // [sp+Ch] [bp-60h]@1
|
|
1532 RenderVertexSoft v4; // [sp+3Ch] [bp-30h]@1
|
|
1533
|
|
1534 v1 = this;
|
|
1535 v3.flt_2C = 0.0;
|
|
1536 v3.vWorldPosition.x = 0.0;
|
|
1537 v3.vWorldPosition.y = 65536.0;
|
|
1538 v3.vWorldPosition.z = 0.0;
|
|
1539 v4.flt_2C = 0.0;
|
|
1540 v4.vWorldPosition.x = 65536.0;
|
|
1541 v4.vWorldPosition.y = 0.0;
|
|
1542 v4.vWorldPosition.z = 0.0;
|
|
1543 memcpy(&v1->stru_200C, &v4, sizeof(v1->stru_200C));
|
|
1544 v4.flt_2C = 0.0;
|
|
1545 v4.vWorldPosition.x = 0.0;
|
|
1546 v4.vWorldPosition.y = 65536.0;
|
|
1547 v4.vWorldPosition.z = 0.0;
|
|
1548 memcpy(&v1->stru_203C, &v3, sizeof(v1->stru_203C));
|
|
1549 v3.flt_2C = 0.0;
|
|
1550 v3.vWorldPosition.x = 65536.0;
|
|
1551 v3.vWorldPosition.y = 0.0;
|
|
1552 v3.vWorldPosition.z = 0.0;
|
|
1553 memcpy(&v1->stru_206C, &v3, sizeof(v1->stru_206C));
|
|
1554 result = v1;
|
|
1555 memcpy(&v1->stru_209C, &v4, sizeof(v1->stru_209C));
|
|
1556 v1->field_20CC = 512;
|
|
1557 }
|
|
1558
|
|
1559 //----- (004C055C) --------------------------------------------------------
|
|
1560 Vis_stru1::Vis_stru1()
|
|
1561 {
|
|
1562 for (uint i = 0; i < 512; ++i)
|
|
1563 {
|
|
1564 array_0004[i].pObjectInfo = 0;
|
|
1565 array_0004[i].sZValue = -1;
|
|
1566 array_0004[i].uObjectType = 0;
|
|
1567 }
|
|
1568 uNumPointers = 0;
|
|
1569 }
|
|
1570
|
|
1571
|
|
1572
|
|
1573
|
|
1574 //----- (004C05CC) --------------------------------------------------------
|
|
1575 bool Vis::_4C05CC(Vis_stru1 *a2, stru157 *a3, stru157 *a4)
|
|
1576 {
|
|
1577 Vis_stru1 *v4; // esi@1
|
|
1578 Vis *v5; // ebx@1
|
|
1579 char *v6; // edi@3
|
|
1580 float v7; // ST00_4@3
|
|
1581 bool result; // eax@6
|
|
1582 float v9; // [sp+4h] [bp-14h]@3
|
|
1583
|
|
1584 v4 = a2;
|
|
1585 v5 = this;
|
|
1586 if ( !a2 )
|
|
1587 v4 = &this->stru1;
|
|
1588 v4->uNumPointers = 0;
|
|
1589 v6 = (char *)&this->field_20CC;
|
|
1590 v7 = (double)this->field_20CC;
|
|
1591 _4C06F8(v7, v4, a3);
|
|
1592 v9 = (double)*(signed int *)v6;
|
|
1593 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
|
|
1594 _4C0D32_BLV(v9, v4, a4);
|
|
1595 else
|
|
1596 _4C0DEA_ODM(v9, v4, a4);
|
|
1597 v4->create_object_pointers(1u);
|
|
1598 sort_object_pointers(v4->array_1804, 0, v4->uNumPointers - 1);
|
|
1599 return true;
|
|
1600 }
|
|
1601
|
|
1602 //----- (004C0646) --------------------------------------------------------
|
|
1603 bool Vis::PickMouse(float fDepth, float fMouseX, float fMouseY, stru157 *a5, stru157 *a6)
|
|
1604 {
|
|
1605 RenderVertexSoft pMouseRay[2]; // [sp+1Ch] [bp-60h]@1
|
|
1606
|
45
|
1607 stru1.uNumPointers = 0;
|
0
|
1608 CastPickRay(pMouseRay, fMouseX, fMouseY, fDepth);
|
45
|
1609 PickBillboards(fDepth, fMouseX, fMouseY, &stru1, a5);
|
3
|
1610 if (uCurrentlyLoadedLevelType == LEVEL_Indoor)
|
45
|
1611 PickIndoor(fDepth, pMouseRay, &stru1, a6);
|
0
|
1612 else
|
45
|
1613 PickOutdoor(fDepth, pMouseRay, &stru1, a6, 0);
|
|
1614 stru1.create_object_pointers(0);
|
|
1615 sort_object_pointers(stru1.array_1804, 0, stru1.uNumPointers - 1);
|
0
|
1616 return true;
|
|
1617 }
|
|
1618
|
|
1619 //----- (004C06F8) --------------------------------------------------------
|
|
1620 void Vis::_4C06F8(float arg0, Vis_stru1 *a3, stru157 *a2)
|
|
1621 {
|
|
1622 int v4; // ST18_4@5
|
|
1623 Vis_stru1_stru0 *v5; // edi@5
|
|
1624 void **v7; // [sp+24h] [bp-8h]@2
|
|
1625 unsigned int uD3DBillboardIdx; // [sp+28h] [bp-4h]@1
|
|
1626
|
|
1627 uD3DBillboardIdx = 0;
|
|
1628 auto ecx0 = this;
|
|
1629 if ( (signed int)pRenderer->uNumBillboardsToDraw > 0 )
|
|
1630 {
|
|
1631 v7 = (void **)&pRenderer->pBillboardRenderListD3D[0].uParentBillboardID;
|
|
1632 do
|
|
1633 {
|
|
1634 if ( is_part_of_selection((BLVFace *)uD3DBillboardIdx, a2) )
|
|
1635 {
|
|
1636 if ( DoesRayIntersectBillboard(arg0, uD3DBillboardIdx) )
|
|
1637 {
|
|
1638 v4 = pBillboardRenderList[(int)*v7].sZValue;
|
|
1639 v5 = &a3->array_0004[a3->uNumPointers];
|
|
1640 v5->pObjectInfo = *v7;
|
|
1641 v5 = (Vis_stru1_stru0 *)((char *)v5 + 4);
|
|
1642 v5->pObjectInfo = (void *)v4;
|
|
1643 v5->sZValue = 1;
|
|
1644 ++a3->uNumPointers;
|
|
1645 }
|
|
1646 }
|
|
1647 ++uD3DBillboardIdx;
|
|
1648 v7 += 39;
|
|
1649 }
|
|
1650 while ( (signed int)uD3DBillboardIdx < (signed int)pRenderer->uNumBillboardsToDraw );
|
|
1651 }
|
|
1652 }
|
|
1653
|
|
1654 //----- (004C0791) --------------------------------------------------------
|
|
1655 bool Vis::is_part_of_selection(BLVFace *uD3DBillboardIdx_or_pBLVFace_or_pODMFace, stru157 *a2)
|
|
1656 {
|
|
1657 stru157 *v3; // esi@1
|
|
1658 int result; // eax@1
|
|
1659 int v5; // edx@2
|
|
1660 int v6; // ecx@2
|
|
1661 char v7; // zf@3
|
|
1662 int v8; // esi@5
|
|
1663 std::string *v9; // ecx@7
|
|
1664 Actor *v10; // edi@18
|
|
1665 char v11; // zf@26
|
|
1666 const char *v12; // [sp-20h] [bp-2Ch]@7
|
|
1667 int v13; // [sp-1Ch] [bp-28h]@7
|
|
1668 std::string v14; // [sp-18h] [bp-24h]@7
|
|
1669 const char *v15; // [sp-8h] [bp-14h]@7
|
|
1670 int v16; // [sp-4h] [bp-10h]@7
|
|
1671
|
|
1672 v3 = a2;
|
|
1673 result = a2->field_0;
|
|
1674 if ( a2->field_0 != 1 )
|
|
1675 {
|
|
1676 if ( result != 2
|
|
1677 || (uCurrentlyLoadedLevelType != LEVEL_Indoor ? (v11 = LOWORD(uD3DBillboardIdx_or_pBLVFace_or_pODMFace[3].pFacePlane.vNormal.y) == 0,
|
|
1678 result = uD3DBillboardIdx_or_pBLVFace_or_pODMFace->pFacePlane_old.dist) : (v11 = pIndoor->pFaceExtras[uD3DBillboardIdx_or_pBLVFace_or_pODMFace->uFaceExtraID].uEventID == 0, result = uD3DBillboardIdx_or_pBLVFace_or_pODMFace->uAttributes),
|
|
1679 a2->field_4 != 1) )
|
|
1680 goto LABEL_16;
|
|
1681 if ( v11 || result & a2->field_C )
|
|
1682 goto LABEL_33;
|
|
1683 v7 = (result & a2->field_8) == 0;
|
|
1684 goto LABEL_32;
|
|
1685 }
|
|
1686 v5 = a2->field_10;
|
|
1687 result = (pBillboardRenderList[pRenderer->pBillboardRenderListD3D[(int)uD3DBillboardIdx_or_pBLVFace_or_pODMFace].uParentBillboardID].sZValue & 0xFFFF) >> 3;
|
|
1688 v6 = pBillboardRenderList[pRenderer->pBillboardRenderListD3D[(int)uD3DBillboardIdx_or_pBLVFace_or_pODMFace].uParentBillboardID].sZValue & 7;
|
|
1689 if ( v5 & 2 )
|
|
1690 {
|
|
1691 v7 = v6 == a2->field_4;
|
|
1692 goto LABEL_32;
|
|
1693 }
|
|
1694 if ( v5 & 4 )
|
|
1695 {
|
|
1696 v8 = a2->field_4;
|
|
1697 if ( v6 != v8 )
|
|
1698 goto LABEL_16;
|
|
1699 if ( v8 != 5 )
|
|
1700 {
|
|
1701 v15 = "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Vis.cpp:207";
|
|
1702 v12 = "Unsupported \"exclusion if no event\" type in CVis::is_part_of_selection";
|
|
1703 LABEL_15:
|
|
1704 MessageBoxA(nullptr, v12, v15, 0);
|
|
1705 return true;
|
|
1706 }
|
|
1707 result *= 32;
|
|
1708 if ( *(__int16 *)((char *)&pLevelDecorations[0].uCog + result)
|
|
1709 || *(__int16 *)((char *)&pLevelDecorations[0].field_16_event_id + result) )
|
|
1710 goto LABEL_16;
|
|
1711 result = pLevelDecorations[result / sizeof(LevelDecoration)].IsInteractive();
|
|
1712 goto LABEL_11;
|
|
1713 }
|
|
1714 if ( v6 == a2->field_4 )
|
|
1715 {
|
|
1716 if ( v6 != 3 )
|
|
1717 {
|
|
1718 v15 = "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Vis.cpp:245";
|
|
1719 v12 = "Default case reached in VIS";
|
|
1720 goto LABEL_15;
|
|
1721 }
|
|
1722 v10 = &pActors[result];
|
|
1723 result = 1 << LOBYTE(v10->uAIState);
|
|
1724 if ( result & a2->field_C
|
|
1725 || !(result & a2->field_8)
|
|
1726 || v5 & 8 && (result = MonsterStats::BelongsToSupertype(v10->pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD)) == 0 )
|
|
1727 goto LABEL_33;
|
|
1728 if ( !(v3->field_10 & 1) )
|
|
1729 goto LABEL_16;
|
|
1730 result = v10->GetActorsRelation(nullptr);
|
|
1731 LABEL_11:
|
|
1732 v7 = result == 0;
|
|
1733 LABEL_32:
|
|
1734 if ( v7 )
|
|
1735 goto LABEL_33;
|
|
1736 LABEL_16:
|
|
1737 return true;
|
|
1738 }
|
|
1739 LABEL_33:
|
|
1740 LOBYTE(result) = 0;
|
|
1741 return result;
|
|
1742 }
|
|
1743
|
|
1744 //----- (004C091D) --------------------------------------------------------
|
|
1745 bool Vis::DoesRayIntersectBillboard(float fDepth, unsigned int uD3DBillboardIdx)
|
|
1746 {
|
|
1747 unsigned int v3; // esi@3
|
|
1748 bool result; // eax@3
|
|
1749 int v5; // ecx@4
|
|
1750 double v6; // st7@4
|
|
1751 __int16 v7; // fps@4
|
|
1752 double v8; // st7@4
|
|
1753 unsigned __int8 v9; // c0@4
|
|
1754 char v10; // c2@4
|
|
1755 unsigned __int8 v11; // c3@4
|
|
1756 Vis_stru1_stru0 *v12; // eax@10
|
|
1757 __int16 v13; // fps@16
|
|
1758 double v14; // st7@16
|
|
1759 char v15; // c0@16
|
|
1760 char v16; // c2@16
|
|
1761 char v17; // c3@16
|
|
1762 double v18; // st7@18
|
|
1763 double v19; // st6@18
|
|
1764 double v20; // st4@18
|
|
1765 float v21; // ST0C_4@22
|
|
1766 float v22; // ST08_4@22
|
|
1767 signed int v23; // eax@27
|
|
1768 double v24; // st7@32
|
|
1769 double v25; // st6@32
|
|
1770 float v26; // eax@32
|
|
1771 double v27; // st7@36
|
|
1772 double v28; // st6@36
|
|
1773 __int16 v29; // fps@36
|
|
1774 char v30; // c0@36
|
|
1775 char v31; // c2@36
|
|
1776 char v32; // c3@36
|
|
1777 double v33; // st6@37
|
|
1778 __int16 v34; // fps@37
|
|
1779 char v35; // c0@37
|
|
1780 char v36; // c2@37
|
|
1781 char v37; // c3@37
|
|
1782 __int16 v38; // fps@38
|
|
1783 double v39; // st6@38
|
|
1784 unsigned __int8 v40; // c0@38
|
|
1785 char v41; // c2@38
|
|
1786 unsigned __int8 v42; // c3@38
|
|
1787 __int16 v43; // fps@39
|
|
1788 double v44; // st6@39
|
|
1789 char v45; // c0@39
|
|
1790 char v46; // c2@39
|
|
1791 char v47; // c3@39
|
|
1792 Vis *v48; // esi@40
|
|
1793 float v49; // ST08_4@40
|
|
1794 Vis_stru1_stru0 *v50; // eax@45
|
|
1795 RenderVertexSoft pRay[2]; // [sp+20h] [bp-DCh]@5
|
|
1796 RenderVertexSoft a3[2]; // [sp+80h] [bp-7Ch]@22
|
|
1797 float v53; // [sp+E0h] [bp-1Ch]@33
|
|
1798 float v54; // [sp+E4h] [bp-18h]@32
|
|
1799 float fBillboardCenterX; // [sp+E8h] [bp-14h]@5
|
|
1800 float fBillboardCenterY; // [sp+ECh] [bp-10h]@5
|
|
1801 unsigned int v57; // [sp+F0h] [bp-Ch]@5
|
|
1802 float v58; // [sp+F4h] [bp-8h]@17
|
|
1803 Vis *thisa; // [sp+F8h] [bp-4h]@1
|
|
1804 signed int a3a; // [sp+108h] [bp+Ch]@17
|
|
1805 float a3b; // [sp+108h] [bp+Ch]@32
|
|
1806
|
|
1807 thisa = this;
|
|
1808
|
|
1809 static Vis_stru1 Vis_static_stru_F91E10;
|
|
1810
|
|
1811 Vis_static_stru_F91E10.uNumPointers = 0;
|
|
1812 v3 = uD3DBillboardIdx;
|
|
1813 result = pRenderer->pBillboardRenderListD3D[uD3DBillboardIdx].uParentBillboardID;
|
|
1814 if ( result != -1
|
|
1815 && (v5 = pBillboardRenderList[result].sZValue,
|
|
1816 v6 = (double)(unsigned __int16)pBillboardRenderList[result].sZValue,
|
|
1817 result = v5 >> 16,
|
|
1818 v8 = v6 * 0.000015259022 + (double)(v5 >> 16),
|
|
1819 //UNDEF(v7),
|
|
1820 v9 = v8 < fDepth,
|
|
1821 v10 = 0,
|
|
1822 v11 = v8 == fDepth,
|
|
1823 BYTE1(result) = HIBYTE(v7),
|
|
1824 v9 | v11) )
|
|
1825 {
|
|
1826 LOWORD(v5) = 0;
|
|
1827 v57 = v5;
|
|
1828 GetPolygonCenter(
|
|
1829 pRenderer->pBillboardRenderListD3D[v3].pQuards,
|
|
1830 4u,
|
|
1831 &fBillboardCenterX,
|
|
1832 &fBillboardCenterY);
|
|
1833 CastPickRay(pRay, fBillboardCenterX, fBillboardCenterY, fDepth);
|
|
1834 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
|
|
1835 PickIndoor(fDepth, pRay, &Vis_static_stru_F91E10, &a5);
|
|
1836 else
|
|
1837 PickOutdoor(fDepth, pRay, &Vis_static_stru_F91E10, &a5, 0);
|
|
1838 Vis_static_stru_F91E10.create_object_pointers(0);
|
|
1839 sort_object_pointers(Vis_static_stru_F91E10.array_1804, 0, Vis_static_stru_F91E10.uNumPointers - 1);
|
|
1840 HIWORD(result) = HIWORD(Vis_static_stru_F91E10.uNumPointers);
|
|
1841 if ( Vis_static_stru_F91E10.uNumPointers
|
|
1842 && ((signed int)Vis_static_stru_F91E10.uNumPointers <= 0 ? (v12 = 0) : (v12 = Vis_static_stru_F91E10.array_1804[0]),
|
|
1843 result = v12->sZValue,
|
|
1844 LOWORD(result) = 0,
|
|
1845 result <= v57)
|
|
1846 || (double)(signed int)pViewport->uScreenX > fBillboardCenterX
|
|
1847 || (double)(signed int)pViewport->uScreenZ < fBillboardCenterX
|
|
1848 || (double)(signed int)pViewport->uScreenY > fBillboardCenterY
|
|
1849 || (v14 = (double)(signed int)pViewport->uScreenW,
|
|
1850 //UNDEF(v13),
|
|
1851 v15 = v14 < fBillboardCenterY,
|
|
1852 v16 = 0,
|
|
1853 v17 = v14 == fBillboardCenterY,
|
|
1854 BYTE1(result) = HIBYTE(v13),
|
|
1855 v14 < fBillboardCenterY) )
|
|
1856 {
|
|
1857 a3a = 0;
|
|
1858 result = (bool)&pRenderer->pBillboardRenderListD3D[v3].pQuards[0].pos.y;
|
|
1859
|
|
1860 __debugbreak();
|
|
1861 {
|
|
1862 LODWORD(v58) = (int)((char *)&pRenderer + v3 * 156 + 1062620);// pBillboardRenderListD3D+0x0C
|
|
1863 }
|
|
1864
|
|
1865 while ( 1 )
|
|
1866 {
|
|
1867 v18 = *(float *)(result - 4);
|
|
1868 v19 = *(float *)result;
|
|
1869 v20 = *(float *)(result - 4);
|
|
1870 Vis_static_stru_F91E10.uNumPointers = 0;
|
|
1871 if ( v20 >= (double)(signed int)pViewport->uScreenX )
|
|
1872 {
|
|
1873 if ( v18 <= (double)(signed int)pViewport->uScreenZ
|
|
1874 && v19 >= (double)(signed int)pViewport->uScreenY
|
|
1875 && v19 <= (double)(signed int)pViewport->uScreenW )
|
|
1876 {
|
|
1877 v21 = v19;
|
|
1878 v22 = v18;
|
|
1879 CastPickRay(a3, v22, v21, fDepth);
|
|
1880 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
|
|
1881 PickIndoor(fDepth, a3, &Vis_static_stru_F91E10, &a5);
|
|
1882 else
|
|
1883 PickOutdoor(fDepth, a3, &Vis_static_stru_F91E10, &a5, 0);
|
|
1884 Vis_static_stru_F91E10.create_object_pointers(0);
|
|
1885 sort_object_pointers(
|
|
1886 Vis_static_stru_F91E10.array_1804,
|
|
1887 0,
|
|
1888 Vis_static_stru_F91E10.uNumPointers - 1);
|
|
1889 result = Vis_static_stru_F91E10.uNumPointers;
|
|
1890 if ( !Vis_static_stru_F91E10.uNumPointers )
|
|
1891 break;
|
|
1892 v23 = (signed int)(Vis_static_stru_F91E10.uNumPointers <= 0 ? 0 : Vis_static_stru_F91E10.array_1804[0]);
|
|
1893 result = *(int *)(v23 + 4);
|
|
1894 LOWORD(result) = 0;
|
|
1895 if ( result > v57 )
|
|
1896 break;
|
|
1897 }
|
|
1898 }
|
|
1899 ++a3a;
|
|
1900 result = LODWORD(v58) + 32;
|
|
1901 LODWORD(v58) += 32;
|
|
1902 if ( a3a >= 4 )
|
|
1903 {
|
|
1904 if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor )
|
|
1905 goto LABEL_49;
|
|
1906 v24 = pRenderer->pBillboardRenderListD3D[v3].pQuards[0].pos.x;
|
|
1907 v25 = pRenderer->pBillboardRenderListD3D[v3].pQuards[3].pos.x;
|
|
1908 v26 = pRenderer->pBillboardRenderListD3D[v3].pQuards[0].pos.y;
|
|
1909 v54 = pRenderer->pBillboardRenderListD3D[v3].pQuards[3].pos.x;
|
|
1910 v58 = v26;
|
|
1911 result = LODWORD(pRenderer->pBillboardRenderListD3D[v3].pQuards[1].pos.y);
|
|
1912 a3b = pRenderer->pBillboardRenderListD3D[v3].pQuards[1].pos.y;
|
|
1913 if ( v24 > v25 )
|
|
1914 {
|
|
1915 v53 = v24;
|
|
1916 v24 = v54;
|
|
1917 v25 = v53;
|
|
1918 }
|
|
1919 if ( v58 > (double)a3b )
|
|
1920 a3b = v58;
|
|
1921 if ( (Vis_static_stru_F91E10.uNumPointers = 0,
|
|
1922 v27 = (v25 - v24) * 0.5,
|
|
1923 v28 = (double)(signed int)pViewport->uScreenX,
|
|
1924 //UNDEF(v29),
|
|
1925 v30 = v27 < v28,
|
|
1926 v31 = 0,
|
|
1927 v32 = v27 == v28,
|
|
1928 BYTE1(result) = HIBYTE(v29),
|
|
1929 v27 < v28)
|
|
1930 || (v33 = (double)(signed int)pViewport->uScreenZ,
|
|
1931 //UNDEF(v34),
|
|
1932 v35 = v27 < v33,
|
|
1933 v36 = 0,
|
|
1934 v37 = v27 == v33,
|
|
1935 BYTE1(result) = HIBYTE(v34),
|
|
1936 v27 > v33)
|
|
1937 || (v39 = (double)(signed int)pViewport->uScreenY,
|
|
1938 //UNDEF(v38),
|
|
1939 v40 = v39 < a3b,
|
|
1940 v41 = 0,
|
|
1941 v42 = v39 == a3b,
|
|
1942 BYTE1(result) = HIBYTE(v38),
|
|
1943 !(v40 | v42))
|
|
1944 || (v44 = (double)(signed int)pViewport->uScreenW,
|
|
1945 //UNDEF(v43),
|
|
1946 v45 = v44 < a3b,
|
|
1947 v46 = 0,
|
|
1948 v47 = v44 == a3b,
|
|
1949 BYTE1(result) = HIBYTE(v43),
|
|
1950 v44 < a3b)
|
|
1951 || ((v48 = thisa, v49 = v27, CastPickRay(a3, v49, a3b, fDepth), uCurrentlyLoadedLevelType != LEVEL_Indoor) ? PickOutdoor(fDepth, a3, &Vis_static_stru_F91E10, &a5, 0) : PickIndoor(fDepth, a3, &Vis_static_stru_F91E10, &a5),
|
|
1952 (Vis_static_stru_F91E10.create_object_pointers(0),
|
|
1953 sort_object_pointers(
|
|
1954 Vis_static_stru_F91E10.array_1804,
|
|
1955 0,
|
|
1956 Vis_static_stru_F91E10.uNumPointers - 1),
|
|
1957 (result = Vis_static_stru_F91E10.uNumPointers) != 0)
|
|
1958 && ((signed int)Vis_static_stru_F91E10.uNumPointers <= 0 ? (v50 = 0) : (v50 = Vis_static_stru_F91E10.array_1804[0]),
|
|
1959 result = v50->sZValue,
|
|
1960 LOWORD(result) = 0,
|
|
1961 result <= v57)) )
|
|
1962 goto LABEL_49;
|
|
1963 break;
|
|
1964 }
|
|
1965 }
|
|
1966 }
|
|
1967 LOBYTE(result) = 1;
|
|
1968 }
|
|
1969 else
|
|
1970 {
|
|
1971 LABEL_49:
|
|
1972 return false;
|
|
1973 }
|
|
1974 return result;
|
|
1975 }
|
|
1976 // F93E18: using guessed type char static_byte_F93E18_init;
|
|
1977
|
|
1978 //----- (004C0D32) --------------------------------------------------------
|
|
1979 int Vis::_4C0D32_BLV(float a1, Vis_stru1 *arg4, stru157 *a2)
|
|
1980 {
|
|
1981 int result; // eax@1
|
|
1982 signed int v5; // esi@2
|
|
1983 BLVFace *v6; // edi@4
|
|
1984 unsigned int v7; // eax@6
|
|
1985 Vis_stru1_stru0 *v8; // eax@6
|
|
1986 int v9; // ST18_4@7
|
|
1987 unsigned int v10; // ST1C_4@7
|
|
1988 unsigned int v11; // ecx@7
|
|
1989 signed int i; // [sp+18h] [bp-8h]@1
|
|
1990 Vis *thisa; // [sp+1Ch] [bp-4h]@1
|
|
1991
|
|
1992 result = 0;
|
|
1993 thisa = this;
|
|
1994 for ( i = 0; i < (signed int)pStru170->uNumFaceIDs; ++i )
|
|
1995 {
|
|
1996 v5 = pStru170->pFaceIDs[2 * result];
|
|
1997 if ( v5 >= 0 )
|
|
1998 {
|
|
1999 if ( v5 < (signed int)pIndoor->uNumFaces )
|
|
2000 {
|
|
2001 v6 = &pIndoor->pFaces[v5];
|
59
|
2002 if ( !pGame->pIndoorCameraD3D->IsCulled(&pIndoor->pFaces[v5]) )
|
0
|
2003 {
|
|
2004 if ( is_part_of_selection(v6, a2) )
|
|
2005 {
|
|
2006 v7 = 8 * v5;
|
|
2007 LOBYTE(v7) = 8 * v5 | 6;
|
|
2008 v8 = _4C1026(v6, v7, a1);
|
|
2009 if ( v8 )
|
|
2010 {
|
|
2011 v9 = v8->sZValue;
|
|
2012 v10 = v8->uObjectType;
|
|
2013 v11 = 3 * arg4->uNumPointers;
|
|
2014 arg4->array_0004[arg4->uNumPointers].pObjectInfo = v8->pObjectInfo;
|
|
2015 arg4->array_0004[4 * v11 / 0xC].sZValue = v9;
|
|
2016 arg4->array_0004[4 * v11 / 0xC].uObjectType = v10;
|
|
2017 ++arg4->uNumPointers;
|
|
2018 }
|
|
2019 }
|
|
2020 }
|
|
2021 }
|
|
2022 }
|
|
2023 result = i + 1;
|
|
2024 }
|
|
2025 return result;
|
|
2026 }
|
|
2027
|
|
2028 //----- (004C0DEA) --------------------------------------------------------
|
|
2029 void Vis::_4C0DEA_ODM(float arg0, Vis_stru1 *a3, stru157 *a2)
|
|
2030 {
|
|
2031 int v4; // esi@1
|
|
2032 BSPModel *v5; // ebx@3
|
|
2033 unsigned __int8 v6; // zf@5
|
|
2034 char v7; // sf@5
|
|
2035 unsigned __int8 v8; // of@5
|
|
2036 ODMFace *v9; // esi@7
|
|
2037 unsigned int v10; // eax@8
|
|
2038 Vis_stru1_stru0 *v11; // eax@8
|
|
2039 unsigned int v12; // ecx@9
|
|
2040 BLVFace f; // [sp+10h] [bp-84h]@1
|
|
2041 void *v14; // [sp+70h] [bp-24h]@9
|
|
2042 int v15; // [sp+74h] [bp-20h]@9
|
|
2043 unsigned int v16; // [sp+78h] [bp-1Ch]@9
|
|
2044 int v17; // [sp+7Ch] [bp-18h]@1
|
|
2045 Vis *v18; // [sp+80h] [bp-14h]@1
|
|
2046 int v19; // [sp+84h] [bp-10h]@6
|
|
2047 unsigned int v20; // [sp+88h] [bp-Ch]@2
|
|
2048 int v21; // [sp+8Ch] [bp-8h]@5
|
|
2049 int a1; // [sp+90h] [bp-4h]@1
|
|
2050
|
|
2051 auto ecx0 = this;
|
|
2052 v18 = ecx0;
|
|
2053 v4 = 0;
|
|
2054 v17 = 0;
|
|
2055 a1 = 0;
|
|
2056 if ( (signed int)pOutdoor->uNumBModels > 0 )
|
|
2057 {
|
|
2058 v20 = 0;
|
|
2059 do
|
|
2060 {
|
|
2061 v5 = &pOutdoor->pBModels[v20 / 0xBC];
|
|
2062 if ( IsBModelVisible(a1, &v17) )
|
|
2063 {
|
|
2064 if ( v17 != v4 )
|
|
2065 {
|
|
2066 v8 = __OFSUB__(v5->uNumFaces, v4);
|
|
2067 v6 = v5->uNumFaces == v4;
|
|
2068 v7 = ((v5->uNumFaces - v4) & 0x80000000u) != 0;
|
|
2069 v21 = v4;
|
|
2070 if ( !((unsigned __int8)(v7 ^ v8) | v6) )
|
|
2071 {
|
|
2072 v19 = v4;
|
|
2073 do
|
|
2074 {
|
|
2075 v9 = (ODMFace *)((char *)v5->pFaces + v19);
|
|
2076 if ( is_part_of_selection((BLVFace *)((char *)v5->pFaces + v19), a2) )
|
|
2077 {
|
|
2078 f.FromODM(v9);
|
|
2079 v10 = 8 * (v21 | (a1 << 6));
|
|
2080 LOBYTE(v10) = v10 | 6;
|
|
2081 v11 = _4C1026(&f, v10, arg0);
|
|
2082 if ( v11 )
|
|
2083 {
|
|
2084 v14 = v11->pObjectInfo;
|
|
2085 v15 = v11->sZValue;
|
|
2086 v12 = a3->uNumPointers;
|
|
2087 v16 = v11->uObjectType;
|
|
2088 v12 *= 3;
|
|
2089 *((int *)&a3->array_0004[0].pObjectInfo + v12) = (int)v14;
|
|
2090 *(&a3->array_0004[0].sZValue + v12) = v15;
|
|
2091 *(&a3->array_0004[0].uObjectType + v12) = v16;
|
|
2092 ++a3->uNumPointers;
|
|
2093 }
|
|
2094 }
|
|
2095 ++v21;
|
|
2096 v19 += 308;
|
|
2097 }
|
|
2098 while ( v21 < (signed int)v5->uNumFaces );
|
|
2099 v4 = 0;
|
|
2100 }
|
|
2101 }
|
|
2102 }
|
|
2103 ++a1;
|
|
2104 v20 += 188;
|
|
2105 }
|
|
2106 while ( a1 < (signed int)pOutdoor->uNumBModels );
|
|
2107 }
|
|
2108 } |