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