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