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