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