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