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