Mercurial > mm7
annotate mm7_3.cpp @ 1613:aaefada3e1d8
Слияние
author | Ritor1 |
---|---|
date | Sun, 15 Sep 2013 00:41:51 +0600 |
parents | 75fafd8ced59 |
children | 69ab7593e7af |
rev | line source |
---|---|
1165
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1160
diff
changeset
|
1 #ifdef _MSC_VER |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1160
diff
changeset
|
2 #define _CRT_SECURE_NO_WARNINGS |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1160
diff
changeset
|
3 #endif |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1160
diff
changeset
|
4 |
1323 | 5 #include "Weather.h" |
1262 | 6 #include "Texture.h" |
7 #include "mm7_data.h" | |
1016 | 8 #include "Sprites.h" |
9 #include "BSPModel.h" | |
10 #include "OutdoorCamera.h" | |
11 #include "LightmapBuilder.h" | |
12 #include "DecalBuilder.h" | |
13 #include "ParticleEngine.h" | |
14 #include "Mouse.h" | |
15 #include "Keyboard.h" | |
16 #include "stru6.h" | |
1263 | 17 #include "FactionTable.h" |
0 | 18 #include "MapInfo.h" |
19 #include "Game.h" | |
20 #include "GUIWindow.h" | |
21 #include "GUIFont.h" | |
22 #include "GUIProgressBar.h" | |
23 #include "Party.h" | |
24 #include "AudioPlayer.h" | |
25 #include "Outdoor.h" | |
1277 | 26 #include "Outdoor_stuff.h" |
0 | 27 #include "IndoorCamera.h" |
28 #include "Overlays.h" | |
29 #include "LOD.h" | |
30 #include "Actor.h" | |
31 #include "Events.h" | |
32 #include "Viewport.h" | |
33 #include "Math.h" | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
34 #include "SpriteObject.h" |
0 | 35 #include "ObjectList.h" |
36 #include "PaletteManager.h" | |
37 #include "DecorationList.h" | |
38 #include "stru123.h" | |
39 #include "Time.h" | |
40 #include "IconFrameTable.h" | |
41 #include "TurnEngine.h" | |
42 #include "Events2D.h" | |
43 #include "stru176.h" | |
44 #include "stru298.h" | |
189 | 45 #include "texts.h" |
0 | 46 #include "Log.h" |
1262 | 47 #include "Lights.h" |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
48 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
49 #include "MM7.h" |
0 | 50 |
51 //----- (0046E44E) -------------------------------------------------------- | |
1458 | 52 int _46E44E_collide_against_faces_and_portals(unsigned int b1) |
0 | 53 { |
717 | 54 BLVSector *pSector; // edi@1 |
0 | 55 signed int v2; // ebx@1 |
717 | 56 BLVFace *pFace; // esi@2 |
57 __int16 pNextSector; // si@10 | |
58 int pArrayNum; // ecx@12 | |
0 | 59 unsigned __int8 v6; // sf@12 |
60 unsigned __int8 v7; // of@12 | |
61 int result; // eax@14 | |
717 | 62 //BLVSector *v9; // ebx@15 |
0 | 63 int v10; // ecx@15 |
717 | 64 int pFloor; // eax@16 |
65 //BLVFace *v12; // ebp@16 | |
0 | 66 int v13; // eax@24 |
67 int v14; // esi@24 | |
68 int v15; // eax@24 | |
69 int v16; // edx@25 | |
70 int v17; // eax@29 | |
71 unsigned int v18; // eax@33 | |
72 int v19; // eax@35 | |
73 int v20; // edx@35 | |
74 int v21; // eax@35 | |
75 int v22; // ecx@36 | |
76 int v23; // eax@40 | |
77 unsigned int v24; // eax@44 | |
78 int a3; // [sp+10h] [bp-48h]@28 | |
79 int v26; // [sp+14h] [bp-44h]@15 | |
80 int i; // [sp+18h] [bp-40h]@1 | |
81 int a10; // [sp+1Ch] [bp-3Ch]@1 | |
82 int v29; // [sp+20h] [bp-38h]@14 | |
83 int v30; // [sp+24h] [bp-34h]@35 | |
84 int v31; // [sp+28h] [bp-30h]@24 | |
85 int v32; // [sp+2Ch] [bp-2Ch]@15 | |
717 | 86 int pSectorsArray[10]; // [sp+30h] [bp-28h]@1 |
87 | |
88 pSector = &pIndoor->pSectors[stru_721530.uSectorID]; | |
0 | 89 v2 = 0; |
90 a10 = b1; | |
717 | 91 pSectorsArray[0] = stru_721530.uSectorID; |
92 for ( i = 1; v2 < pSector->uNumPortals; ++v2 ) | |
93 { | |
94 pFace = &pIndoor->pFaces[pSector->pPortals[v2]]; | |
95 if ( stru_721530.sMaxX <= pFace->pBounding.x2 | |
96 && stru_721530.sMinX >= pFace->pBounding.x1 | |
97 && stru_721530.sMaxY <= pFace->pBounding.y2 | |
98 && stru_721530.sMinY >= pFace->pBounding.y1 | |
99 && stru_721530.sMaxZ <= pFace->pBounding.z2 | |
100 && stru_721530.sMinZ >= pFace->pBounding.z1 | |
101 && abs((pFace->pFacePlane_old.dist | |
102 + stru_721530.normal.x * pFace->pFacePlane_old.vNormal.x | |
103 + stru_721530.normal.y * pFace->pFacePlane_old.vNormal.y | |
104 + stru_721530.normal.z * pFace->pFacePlane_old.vNormal.z) >> 16) <= stru_721530.field_6C + 16 ) | |
105 { | |
106 pNextSector = pFace->uSectorID == stru_721530.uSectorID ? pFace->uBackSectorID : pFace->uSectorID;//FrontSectorID | |
107 pArrayNum = i++; | |
108 v7 = i < 10; | |
0 | 109 v6 = i - 10 < 0; |
717 | 110 pSectorsArray[pArrayNum] = pNextSector; |
0 | 111 if ( !(v6 ^ v7) ) |
112 break; | |
113 } | |
114 } | |
115 result = 0; | |
116 v29 = 0; | |
117 if ( i > 0 ) | |
118 { | |
119 while ( 1 ) | |
120 { | |
717 | 121 pSector = &pIndoor->pSectors[pSectorsArray[result]]; |
0 | 122 v10 = 0; |
717 | 123 v32 = pSector->uNumFloors + pSector->uNumWalls + pSector->uNumCeilings; |
0 | 124 v26 = 0; |
125 if ( v32 > 0 ) | |
126 break; | |
127 LABEL_46: | |
128 result = v29++ + 1; | |
129 if ( v29 >= i ) | |
130 return result; | |
131 } | |
132 while ( 1 ) | |
133 { | |
717 | 134 pFloor = pSector->pFloors[v10]; |
135 pFace = &pIndoor->pFaces[pFloor]; | |
136 if ( pFace->Portal() | |
137 || stru_721530.sMaxX > pFace->pBounding.x2 | |
138 || stru_721530.sMinX < pFace->pBounding.x1 | |
139 || stru_721530.sMaxY > pFace->pBounding.y2 | |
140 || stru_721530.sMinY < pFace->pBounding.y1 | |
141 || stru_721530.sMaxZ > pFace->pBounding.z2 | |
142 || stru_721530.sMinZ < pFace->pBounding.z1 | |
143 || pFloor == stru_721530.field_84 ) | |
0 | 144 goto LABEL_45; |
717 | 145 v13 = pFace->pFacePlane_old.vNormal.y; |
146 v14 = pFace->pFacePlane_old.dist; | |
0 | 147 v31 = v13; |
717 | 148 v15 = (stru_721530.normal.x * pFace->pFacePlane_old.vNormal.x + v14 + stru_721530.normal.y * v13 |
149 + stru_721530.normal.z * pFace->pFacePlane_old.vNormal.z) >> 16; | |
0 | 150 if ( v15 > 0 ) |
151 { | |
717 | 152 v16 = (stru_721530.normal2.y * v31 + pFace->pFacePlane_old.dist + stru_721530.normal2.z * pFace->pFacePlane_old.vNormal.z |
153 + stru_721530.normal2.x * pFace->pFacePlane_old.vNormal.x) >> 16; | |
0 | 154 if ( v15 <= stru_721530.prolly_normal_d || v16 <= stru_721530.prolly_normal_d ) |
155 { | |
156 if ( v16 <= v15 ) | |
157 { | |
158 a3 = stru_721530.field_6C; | |
717 | 159 if ( sub_47531C(stru_721530.prolly_normal_d, &a3, stru_721530.normal.x, stru_721530.normal.y, stru_721530.normal.z, |
1546 | 160 stru_721530.direction.x, stru_721530.direction.y, stru_721530.direction.z, pFace, a10) ) |
0 | 161 { |
162 v17 = a3; | |
163 } | |
164 else | |
165 { | |
166 a3 = stru_721530.field_6C + stru_721530.prolly_normal_d; | |
1546 | 167 if ( !sub_475D85(&stru_721530.normal, &stru_721530.direction, &a3, pFace) ) |
0 | 168 goto LABEL_34; |
169 v17 = a3 - stru_721530.prolly_normal_d; | |
170 a3 -= stru_721530.prolly_normal_d; | |
171 } | |
172 if ( v17 < stru_721530.field_7C ) | |
173 { | |
174 stru_721530.field_7C = v17; | |
717 | 175 v18 = 8 * pSector->pFloors[v26]; |
0 | 176 LOBYTE(v18) = v18 | 6; |
177 stru_721530.uFaceID = v18; | |
178 } | |
179 } | |
180 } | |
181 } | |
182 LABEL_34: | |
183 if ( !(stru_721530.field_0 & 1) | |
717 | 184 || (v19 = pFace->pFacePlane_old.vNormal.x, |
185 v20 = pFace->pFacePlane_old.vNormal.y, | |
0 | 186 v30 = v19, |
1546 | 187 v21 = (stru_721530.position.x * v19 + pFace->pFacePlane_old.dist + stru_721530.position.y * v20 |
188 + stru_721530.position.z * pFace->pFacePlane_old.vNormal.z) >> 16, | |
0 | 189 v21 <= 0) |
717 | 190 || (v22 = (stru_721530.field_4C * v30 + pFace->pFacePlane_old.dist + stru_721530.field_50 * v20 |
191 + stru_721530.field_54 * pFace->pFacePlane_old.vNormal.z) >> 16, | |
0 | 192 v21 > stru_721530.prolly_normal_d) |
193 && v22 > stru_721530.prolly_normal_d | |
194 || v22 > v21 ) | |
195 goto LABEL_45; | |
196 a3 = stru_721530.field_6C; | |
1546 | 197 if ( sub_47531C(stru_721530.field_8_radius, &a3, stru_721530.position.x, stru_721530.position.y, stru_721530.position.z, |
198 stru_721530.direction.x, stru_721530.direction.y, stru_721530.direction.z, pFace, a10) ) | |
0 | 199 { |
200 v23 = a3; | |
201 goto LABEL_43; | |
202 } | |
1546 | 203 a3 = stru_721530.field_6C + stru_721530.field_8_radius; |
204 if ( sub_475D85(&stru_721530.position, &stru_721530.direction, &a3, pFace) ) | |
0 | 205 { |
206 v23 = a3 - stru_721530.prolly_normal_d; | |
207 a3 -= stru_721530.prolly_normal_d; | |
208 LABEL_43: | |
209 if ( v23 < stru_721530.field_7C ) | |
210 { | |
211 stru_721530.field_7C = v23; | |
717 | 212 v24 = 8 * pSector->pFloors[v26]; |
0 | 213 LOBYTE(v24) = v24 | 6; |
214 stru_721530.uFaceID = v24; | |
215 } | |
216 } | |
217 LABEL_45: | |
218 v10 = v26++ + 1; | |
219 if ( v26 >= v32 ) | |
220 goto LABEL_46; | |
221 } | |
222 } | |
223 return result; | |
224 } | |
225 // 46E44E: using guessed type int var_28[10]; | |
226 | |
227 //----- (0046E889) -------------------------------------------------------- | |
228 int __fastcall _46E889_collide_against_bmodels(unsigned int ecx0) | |
229 { | |
230 int result; // eax@1 | |
231 BSPModel *v2; // ecx@3 | |
232 int v3; // ebx@9 | |
233 ODMFace *v4; // eax@11 | |
234 int v5; // edi@17 | |
235 int v6; // esi@17 | |
236 unsigned int v7; // ecx@17 | |
237 int v8; // eax@19 | |
238 int v9; // ecx@20 | |
239 int v10; // eax@24 | |
240 int v11; // ST18_4@25 | |
241 int v12; // ST1C_4@25 | |
242 int v13; // ST0C_4@25 | |
243 unsigned int v14; // eax@28 | |
244 int v15; // eax@30 | |
245 int v16; // ecx@31 | |
246 unsigned int v17; // eax@36 | |
247 int v18; // ST18_4@41 | |
248 int v19; // ST1C_4@41 | |
249 int v20; // ST0C_4@41 | |
250 int v21; // eax@42 | |
251 unsigned int v22; // eax@43 | |
252 //BLVFace f; // [sp+Ch] [bp-7Ch]@1 | |
253 int v24; // [sp+6Ch] [bp-1Ch]@9 | |
254 int a11; // [sp+70h] [bp-18h]@1 | |
255 unsigned int v26; // [sp+74h] [bp-14h]@2 | |
256 unsigned int v27; // [sp+78h] [bp-10h]@10 | |
257 BSPModel *v28; // [sp+7Ch] [bp-Ch]@3 | |
258 int a10; // [sp+80h] [bp-8h]@1 | |
259 int a2; // [sp+84h] [bp-4h]@23 | |
260 | |
261 a11 = ecx0; | |
262 | |
263 BLVFace f; // [sp+Ch] [bp-7Ch]@1 | |
264 //BLVFace::BLVFace(&f); | |
265 | |
266 result = 0; | |
267 a10 = 0; | |
268 if ( (signed int)pOutdoor->uNumBModels > 0 ) | |
269 { | |
270 v26 = 0; | |
271 while ( 1 ) | |
272 { | |
273 v2 = &pOutdoor->pBModels[v26 / 0xBC]; | |
274 v28 = &pOutdoor->pBModels[v26 / 0xBC]; | |
275 if ( stru_721530.sMaxX <= pOutdoor->pBModels[v26 / 0xBC].sMaxX ) | |
276 { | |
277 if ( stru_721530.sMinX >= v2->sMinX ) | |
278 { | |
279 if ( stru_721530.sMaxY <= v2->sMaxY ) | |
280 { | |
281 if ( stru_721530.sMinY >= v2->sMinY ) | |
282 { | |
283 if ( stru_721530.sMaxZ <= v2->sMaxZ ) | |
284 { | |
285 if ( stru_721530.sMinZ >= v2->sMinZ ) | |
286 { | |
287 v3 = 0; | |
288 v24 = v2->uNumFaces; | |
289 if ( v24 > 0 ) | |
290 break; | |
291 } | |
292 } | |
293 } | |
294 } | |
295 } | |
296 } | |
297 LABEL_39: | |
298 ++a10; | |
299 v26 += 188; | |
300 result = a10; | |
301 if ( a10 >= (signed int)pOutdoor->uNumBModels ) | |
302 return result; | |
303 } | |
304 v27 = 0; | |
305 while ( 1 ) | |
306 { | |
307 v4 = &v2->pFaces[v27 / 0x134]; | |
308 if ( stru_721530.sMaxX > v4->pBoundingBox.x2 | |
309 || stru_721530.sMinX < v4->pBoundingBox.x1 | |
310 || stru_721530.sMaxY > v4->pBoundingBox.y2 | |
311 || stru_721530.sMinY < v4->pBoundingBox.y1 | |
312 || stru_721530.sMaxZ > v4->pBoundingBox.z2 | |
313 || stru_721530.sMinZ < v4->pBoundingBox.z1 ) | |
314 goto LABEL_38; | |
315 f.pFacePlane_old.vNormal.x = v4->pFacePlane.vNormal.x; | |
316 f.pFacePlane_old.vNormal.y = v4->pFacePlane.vNormal.y; | |
317 v5 = v4->pFacePlane.vNormal.z; | |
318 f.pFacePlane_old.vNormal.z = v4->pFacePlane.vNormal.z; | |
319 v6 = v4->pFacePlane.dist; | |
320 f.pFacePlane_old.dist = v4->pFacePlane.dist; | |
321 v7 = v4->uAttributes; | |
322 f.uAttributes = v7; | |
323 f.pBounding.x1 = v4->pBoundingBox.x1; | |
324 f.pBounding.y1 = v4->pBoundingBox.y1; | |
325 f.pBounding.z1 = v4->pBoundingBox.z1; | |
326 f.pBounding.x2 = v4->pBoundingBox.x2; | |
327 f.pBounding.y2 = v4->pBoundingBox.y2; | |
328 f.pBounding.z2 = v4->pBoundingBox.z2; | |
329 f.zCalc1 = v4->zCalc1; | |
330 f.zCalc2 = v4->zCalc2; | |
331 f.zCalc3 = v4->zCalc3; | |
332 f.pXInterceptDisplacements = v4->pXInterceptDisplacements; | |
333 f.pYInterceptDisplacements = v4->pYInterceptDisplacements; | |
334 f.pZInterceptDisplacements = v4->pZInterceptDisplacements; | |
335 f.uPolygonType = (PolygonType)v4->uPolygonType; | |
336 f.uNumVertices = v4->uNumVertices; | |
337 f.uBitmapID = v4->uTextureID; | |
338 f.pVertexIDs = v4->pVertexIDs; | |
339 if ( !(v7 & 0x20000000) ) | |
340 { | |
341 if ( !(v7 & 1) ) | |
342 break; | |
343 } | |
344 LABEL_37: | |
345 v2 = v28; | |
346 LABEL_38: | |
347 v27 += 308; | |
348 ++v3; | |
349 if ( v3 >= v24 ) | |
350 goto LABEL_39; | |
351 } | |
352 v8 = (v5 * stru_721530.normal.z | |
353 + v6 | |
354 + f.pFacePlane_old.vNormal.y * stru_721530.normal.y | |
355 + f.pFacePlane_old.vNormal.x * stru_721530.normal.x) >> 16; | |
356 if ( v8 > 0 ) | |
357 { | |
358 v9 = (v5 * stru_721530.normal2.z | |
359 + v6 | |
360 + f.pFacePlane_old.vNormal.y * stru_721530.normal2.y | |
361 + f.pFacePlane_old.vNormal.x * stru_721530.normal2.x) >> 16; | |
362 if ( v8 <= stru_721530.prolly_normal_d || v9 <= stru_721530.prolly_normal_d ) | |
363 { | |
364 if ( v9 <= v8 ) | |
365 { | |
366 a2 = stru_721530.field_6C; | |
367 if ( sub_4754BF( | |
368 stru_721530.prolly_normal_d, | |
369 &a2, | |
370 stru_721530.normal.x, | |
371 stru_721530.normal.y, | |
372 stru_721530.normal.z, | |
1546 | 373 stru_721530.direction.x, |
374 stru_721530.direction.y, | |
375 stru_721530.direction.z, | |
0 | 376 &f, |
377 a10, | |
378 a11) ) | |
379 { | |
380 v10 = a2; | |
381 } | |
382 else | |
383 { | |
1546 | 384 v11 = stru_721530.direction.y; |
385 v12 = stru_721530.direction.z; | |
0 | 386 v13 = stru_721530.normal.y; |
387 a2 = stru_721530.prolly_normal_d + stru_721530.field_6C; | |
388 if ( !sub_475F30( | |
389 &a2, | |
390 &f, | |
391 stru_721530.normal.x, | |
392 v13, | |
393 stru_721530.normal.z, | |
1546 | 394 stru_721530.direction.x, |
0 | 395 v11, |
396 v12, | |
397 a10) ) | |
398 goto LABEL_29; | |
399 v10 = a2 - stru_721530.prolly_normal_d; | |
400 a2 -= stru_721530.prolly_normal_d; | |
401 } | |
402 if ( v10 < stru_721530.field_7C ) | |
403 { | |
404 stru_721530.field_7C = v10; | |
405 v14 = 8 * (v3 | (a10 << 6)); | |
406 LOBYTE(v14) = v14 | 6; | |
407 stru_721530.uFaceID = v14; | |
408 } | |
409 } | |
410 } | |
411 } | |
412 LABEL_29: | |
413 if ( stru_721530.field_0 & 1 ) | |
414 { | |
1546 | 415 v15 = (f.pFacePlane_old.vNormal.z * stru_721530.position.z |
0 | 416 + f.pFacePlane_old.dist |
1546 | 417 + f.pFacePlane_old.vNormal.y * stru_721530.position.y |
418 + f.pFacePlane_old.vNormal.x * stru_721530.position.x) >> 16; | |
0 | 419 if ( v15 > 0 ) |
420 { | |
421 v16 = (f.pFacePlane_old.vNormal.z * stru_721530.field_54 | |
422 + f.pFacePlane_old.dist | |
423 + f.pFacePlane_old.vNormal.y * stru_721530.field_50 | |
424 + f.pFacePlane_old.vNormal.x * stru_721530.field_4C) >> 16; | |
425 if ( v15 <= stru_721530.prolly_normal_d || v16 <= stru_721530.prolly_normal_d ) | |
426 { | |
427 if ( v16 <= v15 ) | |
428 { | |
429 a2 = stru_721530.field_6C; | |
1546 | 430 if ( sub_4754BF(stru_721530.field_8_radius, |
0 | 431 &a2, |
1546 | 432 stru_721530.position.x, |
433 stru_721530.position.y, | |
434 stru_721530.position.z, | |
435 stru_721530.direction.x, | |
436 stru_721530.direction.y, | |
437 stru_721530.direction.z, | |
0 | 438 &f, |
439 a10, | |
440 a11) ) | |
441 { | |
442 if ( a2 < stru_721530.field_7C ) | |
443 { | |
444 stru_721530.field_7C = a2; | |
445 v17 = 8 * (v3 | (a10 << 6)); | |
446 LOBYTE(v17) = v17 | 6; | |
447 stru_721530.uFaceID = v17; | |
448 } | |
449 } | |
450 else | |
451 { | |
1546 | 452 v18 = stru_721530.direction.y; |
453 v19 = stru_721530.direction.z; | |
454 v20 = stru_721530.position.y; | |
455 a2 = stru_721530.field_6C + stru_721530.field_8_radius; | |
456 if ( sub_475F30(&a2, | |
0 | 457 &f, |
1546 | 458 stru_721530.position.x, |
0 | 459 v20, |
1546 | 460 stru_721530.position.z, |
461 stru_721530.direction.x, | |
0 | 462 v18, |
463 v19, | |
464 a10) ) | |
465 { | |
466 v2 = v28; | |
467 v21 = a2 - stru_721530.prolly_normal_d; | |
468 a2 -= stru_721530.prolly_normal_d; | |
469 if ( a2 < stru_721530.field_7C ) | |
470 { | |
471 stru_721530.field_7C = v21; | |
472 v22 = 8 * (v3 | (a10 << 6)); | |
473 LOBYTE(v22) = v22 | 6; | |
474 stru_721530.uFaceID = v22; | |
475 } | |
476 goto LABEL_38; | |
477 } | |
478 } | |
479 } | |
480 } | |
481 } | |
482 } | |
483 goto LABEL_37; | |
484 } | |
485 return result; | |
486 } | |
487 | |
488 //----- (0046ED1B) -------------------------------------------------------- | |
783 | 489 int collide_against_floor(int x, int y, int z, unsigned int *pSectorID, unsigned int *pFaceID) |
0 | 490 { |
491 uint uFaceID = -1; | |
723 | 492 int floor_level = BLV_GetFloorLevel(x, y, z, *pSectorID, &uFaceID); |
0 | 493 |
494 if (floor_level != -30000 && floor_level <= z + 50) | |
495 { | |
496 *pFaceID = uFaceID; | |
497 return floor_level; | |
498 } | |
499 | |
500 uint uSectorID = pIndoor->GetSector(x, y, z); | |
501 *pSectorID = uSectorID; | |
502 | |
723 | 503 floor_level = BLV_GetFloorLevel(x, y, z, uSectorID, &uFaceID); |
0 | 504 if (uSectorID && floor_level != -30000) |
505 *pFaceID = uFaceID; | |
506 else return -30000; | |
507 return floor_level; | |
508 } | |
509 | |
510 //----- (0046ED8A) -------------------------------------------------------- | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
511 void __fastcall _46ED8A_collide_against_sprite_objects(unsigned int _this) |
0 | 512 { |
513 int v1; // ebx@2 | |
514 ObjectDesc *v2; // edx@4 | |
515 int v3; // esi@5 | |
516 int v4; // ecx@5 | |
517 int v5; // eax@7 | |
518 int v6; // edi@9 | |
519 int v7; // edx@9 | |
520 int v8; // edi@11 | |
521 int v9; // ebx@11 | |
522 int v10; // ecx@12 | |
523 int v11; // esi@13 | |
524 signed int v12; // [sp+0h] [bp-14h]@1 | |
525 int v13; // [sp+4h] [bp-10h]@9 | |
526 char *v14; // [sp+8h] [bp-Ch]@2 | |
527 unsigned int v15; // [sp+10h] [bp-4h]@1 | |
528 | |
529 v15 = 0; | |
530 v12 = _this; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
531 if ( (signed int)uNumSpriteObjects > 0 ) |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
532 { |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
533 v1 = (int)&pSpriteObjects[0].uObjectDescID; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
534 v14 = (char *)&pSpriteObjects[0].uObjectDescID; |
0 | 535 do |
536 { | |
537 if ( *(short *)v1 ) | |
538 { | |
539 v2 = &pObjectList->pObjects[*(short *)v1]; | |
540 if ( !(v2->uFlags & 2) ) | |
541 { | |
542 v3 = v2->uRadius; | |
543 v4 = *(int *)(v1 + 2); | |
544 if ( stru_721530.sMaxX <= v4 + v3 ) | |
545 { | |
546 if ( stru_721530.sMinX >= v4 - v3 ) | |
547 { | |
548 v5 = *(int *)(v1 + 6); | |
549 if ( stru_721530.sMaxY <= v5 + v3 ) | |
550 { | |
551 if ( stru_721530.sMinY >= v5 - v3 ) | |
552 { | |
553 v6 = v2->uHeight; | |
554 v7 = *(int *)(v1 + 10); | |
555 v13 = v6; | |
556 if ( stru_721530.sMaxZ <= v7 + v6 ) | |
557 { | |
558 if ( stru_721530.sMinZ >= v7 ) | |
559 { | |
560 v8 = v4 - stru_721530.normal.x; | |
561 v9 = v5 - stru_721530.normal.y; | |
1546 | 562 if ( abs(((v4 - stru_721530.normal.x) * stru_721530.direction.y |
563 - (v5 - stru_721530.normal.y) * stru_721530.direction.x) >> 16) <= v3 | |
0 | 564 + stru_721530.prolly_normal_d ) |
565 { | |
1546 | 566 v10 = (v8 * stru_721530.direction.x + v9 * stru_721530.direction.y) >> 16; |
0 | 567 if ( v10 > 0 ) |
568 { | |
569 v11 = stru_721530.normal.z | |
1546 | 570 + ((unsigned __int64)(stru_721530.direction.z * (signed __int64)v10) >> 16); |
0 | 571 if ( v11 >= *(int *)(v14 + 10) - stru_721530.prolly_normal_d ) |
572 { | |
573 if ( v11 <= v13 + stru_721530.prolly_normal_d + *(int *)(v14 + 10) ) | |
574 { | |
575 if ( v10 < stru_721530.field_7C ) | |
576 sub_46DEF2(v12, v15); | |
577 } | |
578 } | |
579 } | |
580 } | |
581 } | |
582 } | |
583 } | |
584 } | |
585 } | |
586 } | |
587 } | |
588 } | |
589 ++v15; | |
590 v1 = (int)(v14 + 112); | |
591 v14 += 112; | |
592 } | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
593 while ( (signed int)v15 < (signed int)uNumSpriteObjects ); |
0 | 594 } |
595 } | |
596 | |
597 //----- (0046EF01) -------------------------------------------------------- | |
1546 | 598 int _46EF01_collision_chech_player(int a1) |
0 | 599 { |
600 int v1; // edx@1 | |
601 int result; // eax@1 | |
602 int v3; // ebx@7 | |
603 int v4; // esi@7 | |
604 int v5; // edi@8 | |
605 int v6; // ecx@9 | |
606 int v7; // edi@12 | |
607 int v8; // [sp+Ch] [bp-10h]@1 | |
608 unsigned int v9; // [sp+10h] [bp-Ch]@1 | |
609 int v10; // [sp+14h] [bp-8h]@7 | |
610 int v11; // [sp+18h] [bp-4h]@7 | |
611 | |
612 v8 = a1; | |
1546 | 613 v1 = 2 * pParty->field_14_radius; |
0 | 614 result = pParty->vPosition.x; |
615 v9 = pParty->uPartyHeight; | |
1546 | 616 if ( stru_721530.sMaxX <= pParty->vPosition.x + 2 * pParty->field_14_radius ) |
0 | 617 { |
618 if ( stru_721530.sMinX >= pParty->vPosition.x - v1 ) | |
619 { | |
620 if ( stru_721530.sMaxY <= pParty->vPosition.y + v1 ) | |
621 { | |
622 if ( stru_721530.sMinY >= pParty->vPosition.y - v1 ) | |
623 { | |
624 if ( stru_721530.sMaxZ <= (signed int)(pParty->vPosition.z + pParty->uPartyHeight) ) | |
625 { | |
626 if ( stru_721530.sMinZ >= pParty->vPosition.z ) | |
627 { | |
628 v3 = stru_721530.prolly_normal_d + v1; | |
629 v11 = pParty->vPosition.x - stru_721530.normal.x; | |
1546 | 630 v4 = ((pParty->vPosition.x - stru_721530.normal.x) * stru_721530.direction.y |
631 - (pParty->vPosition.y - stru_721530.normal.y) * stru_721530.direction.x) >> 16; | |
0 | 632 v10 = pParty->vPosition.y - stru_721530.normal.y; |
1546 | 633 result = abs(((pParty->vPosition.x - stru_721530.normal.x) * stru_721530.direction.y |
634 - (pParty->vPosition.y - stru_721530.normal.y) * stru_721530.direction.x) >> 16); | |
0 | 635 if ( result <= v3 ) |
636 { | |
1546 | 637 result = v10 * stru_721530.direction.y; |
638 v5 = (v10 * stru_721530.direction.y + v11 * stru_721530.direction.x) >> 16; | |
0 | 639 if ( v5 > 0 ) |
640 { | |
1546 | 641 v6 = ((unsigned __int64)(stru_721530.direction.z * (signed __int64)v5) >> 16) + stru_721530.normal.z; |
0 | 642 result = pParty->vPosition.z; |
643 if ( v6 >= pParty->vPosition.z ) | |
644 { | |
645 result = v9 + pParty->vPosition.z; | |
646 if ( v6 <= (signed int)(v9 + pParty->vPosition.z) || v8 ) | |
647 { | |
295 | 648 result = integer_sqrt(v3 * v3 - v4 * v4); |
0 | 649 v7 = v5 - result; |
650 if ( v7 < 0 ) | |
651 v7 = 0; | |
652 if ( v7 < stru_721530.field_7C ) | |
653 { | |
654 stru_721530.field_7C = v7; | |
655 stru_721530.uFaceID = 4; | |
656 } | |
657 } | |
658 } | |
659 } | |
660 } | |
661 } | |
662 } | |
663 } | |
664 } | |
665 } | |
666 } | |
667 return result; | |
668 } | |
669 | |
670 //----- (0046F04E) -------------------------------------------------------- | |
1459 | 671 int _46F04E_collide_against_portals() |
0 | 672 { |
673 BLVSector *v0; // ecx@1 | |
674 unsigned int v1; // eax@1 | |
675 int v2; // eax@2 | |
676 BLVFace *v3; // eax@3 | |
677 int v4; // ecx@9 | |
678 int v5; // edx@9 | |
679 signed int result; // eax@21 | |
680 BLVFace *v7; // eax@22 | |
681 signed int v8; // [sp+0h] [bp-14h]@1 | |
682 BLVSector *v9; // [sp+4h] [bp-10h]@1 | |
683 unsigned int v10; // [sp+8h] [bp-Ch]@1 | |
684 int a3; // [sp+Ch] [bp-8h]@13 | |
685 int v12; // [sp+10h] [bp-4h]@15 | |
686 | |
687 v8 = 0; | |
688 v0 = &pIndoor->pSectors[stru_721530.uSectorID]; | |
689 v1 = 0xFFFFFFu; | |
690 v10 = 0xFFFFFFu; | |
691 v9 = v0; | |
692 if ( v0->uNumPortals > 0 ) | |
693 { | |
694 do | |
695 { | |
696 v2 = v0->pPortals[v8]; | |
697 if ( v2 != stru_721530.field_80 ) | |
698 { | |
699 v3 = &pIndoor->pFaces[v2]; | |
700 if ( stru_721530.sMaxX <= v3->pBounding.x2 ) | |
701 { | |
702 if ( stru_721530.sMinX >= v3->pBounding.x1 | |
703 && stru_721530.sMaxY <= v3->pBounding.y2 | |
704 && stru_721530.sMinY >= v3->pBounding.y1 | |
705 && stru_721530.sMaxZ <= v3->pBounding.z2 | |
706 && stru_721530.sMinZ >= v3->pBounding.z1 ) | |
707 { | |
1546 | 708 v4 = (stru_721530.normal.x * v3->pFacePlane_old.vNormal.x + v3->pFacePlane_old.dist |
0 | 709 + stru_721530.normal.y * v3->pFacePlane_old.vNormal.y |
710 + stru_721530.normal.z * v3->pFacePlane_old.vNormal.z) >> 16; | |
1546 | 711 v5 = (stru_721530.normal2.z * v3->pFacePlane_old.vNormal.z + v3->pFacePlane_old.dist |
0 | 712 + stru_721530.normal2.x * v3->pFacePlane_old.vNormal.x |
713 + stru_721530.normal2.y * v3->pFacePlane_old.vNormal.y) >> 16; | |
714 if ( (v4 < stru_721530.prolly_normal_d || v5 < stru_721530.prolly_normal_d) | |
715 && (v4 > -stru_721530.prolly_normal_d || v5 > -stru_721530.prolly_normal_d) | |
1546 | 716 && (a3 = stru_721530.field_6C, sub_475D85(&stru_721530.normal, &stru_721530.direction, &a3, v3)) |
0 | 717 && a3 < (signed int)v10 ) |
718 { | |
719 v0 = v9; | |
720 v10 = a3; | |
721 v12 = v9->pPortals[v8]; | |
722 } | |
723 else | |
724 { | |
725 v0 = v9; | |
726 } | |
727 } | |
728 } | |
729 } | |
730 ++v8; | |
731 } | |
732 while ( v8 < v0->uNumPortals ); | |
733 v1 = v10; | |
734 } | |
735 if ( stru_721530.field_7C >= (signed int)v1 && (signed int)v1 <= stru_721530.field_6C ) | |
736 { | |
737 stru_721530.field_80 = v12; | |
738 v7 = &pIndoor->pFaces[v12]; | |
739 if ( v7->uSectorID == stru_721530.uSectorID ) | |
740 stru_721530.uSectorID = v7->uBackSectorID; | |
741 else | |
742 stru_721530.uSectorID = v7->uSectorID; | |
743 stru_721530.field_7C = 268435455; | |
744 result = 0; | |
745 } | |
746 else | |
747 { | |
748 result = 1; | |
749 } | |
750 return result; | |
751 } | |
752 | |
753 //----- (0047050A) -------------------------------------------------------- | |
1546 | 754 int stru141_actor_collision_object::_47050A(int dt) |
0 | 755 { |
1546 | 756 stru141_actor_collision_object *v2; // esi@1 |
757 //signed int v3; // eax@1 | |
758 //int v4; // ecx@1 | |
759 //int v5; // edx@1 | |
760 //int v6; // edx@1 | |
0 | 761 int v7; // eax@1 |
762 int v8; // eax@3 | |
763 signed int result; // eax@4 | |
764 int v10; // eax@5 | |
765 int v11; // eax@5 | |
766 int v12; // ebx@5 | |
767 int v13; // edx@5 | |
768 int v14; // edi@5 | |
769 int v15; // ecx@5 | |
770 int v16; // eax@5 | |
771 int v17; // eax@5 | |
772 int v18; // eax@7 | |
773 int v19; // edx@9 | |
774 int v20; // edi@9 | |
775 int v21; // eax@9 | |
776 int v22; // eax@11 | |
777 int v23; // edx@13 | |
778 int v24; // eax@13 | |
779 int v25; // eax@14 | |
780 int v26; // eax@16 | |
781 int v27; // eax@17 | |
782 int v28; // [sp+14h] [bp+8h]@5 | |
783 | |
784 v2 = this; | |
1546 | 785 int speed = 1 | integer_sqrt(this->velocity.z * this->velocity.z + this->velocity.y * this->velocity.y + this->velocity.x * this->velocity.x); |
786 | |
787 v2->direction.x = 65536 / speed * v2->velocity.x; | |
788 v2->direction.y = 65536 / speed * v2->velocity.y; | |
789 v2->direction.z = 65536 / speed * v2->velocity.z; | |
790 | |
791 v2->speed = speed; | |
792 v2->inv_speed = 65536 / speed; | |
793 | |
794 if (dt) | |
795 v7 = dt; | |
796 else | |
0 | 797 v7 = pEventTimer->dt_in_some_format; |
1546 | 798 |
799 v8 = fixpoint_sub0(v7, speed) - v2->field_70; // speed * dt - something | |
0 | 800 v2->field_6C = v8; |
801 if ( v8 > 0 ) | |
802 { | |
1546 | 803 v10 = fixpoint_sub0(v8, v2->direction.x) + v2->normal.x; |
0 | 804 v2->field_4C = v10; |
805 v2->normal2.x = v10; | |
1546 | 806 v11 = fixpoint_sub0(v2->field_6C, v2->direction.y) + v2->normal.y; |
0 | 807 v2->field_50 = v11; |
808 v2->normal2.y = v11; | |
1546 | 809 v2->normal2.z = fixpoint_sub0(v2->field_6C, v2->direction.z) + v2->normal.z; |
810 v12 = v2->position.z; | |
0 | 811 v13 = v2->normal.x; |
812 v14 = v2->normal2.x; | |
813 v15 = v2->prolly_normal_d; | |
1546 | 814 v16 = v12 + fixpoint_sub0(v2->field_6C, v2->direction.z); |
0 | 815 v28 = v16; |
816 v2->field_54 = v16; | |
817 v17 = v13; | |
818 if ( v13 >= v14 ) | |
819 v17 = v14; | |
820 v2->sMaxX = v17 - v15; | |
821 v18 = v15 + v13; | |
822 if ( v13 <= v14 ) | |
823 v18 = v15 + v14; | |
824 v19 = v2->normal.y; | |
825 v20 = v2->normal2.y; | |
826 v2->sMinX = v18; | |
827 v21 = v19; | |
828 if ( v19 >= v20 ) | |
829 v21 = v20; | |
830 v2->sMaxY = v21 - v15; | |
831 v22 = v15 + v19; | |
832 if ( v19 <= v20 ) | |
833 v22 = v20 + v15; | |
834 v23 = v2->normal2.z; | |
835 v2->sMinY = v22; | |
836 v24 = v2->normal.z; | |
837 if ( v24 >= v23 ) | |
838 v25 = v23 - v15; | |
839 else | |
840 v25 = v24 - v15; | |
841 v2->sMaxZ = v25; | |
1546 | 842 v26 = v2->field_8_radius; |
0 | 843 if ( v12 <= v28 ) |
844 v27 = v28 + v26; | |
845 else | |
846 v27 = v12 + v26; | |
847 v2->uFaceID = 0; | |
848 v2->field_80 = -1; | |
849 v2->field_88 = -1; | |
850 v2->sMinZ = v27; | |
851 v2->field_7C = 0xFFFFFFu; | |
852 result = 0; | |
853 } | |
854 else | |
855 { | |
856 result = 1; | |
857 } | |
858 return result; | |
859 } | |
860 | |
861 //----- (004706C6) -------------------------------------------------------- | |
1545 | 862 void UpdateActors_ODM() |
0 | 863 { |
864 Actor *v0; // esi@2 | |
845 | 865 AIState uAIState; // ax@2 |
846 | 866 //unsigned int v2; // ecx@6 |
0 | 867 int v3; // ebx@6 |
845 | 868 //int v4; // eax@8 |
0 | 869 int v5; // eax@10 |
870 int v6; // ecx@10 | |
846 | 871 //signed int v7; // ebx@10 |
0 | 872 signed int v8; // ebx@17 |
845 | 873 //unsigned __int8 v9; // zf@17 |
0 | 874 unsigned __int8 v10; // sf@17 |
875 unsigned __int16 v11; // ax@21 | |
1545 | 876 //int v12; // eax@29 |
877 //unsigned __int64 v13; // qax@29 | |
878 //int v14; // eax@30 | |
879 //unsigned __int64 v15; // qax@30 | |
0 | 880 int v16; // eax@33 |
846 | 881 //int v17; // edi@34 |
1545 | 882 //int v18; // edx@42 |
883 //int v19; // ecx@42 | |
0 | 884 __int16 v20; // ax@42 |
1545 | 885 //int v21; // ebx@42 |
886 //int v22; // edi@42 | |
887 //int v23; // ecx@42 | |
888 //__int16 v24; // ax@42 | |
0 | 889 int v25; // eax@45 |
890 signed int v26; // ecx@50 | |
1546 | 891 //int v27; // eax@52 |
0 | 892 int v28; // eax@54 |
893 signed int v29; // ebx@57 | |
894 signed int v30; // eax@57 | |
895 int v31; // edi@57 | |
896 signed int i; // ebx@57 | |
897 unsigned int v33; // ecx@58 | |
845 | 898 //int v34; // ebx@64 |
0 | 899 int v35; // edi@64 |
900 int v36; // eax@64 | |
848 | 901 //unsigned __int16 v37; // cx@66 |
0 | 902 signed int v38; // edx@71 |
848 | 903 unsigned int v39; // edi@71 |
0 | 904 BSPModel *v40; // eax@75 |
905 ODMFace *v41; // edi@75 | |
906 int v42; // ebx@76 | |
907 int v43; // ecx@77 | |
908 int v44; // edx@77 | |
909 __int16 v45; // dx@82 | |
910 int v46; // ecx@82 | |
911 signed int v47; // ebx@85 | |
912 int v48; // edi@85 | |
913 int v49; // edi@85 | |
1545 | 914 //int v50; // eax@85 |
915 //unsigned __int64 v51; // qax@85 | |
848 | 916 //unsigned __int8 v52; // zf@87 |
917 //unsigned __int8 v53; // sf@87 | |
845 | 918 // unsigned __int8 v54; // of@104 |
0 | 919 int v55; // eax@107 |
920 unsigned int v56; // edi@107 | |
921 int v57; // ST10_4@107 | |
922 unsigned int v58; // edi@107 | |
923 unsigned int v59; // ebx@107 | |
924 signed int v60; // eax@107 | |
925 int v61; // eax@124 | |
926 Vec3_int_ v62; // [sp+Ch] [bp-44h]@42 | |
153 | 927 int v63; // [sp+18h] [bp-38h]@64 |
0 | 928 int v64; // [sp+1Ch] [bp-34h]@64 |
929 int v65; // [sp+20h] [bp-30h]@2 | |
930 int v66; // [sp+24h] [bp-2Ch]@2 | |
931 bool v67; // [sp+28h] [bp-28h]@10 | |
846 | 932 //unsigned int v68; // [sp+2Ch] [bp-24h]@10 |
0 | 933 unsigned int v69; // [sp+30h] [bp-20h]@6 |
934 unsigned int v70; // [sp+34h] [bp-1Ch]@10 | |
935 int v71; // [sp+38h] [bp-18h]@62 | |
845 | 936 int uIsAboveFloor; // [sp+3Ch] [bp-14h]@10 |
937 int v72b; | |
1545 | 938 //int v73; // [sp+40h] [bp-10h]@17 |
845 | 939 int uIsFlying; // [sp+44h] [bp-Ch]@8 |
0 | 940 unsigned int v75; // [sp+48h] [bp-8h]@1 |
845 | 941 int uIsOnWater; // [sp+4Ch] [bp-4h]@10 |
942 | |
1545 | 943 for (v75 = 0; v75 < uNumActors; ++v75) |
0 | 944 { |
945 v0 = &pActors[v75]; | |
946 v66 = v0->vPosition.x; | |
947 v65 = v0->vPosition.y; | |
845 | 948 uAIState = v0->uAIState; |
949 if ( uAIState == Removed || uAIState == Disabled || uAIState == Summoned || !v0->uMovementSpeed ) | |
950 { | |
951 continue; | |
952 } | |
0 | 953 v3 = 0; |
954 v69 = 0; | |
846 | 955 if ( MonsterStats::BelongsToSupertype(v0->pMonsterInfo.uID, MONSTER_SUPERTYPE_WATER_ELEMENTAL) ) |
0 | 956 v3 = 1; |
957 v0->uSectorID = 0; | |
845 | 958 uIsFlying = v0->pMonsterInfo.uFlying; |
0 | 959 if ( !v0->CanAct() ) |
845 | 960 uIsFlying = 0; |
138 | 961 v70 = IsTerrainSlopeTooHigh(v0->vPosition.x, v0->vPosition.y); |
723 | 962 v5 = ODM_GetFloorLevel( |
0 | 963 v0->vPosition.x, |
964 v0->vPosition.y, | |
965 v0->vPosition.z, | |
966 v0->uActorHeight, | |
845 | 967 &uIsOnWater, |
0 | 968 (int *)&v69, |
969 v3); | |
970 v6 = v0->vPosition.z; | |
845 | 971 uIsAboveFloor = 0; |
0 | 972 v67 = v69 == 0; |
973 if ( v6 > v5 + 1 ) | |
845 | 974 uIsAboveFloor = 1; |
975 if ( uAIState == Dead && uIsOnWater && !uIsAboveFloor ) | |
0 | 976 { |
977 v0->uAIState = Removed; | |
845 | 978 continue; |
0 | 979 } |
305 | 980 if ( v0->uCurrentActionAnimation == ANIM_Walking ) |
0 | 981 { |
982 v8 = v0->uMovementSpeed; | |
845 | 983 if ( (signed __int64)v0->pActorBuffs[7].uExpireTime > 0 ) |
0 | 984 { |
1545 | 985 v8 = (signed __int64)((double)v8 * 0.5); |
0 | 986 } |
845 | 987 if ( uAIState == Fleeing || uAIState == Pursuing ) |
0 | 988 { |
989 v8 *= 2; | |
990 } | |
1340 | 991 if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->turn_stage == 1 ) |
1545 | 992 v8 *= flt_6BE3AC_debug_recmod1_x_1_6; |
0 | 993 if ( v8 > 1000 ) |
994 v8 = 1000; | |
1545 | 995 |
996 v0->vVelocity.x = fixpoint_sub0(stru_5C6E00->Cos(v0->uYawAngle), v8); | |
997 v0->vVelocity.y = fixpoint_sub0(stru_5C6E00->Sin(v0->uYawAngle), v8); | |
845 | 998 if ( uIsFlying ) |
0 | 999 { |
1545 | 1000 v0->vVelocity.z = fixpoint_sub0(stru_5C6E00->Sin(v0->uPitchAngle), v8); |
0 | 1001 } |
846 | 1002 //v7 = v68; |
0 | 1003 } |
1004 else | |
1005 { | |
1545 | 1006 v0->vVelocity.x = fixpoint_sub0(55000, v0->vVelocity.x); |
1007 v0->vVelocity.y = fixpoint_sub0(55000, v0->vVelocity.y); | |
845 | 1008 if ( uIsFlying ) |
0 | 1009 { |
1545 | 1010 v0->vVelocity.z = fixpoint_sub0(55000, v0->vVelocity.z); |
0 | 1011 } |
1012 } | |
846 | 1013 if ( v0->vPosition.z < v5 ) |
0 | 1014 { |
845 | 1015 v16 = uIsFlying; |
846 | 1016 v0->vPosition.z = v5; |
0 | 1017 v0->vVelocity.z = v16 != 0 ? 0x14 : 0; |
1018 } | |
846 | 1019 //v17 = 0; |
845 | 1020 if ( !uIsAboveFloor || uIsFlying ) |
1021 { | |
1022 if ( v70 && !uIsAboveFloor && v67 ) | |
0 | 1023 { |
846 | 1024 v0->vPosition.z = v5; |
1545 | 1025 ODM_GetTerrainNormalAt(v0->vPosition.x, v0->vPosition.y, &v62); |
0 | 1026 v20 = GetGravityStrength(); |
1545 | 1027 //v21 = v62.y; |
1028 //v22 = v62.z; | |
1029 //v23 = v62.y * v0->vVelocity.y; | |
0 | 1030 v0->vVelocity.z += -8 * LOWORD(pEventTimer->uTimeElapsed) * v20; |
1545 | 1031 int v73 = abs(v62.x * v0->vVelocity.x + v62.z * v0->vVelocity.z + v62.y * v0->vVelocity.y) >> 16; |
1032 //v72b = v21; | |
1033 v0->vVelocity.x += fixpoint_sub0(v73, v62.x); | |
1034 v0->vVelocity.y += fixpoint_sub0(v73, v62.y); | |
1035 v0->vVelocity.z += fixpoint_sub0(v73, v62.z); | |
846 | 1036 //v17 = 0; |
0 | 1037 } |
1038 } | |
1039 else | |
1040 { | |
1041 v0->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength(); | |
1042 } | |
846 | 1043 if ( pParty->armageddon_timer != 0 && v0->CanAct() ) |
0 | 1044 { |
1045 v0->vVelocity.x += rand() % 100 - 50; | |
1046 v0->vVelocity.y += rand() % 100 - 50; | |
1047 v0->vVelocity.z += rand() % 100 - 20; | |
1048 v25 = rand(); | |
1049 v0->uAIState = Stunned; | |
1050 v0->uYawAngle += v25 % 32 - 16; | |
1051 v0->UpdateAnimation(); | |
1052 } | |
846 | 1053 if ( v0->vVelocity.x * v0->vVelocity.x + v0->vVelocity.y * v0->vVelocity.y < 400 && v70 == 0 ) |
1054 { | |
1055 v0->vVelocity.y = 0; | |
1056 v0->vVelocity.x = 0; | |
0 | 1057 } |
1058 stru_721530.field_0 = 1; | |
845 | 1059 if ( !uIsFlying ) |
0 | 1060 v26 = 40; |
1061 else | |
1062 v26 = v0->uActorRadius; | |
1546 | 1063 |
0 | 1064 stru_721530.field_84 = -1; |
1546 | 1065 stru_721530.field_8_radius = v26; |
0 | 1066 stru_721530.prolly_normal_d = v26; |
1546 | 1067 stru_721530.height = v0->uActorHeight; |
846 | 1068 stru_721530.field_70 = 0; |
1069 v69 = 0; | |
0 | 1070 while ( 1 ) |
1071 { | |
1546 | 1072 stru_721530.position.x = v0->vPosition.x; |
1073 stru_721530.normal.x = stru_721530.position.x; | |
1074 stru_721530.position.y = v0->vPosition.y; | |
1075 stru_721530.normal.y = stru_721530.position.y; | |
0 | 1076 v28 = v0->vPosition.z; |
1077 stru_721530.normal.z = v28 + v26 + 1; | |
1546 | 1078 stru_721530.position.z = v28 - v26 + stru_721530.height - 1; |
1079 if ( stru_721530.position.z < stru_721530.normal.z ) | |
1080 stru_721530.position.z = v28 + v26 + 1; | |
1081 stru_721530.velocity.x = v0->vVelocity.x; | |
0 | 1082 stru_721530.uSectorID = 0; |
1546 | 1083 stru_721530.velocity.y = v0->vVelocity.y; |
1084 stru_721530.velocity.z = v0->vVelocity.z; | |
0 | 1085 if ( stru_721530._47050A(0) ) |
1086 break; | |
1087 _46E889_collide_against_bmodels(1u); | |
1088 v29 = WorldPosToGridCellZ(v0->vPosition.y); | |
1089 v30 = WorldPosToGridCellX(v0->vPosition.x); | |
1090 _46E26D_collide_against_sprites(v30, v29); | |
1091 _46EF01_collision_chech_player(0); | |
862 | 1092 _46ED8A_collide_against_sprite_objects(PID(OBJECT_Actor,v75)); |
0 | 1093 v31 = 0; |
1094 for ( i = 0; v31 < ai_arrays_size; ++v31 ) | |
1095 { | |
390 | 1096 v33 = ai_near_actors_ids[v31]; |
0 | 1097 if ( v33 != v75 && _46DF1A_collide_against_actor(v33, 40) ) |
1098 ++i; | |
1099 } | |
1100 v71 = i > 1; | |
1101 if ( stru_721530.field_7C < stru_721530.field_6C ) | |
1546 | 1102 v70 = fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.z); |
845 | 1103 //v34 = 0; |
0 | 1104 v35 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1; |
1545 | 1105 v36 = ODM_GetFloorLevel(stru_721530.normal2.x, |
0 | 1106 stru_721530.normal2.y, |
1107 stru_721530.normal2.z - stru_721530.prolly_normal_d - 1, | |
1108 v0->uActorHeight, | |
1109 (int *)&v63, | |
1110 &v64, | |
1111 0); | |
845 | 1112 if ( uIsOnWater ) |
0 | 1113 { |
1114 if ( v35 < v36 + 60 ) | |
1115 { | |
848 | 1116 if ( uAIState == Dead || uAIState == Dying || uAIState == Removed || uAIState == Disabled ) |
0 | 1117 { |
1118 if ( v64 ) | |
1119 v61 = v36 + 30; | |
1120 else | |
846 | 1121 v61 = v5 + 60; |
0 | 1122 sub_42F960_create_object(v0->vPosition.x, v0->vPosition.y, v61); |
1123 v0->uAIState = Removed; | |
1124 return; | |
1125 } | |
1126 } | |
1127 } | |
1128 if ( stru_721530.field_7C >= stru_721530.field_6C ) | |
1129 { | |
1130 v0->vPosition.x = LOWORD(stru_721530.normal2.x); | |
1131 v0->vPosition.y = LOWORD(stru_721530.normal2.y); | |
1132 v0->vPosition.z = LOWORD(stru_721530.normal2.z) - LOWORD(stru_721530.prolly_normal_d) - 1; | |
1133 break; | |
1134 } | |
1545 | 1135 //v72b = fixpoint_sub0(stru_721530.field_7C, stru_721530.field_58.x); |
1546 | 1136 v0->vPosition.x += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.x); |
1545 | 1137 //v72b = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16; |
1546 | 1138 v0->vPosition.y += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.y); |
1545 | 1139 //v72b = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16; |
1546 | 1140 v0->vPosition.z += fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.z); |
0 | 1141 v38 = stru_721530.uFaceID; |
1142 stru_721530.field_70 += stru_721530.field_7C; | |
848 | 1143 v39 = PID_ID(v38); |
845 | 1144 switch ( PID_TYPE(v38) ) |
1145 { | |
1146 case OBJECT_Actor: | |
1340 | 1147 if ( pTurnEngine->turn_stage != 2 && pTurnEngine->turn_stage != 3 || pParty->bTurnBasedModeOn != 1 ) |
845 | 1148 { |
1149 //if(pParty->bTurnBasedModeOn == 1) | |
1150 //v34 = 0; | |
0 | 1151 if ( v0->pMonsterInfo.uHostilityType ) |
1152 { | |
845 | 1153 if ( v71 == 0 ) |
1154 { | |
1060 | 1155 Actor::AI_Flee(v75, v38, 0, (AIDirection *)0); |
845 | 1156 } |
1157 else | |
1158 { | |
1159 Actor::AI_StandOrBored(v75, 4, 0, (AIDirection *)0); | |
1160 } | |
0 | 1161 } |
1545 | 1162 else if ( v71 ) |
845 | 1163 { |
1164 Actor::AI_StandOrBored(v75, 4, 0, (AIDirection *)0); | |
1165 } | |
1166 else if ( pActors[v39].pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly ) | |
0 | 1167 { |
1060 | 1168 Actor::AI_Flee(v75, v38, 0, (AIDirection *)0); |
0 | 1169 } |
845 | 1170 else |
1171 { | |
1060 | 1172 Actor::AI_FaceObject(v75, v38, 0, (AIDirection *)0); |
845 | 1173 } |
0 | 1174 } |
1175 break; | |
845 | 1176 case OBJECT_Player: |
0 | 1177 if ( !v0->GetActorsRelation(0) ) |
1178 { | |
1179 v38 = stru_721530.uFaceID; | |
1060 | 1180 Actor::AI_FaceObject(v75, v38, 0, (AIDirection *)0); |
845 | 1181 break; |
0 | 1182 } |
1167 | 1183 //v52 = HIDWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) == 0; |
1184 //v53 = SHIDWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) < 0; | |
0 | 1185 v0->vVelocity.y = 0; |
1186 v0->vVelocity.x = 0; | |
1167 | 1187 //if ( !v53 && (!(v53 | v52) || LODWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) > 0) ) |
1188 if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime < 0) | |
1189 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); | |
0 | 1190 viewparams->bRedrawGameUI = 1; |
1191 break; | |
845 | 1192 case OBJECT_Decoration: |
295 | 1193 v47 = integer_sqrt(v0->vVelocity.x * v0->vVelocity.x + v0->vVelocity.y * v0->vVelocity.y); |
0 | 1194 v48 = stru_5C6E00->Atan2( |
1195 v0->vPosition.x - pLevelDecorations[v39].vPosition.x, | |
1196 v0->vPosition.y - pLevelDecorations[v39].vPosition.y); | |
323 | 1197 v49 = v48; |
1545 | 1198 v0->vVelocity.x = fixpoint_sub0(stru_5C6E00->Cos(v48), v47); |
1199 v0->vVelocity.y = fixpoint_sub0(stru_5C6E00->Sin(v48), v47); | |
0 | 1200 break; |
845 | 1201 case OBJECT_BModel: |
0 | 1202 v40 = &pOutdoor->pBModels[v38 >> 9]; |
1203 v41 = &v40->pFaces[v39 & 0x3F]; | |
1545 | 1204 if ( !(v41->uAttributes & 0x20000000) ) |
0 | 1205 { |
1206 v42 = v41->uPolygonType; | |
1207 if ( v42 == 3 ) | |
1208 { | |
1209 v43 = v0->vVelocity.y; | |
1210 v44 = v0->vVelocity.x; | |
1211 v0->vVelocity.z = 0; | |
1212 v0->vPosition.z = LOWORD(v40->pVertices.pVertices[v41->pVertexIDs[0]].z) + 1; | |
1213 if ( v44 * v44 + v43 * v43 < 400 ) | |
1214 { | |
1215 v0->vVelocity.y = 0; | |
1216 v0->vVelocity.x = 0; | |
1217 } | |
1218 } | |
1219 else | |
1220 { | |
845 | 1221 v72b = abs(v41->pFacePlane.vNormal.y * v0->vVelocity.y + v41->pFacePlane.vNormal.z * v0->vVelocity.z |
0 | 1222 + v41->pFacePlane.vNormal.x * v0->vVelocity.x) >> 16; |
1546 | 1223 if ( (stru_721530.speed >> 3) > v72b ) |
1224 v72b = stru_721530.speed >> 3; | |
1545 | 1225 |
1226 v0->vVelocity.x += fixpoint_sub0(v72b, v41->pFacePlane.vNormal.x); | |
1227 v0->vVelocity.y += fixpoint_sub0(v72b, v41->pFacePlane.vNormal.y); | |
1228 v0->vVelocity.z += fixpoint_sub0(v72b, v41->pFacePlane.vNormal.z); | |
0 | 1229 if ( v42 != 4 ) |
1230 { | |
1231 v45 = v0->vPosition.z; | |
1232 v46 = stru_721530.prolly_normal_d | |
1233 - ((v41->pFacePlane.dist | |
1234 + v41->pFacePlane.vNormal.x * v0->vPosition.x | |
1235 + v41->pFacePlane.vNormal.y * v0->vPosition.y | |
1236 + v41->pFacePlane.vNormal.z * v0->vPosition.z) >> 16); | |
1237 if ( v46 > 0 ) | |
1238 { | |
1239 v0->vPosition.x += (unsigned int)(v46 * v41->pFacePlane.vNormal.x) >> 16; | |
1240 v0->vPosition.y += (unsigned int)(v46 * v41->pFacePlane.vNormal.y) >> 16; | |
1241 v0->vPosition.z = v45 + ((unsigned int)(v46 * v41->pFacePlane.vNormal.z) >> 16); | |
1242 } | |
1243 v0->uYawAngle = stru_5C6E00->Atan2(v0->vVelocity.x, v0->vVelocity.y); | |
1244 } | |
1245 } | |
1246 } | |
1247 break; | |
1248 } | |
1545 | 1249 |
1250 v0->vVelocity.x = fixpoint_sub0(58500, v0->vVelocity.x); | |
1251 v0->vVelocity.y = fixpoint_sub0(58500, v0->vVelocity.y); | |
1252 v0->vVelocity.z = fixpoint_sub0(58500, v0->vVelocity.z); | |
1253 | |
0 | 1254 ++v69; |
845 | 1255 if ( v69 >= 100 ) |
0 | 1256 break; |
1257 v26 = stru_721530.prolly_normal_d; | |
1258 } | |
846 | 1259 v58 = ((unsigned int)~pOutdoor->ActuallyGetSomeOtherTileInfo(WorldPosToGridCellX(v66), WorldPosToGridCellZ(v65) - 1) >> 1) & 1; |
1260 v59 = ((unsigned int)~pOutdoor->ActuallyGetSomeOtherTileInfo(WorldPosToGridCellX(v0->vPosition.x), WorldPosToGridCellZ(v0->vPosition.y) - 1) >> 1) & 1; | |
1261 if ( WorldPosToGridCellX(v66) == WorldPosToGridCellX(v0->vPosition.x) | |
845 | 1262 && WorldPosToGridCellZ(v65) == WorldPosToGridCellZ(v0->vPosition.y) |
1263 && v58 | |
1264 || v67 != 0 ) | |
0 | 1265 { |
1266 if ( MonsterStats::BelongsToSupertype(v0->pMonsterInfo.uID, MONSTER_SUPERTYPE_WATER_ELEMENTAL) ) | |
1267 { | |
1268 v58 = v58 == 0; | |
1269 v59 = v59 == 0; | |
1270 } | |
845 | 1271 if ( !uIsFlying && v58 && !v59 ) |
0 | 1272 { |
1273 v0->vPosition.x = v66; | |
1274 v0->vPosition.y = v65; | |
1275 if ( v0->CanAct() ) | |
1276 { | |
1277 v0->uYawAngle -= 32; | |
1278 v0->uCurrentActionTime = 0; | |
1279 v0->uCurrentActionLength = 128; | |
1280 v0->uAIState = Fleeing; | |
1281 } | |
1282 } | |
1283 } | |
845 | 1284 } |
0 | 1285 } |
1286 | |
1287 //----- (0047253E) -------------------------------------------------------- | |
1288 void UpdateObjects() | |
1289 { | |
1290 unsigned int v0; // ebx@0 | |
1291 //unsigned int v1; // edi@1 | |
1083 | 1292 //char *v2; // esi@2 |
0 | 1293 //__int16 v3; // dx@5 |
1294 ObjectDesc *v4; // eax@5 | |
1295 int v5; // ecx@6 | |
1296 __int16 v6; // cx@7 | |
1297 signed int v7; // eax@9 | |
1298 __int16 v8; // cx@14 | |
1299 __int16 v9; // dx@14 | |
1300 unsigned int v10; // ecx@16 | |
1301 signed int v11; // eax@17 | |
1302 int v12; // edi@27 | |
1303 int v13; // eax@27 | |
1304 int v14; // ebx@27 | |
1305 unsigned int v15; // ecx@27 | |
1306 unsigned int v16; // edx@30 | |
1307 unsigned int v17; // edx@32 | |
1308 int v18; // [sp+4h] [bp-10h]@27 | |
1309 int v19; // [sp+8h] [bp-Ch]@27 | |
1310 //signed int v20; // [sp+10h] [bp-4h]@1 | |
1311 | |
1312 //v1 = 0; | |
1313 //v20 = 0; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
1314 for (uint i = 0; i < uNumSpriteObjects; ++i) |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
1315 { |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
1316 auto item = &pSpriteObjects[i]; |
1083 | 1317 //v2 = (char *)&item->uSpriteFrameID; |
0 | 1318 //do |
1319 //{ | |
1320 //LOWORD(v0) = item->uAttributes; | |
1545 | 1321 if (item->uAttributes & OBJECT_40) |
1322 item->uAttributes &= ~OBJECT_40; | |
0 | 1323 else |
1324 { | |
1325 //v3 = item->uObjectDescID; | |
1326 v4 = &pObjectList->pObjects[item->uObjectDescID]; | |
430 | 1327 if (item->AttachedToActor()) |
1328 { | |
848 | 1329 v5 = PID_ID(item->spell_target_pid); |
1083 | 1330 item->vPosition.x = pActors[v5].vPosition.x; |
1331 item->vPosition.y = pActors[v5].vPosition.y; | |
1332 item->vPosition.z = pActors[v5].vPosition.z + pActors[v5].uActorHeight; | |
1333 if ( !item->uObjectDescID || (v6 = LOWORD(pEventTimer->uTimeElapsed) + item->uSpriteFrameID, item->uSpriteFrameID = v6, !(v4->uFlags & 4)) ) | |
1334 continue; | |
0 | 1335 if ( v6 >= 0 ) |
1336 { | |
1337 v7 = v4->uLifetime; | |
1338 if (item->uAttributes & 2) | |
1083 | 1339 v7 = item->field_20; |
0 | 1340 if ( v6 < v7 ) |
1083 | 1341 continue; |
1342 } | |
1343 v10 = i; | |
1344 SpriteObject::OnInteraction(v10); | |
1345 continue; | |
0 | 1346 } |
1347 | |
1348 if ( item->uObjectDescID ) | |
1349 { | |
1350 v8 = LOWORD(pEventTimer->uTimeElapsed) + item->uSpriteFrameID; | |
1351 item->uSpriteFrameID = v8; | |
1352 v9 = v4->uFlags; | |
1083 | 1353 if ( v9 & 4 ) |
1354 { | |
1355 if ( v8 < 0 ) | |
1356 { | |
1357 v10 = i; | |
1358 SpriteObject::OnInteraction(v10); | |
1359 continue; | |
1360 } | |
1361 v11 = v4->uLifetime; | |
1362 if (item->uAttributes & 2) | |
1363 v11 = item->field_20; | |
1364 } | |
1365 if ( !(v9 & 4) || v8 < v11 ) | |
1366 { | |
0 | 1367 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
1368 SpriteObject::UpdateObject_fn0_BLV(i); |
0 | 1369 else |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
1370 SpriteObject::UpdateObject_fn0_ODM(i); |
1083 | 1371 if ( pParty->bTurnBasedModeOn != 1 || !(item->uSectorID & 4) ) |
1372 continue; | |
1373 v12 = abs(pParty->vPosition.x - item->vPosition.x); | |
1374 v18 = abs(pParty->vPosition.y - item->vPosition.y); | |
1375 v19 = abs(pParty->vPosition.z - item->vPosition.z); | |
0 | 1376 v13 = v12; |
1377 v14 = v18; | |
1378 v15 = v19; | |
1379 if ( v12 < v18 ) | |
1380 { | |
1381 v13 = v18; | |
1382 v14 = v12; | |
1383 } | |
1384 if ( v13 < v19 ) | |
1385 { | |
1386 v16 = v13; | |
1387 v13 = v19; | |
1388 v15 = v16; | |
1389 } | |
1390 if ( v14 < (signed int)v15 ) | |
1391 { | |
1392 v17 = v15; | |
1393 v15 = v14; | |
1394 v14 = v17; | |
1395 } | |
1396 v0 = (unsigned int)(11 * v14) >> 5; | |
1397 if ( (signed int)(v0 + (v15 >> 2) + v13) <= 5120 ) | |
1083 | 1398 continue; |
0 | 1399 v10 = i; |
1083 | 1400 SpriteObject::OnInteraction(v10); |
1401 continue; | |
0 | 1402 } |
1403 v10 = i; | |
1404 if ( !(v9 & 0x40) ) | |
1083 | 1405 { |
1406 SpriteObject::OnInteraction(v10); | |
1407 continue; | |
1408 } | |
862 | 1409 _46BFFA_check_object_intercept(i, PID(OBJECT_Item,i)); |
0 | 1410 } |
1411 } | |
1412 //v2 += 112; | |
1413 //v1 = v20++ + 1; | |
1414 //} | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
1415 //while ( v20 < (signed int)uNumSpriteObjects ); |
0 | 1416 } |
1417 } | |
1418 | |
1419 //----- (0047272C) -------------------------------------------------------- | |
831 | 1420 int collide_against_floor_approximate(int x, int y, int z, unsigned int *pSectorID, unsigned int *pFaceID) |
0 | 1421 { |
1422 signed int v5; // ebx@1 | |
1423 int result; // eax@1 | |
1424 int v7; // [sp+10h] [bp-8h]@1 | |
1425 signed int v8; // [sp+14h] [bp-4h]@1 | |
1426 | |
1427 v5 = x - 2; | |
1428 v7 = x; | |
1429 v8 = y; | |
1430 *pSectorID = pIndoor->GetSector(x - 2, y, z + 40); | |
783 | 1431 result = collide_against_floor(v5, v8, z + 40, pSectorID, pFaceID); |
0 | 1432 if ( result == -30000 || !*pSectorID ) |
1433 { | |
1434 *pSectorID = pIndoor->GetSector(v7 + 2, v8, z + 40); | |
783 | 1435 result = collide_against_floor(v7 + 2, v8, z + 40, pSectorID, pFaceID); |
0 | 1436 if ( result == -30000 || !*pSectorID ) |
1437 { | |
1438 *pSectorID = pIndoor->GetSector(v7, v8 - 2, z + 40); | |
783 | 1439 result = collide_against_floor(v7, v8 - 2, z + 40, pSectorID, pFaceID); |
0 | 1440 if ( result == -30000 || !*pSectorID ) |
1441 { | |
1442 *pSectorID = pIndoor->GetSector(v7, v8 + 2, z + 40); | |
783 | 1443 result = collide_against_floor(v7, v8 + 2, z + 40, pSectorID, pFaceID); |
0 | 1444 if ( result == -30000 || !*pSectorID ) |
1445 { | |
1446 *pSectorID = pIndoor->GetSector(v7, v8, z + 140); | |
783 | 1447 result = collide_against_floor(v7, v8, z + 140, pSectorID, pFaceID); |
0 | 1448 } |
1449 } | |
1450 } | |
1451 } | |
1452 return result; | |
1453 } | |
1454 | |
1455 //----- (00472866) -------------------------------------------------------- | |
1456 void BLV_ProcessPartyActions() | |
1457 { | |
1458 int v1; // ebx@1 | |
1459 int v2; // edi@1 | |
831 | 1460 //int v6; // eax@18 |
1461 //signed __int64 v8; // qax@27 | |
1462 //int v9; // eax@27 | |
0 | 1463 double v10; // st7@27 |
1464 unsigned int v12; // eax@49 | |
1465 double v13; // st7@50 | |
831 | 1466 //int v14; // eax@51 |
1467 //signed __int64 v15; // qax@53 | |
1468 //double v16; // st7@54 | |
0 | 1469 int v17; // eax@62 |
1470 double v18; // st7@62 | |
1471 int v19; // ST40_4@62 | |
1472 int v20; // eax@65 | |
1473 double v21; // st7@65 | |
1474 int v22; // ST40_4@65 | |
1475 int v23; // eax@66 | |
1476 double v24; // st7@66 | |
1477 int v25; // ST40_4@66 | |
1478 int v26; // eax@67 | |
1479 double v27; // st7@67 | |
1480 int v28; // ST40_4@67 | |
1481 unsigned int v35; // eax@74 | |
1482 int v36; // ecx@88 | |
1483 int new_party_z; // esi@96 | |
1484 int v38; // eax@96 | |
1485 int v39; // ecx@106 | |
1486 int v40; // eax@106 | |
1487 Player **v41; // esi@113 | |
1488 int v42; // eax@120 | |
1489 signed int v43; // ecx@123 | |
1490 BLVFace *v44; // esi@126 | |
1491 PolygonType v45; // al@126 | |
1492 int v46; // ecx@133 | |
1493 char v47; // zf@133 | |
1494 int v48; // eax@133 | |
1495 int v49; // ST40_4@136 | |
1496 int v50; // ST40_4@140 | |
1497 int v51; // eax@140 | |
1498 int v52; // eax@140 | |
1499 signed int v53; // edi@146 | |
1500 int v54; // ebx@146 | |
1501 int v55; // ST30_4@146 | |
1502 AudioPlayer *v56; // ecx@162 | |
1503 SoundID v57; // [sp-20h] [bp-80h]@163 | |
1504 signed int v58; // [sp-1Ch] [bp-7Ch]@161 | |
1505 unsigned int v59; // [sp-18h] [bp-78h]@161 | |
1506 signed int v60; // [sp-14h] [bp-74h]@161 | |
1507 signed int v61; // [sp-10h] [bp-70h]@161 | |
1508 int v62; // [sp-Ch] [bp-6Ch]@161 | |
1509 int v63; // [sp-8h] [bp-68h]@75 | |
1510 unsigned int v64; // [sp-8h] [bp-68h]@161 | |
1511 int v65; // [sp-4h] [bp-64h]@75 | |
1512 int v66; // [sp-4h] [bp-64h]@161 | |
831 | 1513 //int v68; // [sp+10h] [bp-50h]@45 |
0 | 1514 int v69; // [sp+10h] [bp-50h]@140 |
1515 unsigned int uFaceEvent; // [sp+14h] [bp-4Ch]@1 | |
831 | 1516 //signed int v71; // [sp+18h] [bp-48h]@1 |
0 | 1517 signed int v72; // [sp+1Ch] [bp-44h]@1 |
1518 signed int v73; // [sp+20h] [bp-40h]@100 | |
1519 int v74; // [sp+20h] [bp-40h]@140 | |
1520 bool bFeatherFall; // [sp+24h] [bp-3Ch]@15 | |
1521 unsigned int uSectorID; // [sp+28h] [bp-38h]@1 | |
1522 int v78; // [sp+2Ch] [bp-34h]@1 | |
1523 unsigned int uFaceID; // [sp+30h] [bp-30h]@1 | |
1524 int v80; // [sp+34h] [bp-2Ch]@1 | |
1525 int v81; // [sp+38h] [bp-28h]@47 | |
1526 int v82; // [sp+3Ch] [bp-24h]@47 | |
1527 int _view_angle; // [sp+40h] [bp-20h]@47 | |
1528 int bJumping; // [sp+44h] [bp-1Ch]@1 | |
1529 int new_party_y; // [sp+48h] [bp-18h]@1 | |
1530 int new_party_x; // [sp+4Ch] [bp-14h]@1 | |
1531 int party_z; // [sp+50h] [bp-10h]@1 | |
717 | 1532 //int v89; // [sp+58h] [bp-8h]@1 |
0 | 1533 int angle; // [sp+5Ch] [bp-4h]@47 |
1534 | |
1535 uFaceEvent = 0; | |
717 | 1536 //v89 = pParty->uFallSpeed; |
0 | 1537 v1 = 0; |
1538 v2 = 0; | |
1539 new_party_x = pParty->vPosition.x; | |
717 | 1540 new_party_y = pParty->vPosition.y; |
0 | 1541 party_z = pParty->vPosition.z; |
1542 uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z); | |
1543 v72 = 0; | |
1544 v78 = 0; | |
1545 bJumping = 0; | |
792 | 1546 |
1547 uFaceID = -1; | |
831 | 1548 auto floor_level = collide_against_floor(new_party_x, new_party_y, party_z + 40, &uSectorID, &uFaceID); |
792 | 1549 |
0 | 1550 if ( pParty->bFlying ) |
1551 { | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
1552 pParty->bFlying = false; |
0 | 1553 if (pParty->FlyActive()) |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
1554 pOtherOverlayList->pOverlays[pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID - 1].field_E |= 1; |
831 | 1555 } |
1556 | |
1557 if ( floor_level == -30000 || uFaceID == -1) | |
1558 { | |
1559 floor_level = collide_against_floor_approximate(new_party_x, new_party_y, party_z + 40, &uSectorID, &uFaceID); | |
1560 if ( floor_level == -30000 || uFaceID == -1) | |
1561 { | |
1562 __debugbreak(); // level built with errors | |
0 | 1563 pParty->vPosition.x = blv_prev_party_x; |
1564 pParty->vPosition.y = blv_prev_party_z; | |
1565 pParty->vPosition.z = blv_prev_party_y; | |
1566 pParty->uFallStartY = blv_prev_party_y; | |
1567 return; | |
1568 } | |
1569 } | |
831 | 1570 |
0 | 1571 blv_prev_party_x = pParty->vPosition.x; |
1572 blv_prev_party_z = pParty->vPosition.y; | |
1573 blv_prev_party_y = pParty->vPosition.z; | |
1574 if (!pParty->bTurnBasedModeOn) | |
1575 { | |
1576 auto v67 = GetTickCount() / 500; | |
1577 if (dword_720CDC != v67 ) | |
1578 { | |
1285 | 1579 dword_4F8580[3 * dword_4F8580[1]] = pParty->vPosition.x; |
1580 dword_4F8580[3 * dword_4F8580[2]] = pParty->vPosition.y; | |
1581 dword_4F8580[3 * dword_4F8580[3]] = pParty->vPosition.z; | |
0 | 1582 if ( dword_4F8580[0] > 60 ) |
1583 dword_4F8580[0] = 1; | |
1584 } | |
1585 dword_720CDC = v67; | |
1586 } | |
831 | 1587 |
1588 uint fall_start; | |
0 | 1589 if (!pParty->FeatherFallActive()) |
1590 { | |
1591 bFeatherFall = false; | |
1563 | 1592 if (!pParty->pPlayers[0].WearsItemAnyWhere(ITEM_ARTIFACT_LADYS_ESCORT) && // grants feather fall |
1593 !pParty->pPlayers[1].WearsItemAnyWhere(ITEM_ARTIFACT_LADYS_ESCORT) && | |
1594 !pParty->pPlayers[2].WearsItemAnyWhere(ITEM_ARTIFACT_LADYS_ESCORT) && | |
1595 !pParty->pPlayers[3].WearsItemAnyWhere(ITEM_ARTIFACT_LADYS_ESCORT)) | |
831 | 1596 { |
1597 fall_start = pParty->uFallStartY; | |
1598 } | |
1599 } | |
1600 else | |
1601 { | |
1602 fall_start = floor_level; | |
0 | 1603 bFeatherFall = true; |
831 | 1604 pParty->uFallStartY = floor_level; |
1605 } | |
1606 | |
1607 | |
1608 if (fall_start - party_z > 512 && !bFeatherFall && party_z <= floor_level + 1) | |
1609 { | |
1610 assert(~pParty->uFlags & PARTY_FLAGS_1_LANDING); // why land in indoor? | |
569 | 1611 if (pParty->uFlags & PARTY_FLAGS_1_LANDING) |
1612 pParty->uFlags &= ~PARTY_FLAGS_1_LANDING; | |
0 | 1613 else for (uint i = 0; i < 4; ++i) |
1614 { // receive falling damage | |
831 | 1615 auto player = pParty->pPlayers + i; |
1080 | 1616 if (!player->HasEnchantedItemEquipped(72) && !player->WearsItem(ITEM_ARTIFACT_HERMES_SANDALS, EQUIP_BOOTS)) |
831 | 1617 { |
1036 | 1618 player->ReceiveDamage((pParty->uFallStartY - party_z) * (0.1f * player->GetMaxHealth()) / 256, DMGT_PHISYCAL); |
1619 v10 = (double)(20 - player->GetParameterBonus(player->GetActualEndurance())) * flt_6BE3A4_debug_recmod1 * 2.133333333333333; | |
831 | 1620 player->SetRecoveryTime((signed __int64)v10); |
1621 } | |
1622 } | |
1623 } | |
1624 | |
1625 if ( party_z > floor_level + 1 ) | |
0 | 1626 bJumping = 1; |
831 | 1627 |
1628 bool jumping_up = false; | |
1629 | |
1630 if ( party_z - floor_level <= 32 ) | |
1631 { | |
0 | 1632 pParty->uFallStartY = party_z; |
831 | 1633 jumping_up = true; |
1634 } | |
1635 | |
1636 if (bWalkSound && pParty->walk_sound_timer) | |
1637 { | |
1638 if (pParty->walk_sound_timer > pEventTimer->uTimeElapsed) | |
1639 pParty->walk_sound_timer -= pEventTimer->uTimeElapsed; | |
1640 else pParty->walk_sound_timer = 0; | |
1641 } | |
1642 | |
1643 | |
1644 if (party_z <= floor_level + 1) | |
1645 { | |
1646 party_z = floor_level + 1; | |
1647 pParty->uFallStartY = floor_level + 1; | |
1648 | |
1649 if (!bJumping && pParty->floor_face_pid != uFaceID) | |
1650 { | |
1651 auto pFace = &pIndoor->pFaces[uFaceID]; | |
1652 if (pFace->uAttributes & FACE_PRESSURE_PLATE) | |
1653 uFaceEvent = pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID; | |
1654 } | |
1655 } | |
1656 if (!bJumping) | |
1657 pParty->floor_face_pid = uFaceID; | |
1658 | |
1659 bool on_water = false; | |
1660 if ( pIndoor->pFaces[uFaceID].Fluid()) | |
1661 on_water = true; | |
1662 | |
0 | 1663 v81 = pParty->uWalkSpeed; |
1664 angle = pParty->sRotationY; | |
1665 _view_angle = pParty->sRotationX; | |
831 | 1666 v82 = (unsigned __int64)(pEventTimer->dt_in_some_format * (signed __int64)((signed int)(pParty->y_rotation_speed * stru_5C6E00->uIntegerPi) |
0 | 1667 / 180)) >> 16; |
809 | 1668 //LABEL_87: |
0 | 1669 while ( pPartyActionQueue->uNumActions ) |
1670 { | |
1671 switch ( pPartyActionQueue->Next() ) | |
1672 { | |
1673 case PARTY_TurnLeft: | |
831 | 1674 if (uTurnSpeed) |
1675 angle = stru_5C6E00->uDoublePiMask & (angle + uTurnSpeed); | |
1676 else | |
1677 angle = stru_5C6E00->uDoublePiMask & (angle + (int)(v82 * fTurnSpeedMultiplier)); | |
809 | 1678 break; |
0 | 1679 case PARTY_TurnRight: |
831 | 1680 if (uTurnSpeed) |
809 | 1681 angle = stru_5C6E00->uDoublePiMask & (angle - uTurnSpeed); |
831 | 1682 else |
1683 angle = stru_5C6E00->uDoublePiMask & (angle - (int)(v82 * fTurnSpeedMultiplier)); | |
809 | 1684 break; |
831 | 1685 |
0 | 1686 case PARTY_FastTurnLeft: |
831 | 1687 if (uTurnSpeed) |
1688 angle = stru_5C6E00->uDoublePiMask & (angle + uTurnSpeed); | |
0 | 1689 else |
831 | 1690 angle = stru_5C6E00->uDoublePiMask & (angle + (int)(2.0f * fTurnSpeedMultiplier * (double)v82)); |
809 | 1691 break; |
831 | 1692 |
0 | 1693 case PARTY_FastTurnRight: |
831 | 1694 if (uTurnSpeed) |
1695 angle = stru_5C6E00->uDoublePiMask & (angle - uTurnSpeed); | |
1696 else | |
1697 angle = stru_5C6E00->uDoublePiMask & (angle - (int)(2.0f * fTurnSpeedMultiplier * (double)v82)); | |
809 | 1698 break; |
831 | 1699 |
809 | 1700 case PARTY_StrafeLeft: |
1546 | 1701 v2 -= fixpoint_sub0(stru_5C6E00->Sin(angle), v81 * fWalkSpeedMultiplier / 2); |
1702 v1 += fixpoint_sub0(stru_5C6E00->Cos(angle), v81 * fWalkSpeedMultiplier / 2); | |
717 | 1703 v78 = 1; |
809 | 1704 break; |
0 | 1705 case PARTY_StrafeRight: |
1546 | 1706 v2 += fixpoint_sub0(stru_5C6E00->Sin(angle), v81 * fWalkSpeedMultiplier / 2); |
1707 v1 -= fixpoint_sub0(stru_5C6E00->Cos(angle), v81 * fWalkSpeedMultiplier / 2); | |
717 | 1708 v78 = 1; |
809 | 1709 break; |
0 | 1710 case PARTY_WalkForward: |
1546 | 1711 v2 += fixpoint_sub0(stru_5C6E00->Cos(angle), 5 * v81 * fWalkSpeedMultiplier); |
1712 v1 += fixpoint_sub0(stru_5C6E00->Sin(angle), 5 * v81 * fWalkSpeedMultiplier); | |
717 | 1713 v78 = 1; |
809 | 1714 break; |
0 | 1715 case PARTY_WalkBackward: |
1546 | 1716 v2 -= fixpoint_sub0(stru_5C6E00->Cos(angle), v81 * fBackwardWalkSpeedMultiplier); |
1717 v1 -= fixpoint_sub0(stru_5C6E00->Sin(angle), v81 * fBackwardWalkSpeedMultiplier); | |
0 | 1718 v78 = 1; |
809 | 1719 break; |
0 | 1720 case PARTY_RunForward: |
1546 | 1721 v2 += fixpoint_sub0(stru_5C6E00->Cos(angle), 2 * v81 * fWalkSpeedMultiplier); |
1722 v1 += fixpoint_sub0(stru_5C6E00->Sin(angle), 2 * v81 * fWalkSpeedMultiplier); | |
0 | 1723 v72 = 1; |
809 | 1724 break; |
0 | 1725 case PARTY_RunBackward: |
1726 //v32 = stru_5C6E00->SinCos(angle); | |
1727 //v33 = (double)v81; | |
1728 //v88 = (double)v81; | |
1546 | 1729 v2 -= fixpoint_sub0(stru_5C6E00->Cos(angle), v81 * fBackwardWalkSpeedMultiplier); |
0 | 1730 //v34 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); |
1546 | 1731 v1 -= fixpoint_sub0(stru_5C6E00->Sin(angle), v81 * fBackwardWalkSpeedMultiplier); |
0 | 1732 v72 = 1; |
807 | 1733 break; |
0 | 1734 case PARTY_LookUp: |
1735 _view_angle += (signed __int64)(flt_6BE150_look_up_down_dangle * 25.0); | |
1736 if ( _view_angle > 128 ) | |
1737 _view_angle = 128; | |
1738 v35 = uActiveCharacter; | |
809 | 1739 if ( uActiveCharacter ) |
1740 pPlayers[v35]->PlaySound((PlayerSpeech)SPEECH_63, 0); | |
717 | 1741 break; |
0 | 1742 case PARTY_LookDown: |
1743 _view_angle += (signed __int64)(flt_6BE150_look_up_down_dangle * -25.0); | |
1744 if ( _view_angle < -128 ) | |
1745 _view_angle = -128; | |
1746 v35 = uActiveCharacter; | |
1747 if ( uActiveCharacter ) | |
717 | 1748 pPlayers[v35]->PlaySound((PlayerSpeech)SPEECH_64, 0); |
0 | 1749 break; |
1750 case PARTY_CenterView: | |
1751 _view_angle = 0; | |
1752 break; | |
1753 case PARTY_Jump: | |
831 | 1754 if ( (!bJumping || party_z <= floor_level + 6 && pParty->uFallSpeed <= 0) && pParty->field_24 ) |
0 | 1755 { |
1756 bJumping = 1; | |
717 | 1757 pParty->uFallSpeed = (signed __int64)((double)(pParty->field_24 << 6) * 1.5 + (double)pParty->uFallSpeed); |
0 | 1758 } |
1759 break; | |
1760 default: | |
809 | 1761 break; |
0 | 1762 } |
1763 } | |
1764 v36 = 0; | |
1765 pParty->sRotationY = angle; | |
1766 pParty->sRotationX = _view_angle; | |
1767 if ( bJumping ) | |
1768 { | |
1418 | 1769 pParty->uFallSpeed += -2 * pEventTimer->uTimeElapsed * GetGravityStrength(); |
1770 if ( bJumping != v36 && pParty->uFallSpeed <= v36 ) | |
1771 { | |
1772 if ( pParty->uFallSpeed < -500 && !pParty->bFlying ) | |
1773 { | |
1774 v41 = &pPlayers[1]; | |
1775 do | |
1776 { | |
1777 if ( !(*v41)->HasEnchantedItemEquipped(72) && !(*v41)->WearsItem(ITEM_ARTIFACT_HERMES_SANDALS, EQUIP_BOOTS) ) //was 8 | |
1778 (*v41)->PlayEmotion(CHARACTER_EXPRESSION_SCARED, 0); | |
1779 ++v41; | |
1780 } | |
1781 while ( (signed int)v41 <= (signed int)&pPlayers[4] ); | |
1782 } | |
1783 } | |
1784 else | |
1785 pParty->uFallStartY = party_z; | |
0 | 1786 } |
1787 else | |
1788 { | |
831 | 1789 if ( pIndoor->pFaces[uFaceID].pFacePlane_old.vNormal.z < 32768 ) |
0 | 1790 { |
717 | 1791 pParty->uFallSpeed -= pEventTimer->uTimeElapsed * GetGravityStrength(); |
1418 | 1792 pParty->uFallStartY = party_z; |
0 | 1793 } |
1418 | 1794 else |
1795 { | |
1796 if (! (pParty->uFlags & PARTY_FLAGS_1_LANDING) ) | |
1797 pParty->uFallSpeed = 0; | |
1798 pParty->uFallStartY = party_z; | |
1799 } | |
1800 } | |
0 | 1801 if ( v2 * v2 + v1 * v1 < 400 ) |
1802 { | |
1803 v1 = 0; | |
1804 v2 = 0; | |
1805 } | |
1806 stru_721530.field_84 = -1; | |
1807 stru_721530.field_70 = 0; | |
1546 | 1808 stru_721530.prolly_normal_d = pParty->field_14_radius; |
1809 stru_721530.field_8_radius = pParty->field_14_radius / 2; | |
0 | 1810 auto v83 = 0; |
1811 stru_721530.field_0 = 1; | |
1546 | 1812 stru_721530.height = pParty->uPartyHeight - 32; |
0 | 1813 while ( 1 ) |
1814 { | |
1815 new_party_z = party_z; | |
1546 | 1816 stru_721530.position.x = new_party_x; |
0 | 1817 stru_721530.normal.x = new_party_x; |
1546 | 1818 stru_721530.velocity.x = v2; |
1819 stru_721530.position.y = new_party_y; | |
0 | 1820 stru_721530.normal.y = new_party_y; |
1546 | 1821 stru_721530.velocity.y = v1; |
0 | 1822 stru_721530.normal.z = stru_721530.prolly_normal_d + party_z + 1; |
1546 | 1823 stru_721530.position.z = stru_721530.height + party_z + 1; |
1824 stru_721530.velocity.z = pParty->uFallSpeed; | |
0 | 1825 stru_721530.uSectorID = uSectorID; |
1826 v38 = 0; | |
1340 | 1827 if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->turn_stage == 3 ) |
0 | 1828 v38 = 13312; |
1829 if ( stru_721530._47050A(v38) ) | |
1830 break; | |
1831 v73 = 0; | |
1832 do | |
1833 { | |
1834 _46E44E_collide_against_faces_and_portals(1u); | |
1835 _46E0B2_collide_against_decorations(); | |
1836 for ( v80 = 0; v80 < (signed int)uNumActors; ++v80 ) | |
1837 _46DF1A_collide_against_actor(v80, 0); | |
1838 if ( _46F04E_collide_against_portals() ) | |
1839 break; | |
1840 ++v73; | |
1841 } | |
1842 while ( v73 < 100 ); | |
1843 if ( stru_721530.field_7C >= stru_721530.field_6C ) | |
1844 { | |
1845 v39 = stru_721530.normal2.x; | |
1846 uSectorID = stru_721530.normal2.y; | |
1847 v40 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1; | |
1848 } | |
1849 else | |
1850 { | |
1546 | 1851 v39 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.x) >> 16) + new_party_x; |
1852 uSectorID = new_party_y + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.y) >> 16); | |
1853 v40 = new_party_z + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.z) >> 16); | |
0 | 1854 } |
783 | 1855 v42 = collide_against_floor(v39, uSectorID, v40 + 40, &stru_721530.uSectorID, &uFaceID); |
0 | 1856 if ( v42 == -30000 || v42 - new_party_z > 128 ) |
1857 return; | |
1858 if ( stru_721530.field_7C >= stru_721530.field_6C ) | |
1859 { | |
1860 new_party_x = stru_721530.normal2.x; | |
1861 new_party_y = stru_721530.normal2.y; | |
1862 new_party_z = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1; | |
1863 break; | |
1864 } | |
1546 | 1865 new_party_x += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.x) >> 16; |
1866 new_party_y += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.y) >> 16; | |
0 | 1867 v43 = stru_721530.uFaceID; |
1868 uSectorID = stru_721530.uSectorID; | |
1869 stru_721530.field_70 += stru_721530.field_7C; | |
1546 | 1870 auto v87 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.z) >> 16) + new_party_z; |
848 | 1871 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Actor) |
0 | 1872 { |
1167 | 1873 if ( SHIDWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) >= 0 |
1874 && (SHIDWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime)) ) | |
1875 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); | |
0 | 1876 viewparams->bRedrawGameUI = 1; |
1877 } | |
1418 | 1878 else if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Decoration) |
0 | 1879 { |
295 | 1880 v53 = integer_sqrt(v2 * v2 + v1 * v1); |
0 | 1881 v80 = v53; |
717 | 1882 v54 = stru_5C6E00->Atan2(new_party_x - pLevelDecorations[stru_721530.uFaceID >> 3].vPosition.x, |
0 | 1883 new_party_y - pLevelDecorations[stru_721530.uFaceID >> 3].vPosition.y); |
323 | 1884 v2 = (unsigned __int64)(stru_5C6E00->Cos(v54) * (signed __int64)v53) >> 16; |
1885 v55 = stru_5C6E00->Sin(v54); | |
0 | 1886 v1 = (unsigned __int64)(v55 * (signed __int64)v80) >> 16; |
1887 } | |
1888 else | |
1889 { | |
848 | 1890 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_BModel) |
0 | 1891 { |
1892 v44 = &pIndoor->pFaces[(signed int)stru_721530.uFaceID >> 3]; | |
1893 v45 = v44->uPolygonType; | |
1894 if ( v45 == 3 ) | |
1895 { | |
717 | 1896 if ( pParty->uFallSpeed < 0 ) |
1897 pParty->uFallSpeed = 0; | |
0 | 1898 v87 = pIndoor->pVertices[*v44->pVertexIDs].z + 1; |
1899 if ( pParty->uFallStartY - v87 < 512 ) | |
1900 pParty->uFallStartY = v87; | |
1901 if ( v2 * v2 + v1 * v1 < 400 ) | |
1902 { | |
1903 v1 = 0; | |
1904 v2 = 0; | |
1905 } | |
831 | 1906 if ( pParty->floor_face_pid != PID_ID(v43) && BYTE3(v44->uAttributes) & 4 ) |
717 | 1907 uFaceEvent = pIndoor->pFaceExtras[v44->uFaceExtraID].uEventID; |
1908 } | |
1418 | 1909 else |
1910 { | |
1911 v46 = pParty->uFallSpeed * v44->pFacePlane_old.vNormal.z; | |
1912 v47 = v45 == 4; | |
1913 v48 = v44->pFacePlane_old.vNormal.x; | |
1914 if ( !v47 ) | |
1915 { | |
1916 v80 = abs(v1 * v44->pFacePlane_old.vNormal.y + v46 + v2 * v48) >> 16; | |
1546 | 1917 if ((stru_721530.speed >> 3) > v80 ) |
1918 v80 = stru_721530.speed >> 3; | |
1418 | 1919 v50 = (unsigned __int64)(v80 * (signed __int64)v44->pFacePlane_old.vNormal.x) >> 16; |
1920 v81 = v44->pFacePlane_old.vNormal.y; | |
1921 v81 = (unsigned __int64)(v80 * (signed __int64)v81) >> 16; | |
1922 v82 = v44->pFacePlane_old.vNormal.z; | |
1923 v82 = (unsigned __int64)(v80 * (signed __int64)v82) >> 16; | |
1924 v2 += v50; | |
1925 pParty->uFallSpeed += v82; | |
1926 v74 = v44->pFacePlane_old.vNormal.z; | |
1927 v51 = v44->pFacePlane_old.vNormal.y; | |
1928 v69 = v44->pFacePlane_old.vNormal.x; | |
1929 v80 = v51; | |
1930 v1 += v81; | |
1931 v52 = stru_721530.prolly_normal_d - ((v44->pFacePlane_old.dist + v87 * v74 + new_party_y * v51 + new_party_x * v69) >> 16); | |
1932 if ( v52 > 0 ) | |
1933 { | |
1934 new_party_x += v52 * v69 >> 16; | |
1935 new_party_y += v52 * v80 >> 16; | |
1936 v87 += v52 * v74 >> 16; | |
1937 } | |
1938 v43 = stru_721530.uFaceID; | |
1939 if ( pParty->floor_face_pid != PID_ID(v43) && BYTE3(v44->uAttributes) & 4 ) | |
1940 uFaceEvent = pIndoor->pFaceExtras[v44->uFaceExtraID].uEventID; | |
1941 } | |
1942 else | |
1943 { | |
1944 v80 = abs(v1 * v44->pFacePlane_old.vNormal.y + v46 + v2 * v48) >> 16; | |
1546 | 1945 if ((stru_721530.speed >> 3) > v80 ) |
1946 v80 = stru_721530.speed >> 3; | |
1418 | 1947 v49 = (unsigned __int64)(v80 * (signed __int64)v44->pFacePlane_old.vNormal.x) >> 16; |
1948 v81 = v44->pFacePlane_old.vNormal.y; | |
1949 v81 = (unsigned __int64)(v80 * (signed __int64)v81) >> 16; | |
1950 v82 = v44->pFacePlane_old.vNormal.z; | |
1951 v82 = (unsigned __int64)(v80 * (signed __int64)v82) >> 16; | |
1952 v2 += v49; | |
1953 v1 += v81; | |
1954 pParty->uFallSpeed += v82; | |
1955 if ( v2 * v2 + v1 * v1 >= 400 ) | |
1956 { | |
1957 v43 = stru_721530.uFaceID; | |
1958 if ( pParty->floor_face_pid != PID_ID(v43) && BYTE3(v44->uAttributes) & 4 ) | |
1959 uFaceEvent = pIndoor->pFaceExtras[v44->uFaceExtraID].uEventID; | |
1960 } | |
1961 else | |
1962 { | |
1963 v2 = 0; | |
1964 v1 = 0; | |
1965 pParty->uFallSpeed = 0; | |
1966 } | |
1967 } | |
1968 } | |
0 | 1969 } |
1970 } | |
1971 v2 = (unsigned __int64)(58500i64 * v2) >> 16; | |
1972 v1 = (unsigned __int64)(58500i64 * v1) >> 16; | |
1973 ++v83; | |
717 | 1974 pParty->uFallSpeed = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16; |
0 | 1975 if ( v83 >= 100 ) |
1976 { | |
1977 new_party_z = v87; | |
1978 break; | |
1979 } | |
1980 } | |
831 | 1981 if ( bWalkSound && !pParty->walk_sound_timer) |
0 | 1982 { |
295 | 1983 if ( integer_sqrt((pParty->vPosition.x - new_party_x) * (pParty->vPosition.x - new_party_x) + (pParty->vPosition.y - new_party_y) |
717 | 1984 * (pParty->vPosition.y - new_party_y) + (pParty->vPosition.z - new_party_z) |
1985 * (pParty->vPosition.z - new_party_z)) <= 16 ) | |
1418 | 1986 { |
1987 pAudioPlayer->_4AA258(804); | |
1988 pParty->walk_sound_timer = 64; | |
1989 } | |
1990 else if ( v72 && (!bJumping || jumping_up) ) | |
0 | 1991 { |
1992 v66 = 0; | |
1993 v64 = 0; | |
1994 v62 = 0; | |
1995 v61 = 0; | |
1996 v60 = -1; | |
1997 v59 = 1; | |
1998 v58 = 804; | |
831 | 1999 if ( !on_water ) |
0 | 2000 { |
2001 v56 = pAudioPlayer; | |
2002 if ( BYTE2(pIndoor->pFaces[uFaceID].uAttributes) & 0x20 ) | |
2003 v57 = (SoundID)50; | |
2004 else | |
2005 v57 = (SoundID)64; | |
1418 | 2006 pAudioPlayer->PlaySound(v57, v58, v59, v60, v61, v62, v64, v66); |
0 | 2007 } |
1418 | 2008 else |
2009 { | |
2010 v57 = (SoundID)63; | |
2011 v56 = pAudioPlayer; | |
2012 pAudioPlayer->PlaySound(v57, v58, v59, v60, v61, v62, v64, v66); | |
2013 } | |
0 | 2014 } |
1418 | 2015 else if ( v78 && (!bJumping || jumping_up) ) |
0 | 2016 { |
2017 v66 = 0; | |
2018 v64 = 0; | |
2019 v62 = 0; | |
2020 v61 = 0; | |
2021 v60 = -1; | |
2022 v59 = 1; | |
2023 v58 = 804; | |
831 | 2024 if ( on_water ) |
0 | 2025 { |
2026 v57 = (SoundID)102; | |
717 | 2027 v56 = pAudioPlayer; |
0 | 2028 } |
1418 | 2029 else |
2030 { | |
2031 v56 = pAudioPlayer; | |
2032 if ( BYTE2(pIndoor->pFaces[uFaceID].uAttributes) & 0x20 ) | |
2033 v57 = (SoundID)89; | |
2034 else | |
2035 v57 = (SoundID)103; | |
2036 } | |
0 | 2037 pAudioPlayer->PlaySound(v57, v58, v59, v60, v61, v62, v64, v66); |
2038 } | |
2039 else | |
2040 { | |
2041 pAudioPlayer->_4AA258(804); | |
831 | 2042 pParty->walk_sound_timer = 64; |
2043 } | |
2044 } | |
2045 if ( !bJumping || jumping_up ) | |
569 | 2046 pParty->uFlags &= ~PARTY_FLAGS_1_FALLING; |
2047 else | |
2048 pParty->uFlags |= PARTY_FLAGS_1_FALLING; | |
2049 pParty->uFlags &= ~0x200; | |
0 | 2050 pParty->vPosition.x = new_party_x; |
2051 pParty->vPosition.z = new_party_z; | |
2052 pParty->vPosition.y = new_party_y; | |
717 | 2053 //pParty->uFallSpeed = v89; |
0 | 2054 if ( !bJumping && BYTE3(pIndoor->pFaces[uFaceID].uAttributes) & 0x40 ) |
569 | 2055 pParty->uFlags |= 0x200; |
0 | 2056 if (uFaceEvent) |
2057 EventProcessor(uFaceEvent, 0, 1); | |
2058 } | |
2059 | |
2060 //----- (00473893) -------------------------------------------------------- | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
2061 void ODM_ProcessPartyActions() |
0 | 2062 { |
2063 int v1; // edi@1 | |
2064 int v2; // ebx@1 | |
2065 int v3; // eax@14 | |
2066 int v6; // esi@45 | |
2067 ODMFace *v7; // ecx@45 | |
2068 signed int v33; // eax@143 | |
2069 int v34; // esi@143 | |
141 | 2070 int v35; // esi@147 |
0 | 2071 int v36; // eax@155 |
2072 signed int v37; // esi@159 | |
2073 signed int v38; // eax@159 | |
2074 signed int i; // esi@159 | |
2075 int v40; // esi@162 | |
2076 bool v42; // eax@180 | |
2077 signed int v43; // ecx@184 | |
2078 signed int v44; // edx@184 | |
2079 int v45; // ecx@200 | |
1424 | 2080 BSPModel *pModel; // eax@203 |
2081 ODMFace *pODMFace; // esi@203 | |
0 | 2082 int v48; // eax@203 |
2083 char v49; // zf@203 | |
2084 char v50; // sf@203 | |
2085 unsigned __int8 v51; // of@203 | |
2086 int v52; // eax@203 | |
2087 BSPModel *v54; // eax@215 | |
2088 int v55; // eax@217 | |
2089 signed int v56; // ebx@228 | |
2090 int v57; // eax@228 | |
2091 BSPModel *v58; // eax@228 | |
2092 unsigned __int64 v59; // qax@228 | |
2093 BSPModel *v60; // eax@228 | |
2094 unsigned __int64 v61; // qax@228 | |
2095 int v62; // eax@241 | |
2096 unsigned int v65; // ebx@263 | |
2097 unsigned int v66; // esi@263 | |
2098 int v67; // eax@263 | |
2099 signed int v68; // ecx@263 | |
2100 int v69; // eax@263 | |
2101 int v70; // ebx@271 | |
2102 int v71; // esi@271 | |
2103 int v72; // edi@271 | |
2104 int v73; // eax@271 | |
2105 unsigned int v76; // edi@293 | |
2106 bool v77; // edx@297 | |
2107 bool v78; // ecx@303 | |
2108 int v79; // ecx@314 | |
2109 __int16 v80; // dx@317 | |
2110 int v81; // ebx@318 | |
2111 int v82; // ecx@318 | |
1424 | 2112 int pTerrainHeight; // eax@321 |
0 | 2113 int v86; // [sp-20h] [bp-B4h]@246 |
2114 int v87; // [sp-20h] [bp-B4h]@248 | |
2115 signed int v88; // [sp-1Ch] [bp-B0h]@246 | |
2116 unsigned int v89; // [sp-18h] [bp-ACh]@246 | |
2117 signed int v90; // [sp-14h] [bp-A8h]@246 | |
2118 signed int v91; // [sp-10h] [bp-A4h]@246 | |
2119 int v92; // [sp-Ch] [bp-A0h]@246 | |
2120 unsigned int v94; // [sp-8h] [bp-9Ch]@246 | |
2121 int v96; // [sp-4h] [bp-98h]@246 | |
2122 int v97; // [sp+Ch] [bp-88h]@180 | |
138 | 2123 Vec3_int_ v98; |
0 | 2124 bool v101; // [sp+1Ch] [bp-78h]@33 |
2125 int v102; // [sp+20h] [bp-74h]@1 | |
2126 int v103; // [sp+24h] [bp-70h]@1 | |
2127 int bFeatherFall; // [sp+28h] [bp-6Ch]@4 | |
2128 int v105; // [sp+2Ch] [bp-68h]@24 | |
2129 int bWaterWalk; // [sp+30h] [bp-64h]@1 | |
2130 int v109; // [sp+3Ch] [bp-58h]@28 | |
2131 int v110; // [sp+40h] [bp-54h]@180 | |
2132 int v111; // [sp+44h] [bp-50h]@14 | |
2133 int bJumping; // [sp+48h] [bp-4Ch]@1 | |
2134 int v113; // [sp+4Ch] [bp-48h]@1 | |
2135 unsigned int v114; // [sp+50h] [bp-44h]@1 | |
2136 int _walk_speed; // [sp+54h] [bp-40h]@48 | |
723 | 2137 int pX; // [sp+58h] [bp-3Ch]@1 |
2138 int pY; // [sp+5Ch] [bp-38h]@1 | |
0 | 2139 int v118; // [sp+60h] [bp-34h]@1 |
2140 int _angle_x; // [sp+68h] [bp-2Ch]@48 | |
2141 unsigned int v122; // [sp+70h] [bp-24h]@180 | |
723 | 2142 int pZ; // [sp+74h] [bp-20h]@1 |
0 | 2143 int v124; // [sp+78h] [bp-1Ch]@1 |
2144 int _angle_y; // [sp+7Ch] [bp-18h]@48 | |
2145 int v126; // [sp+80h] [bp-14h]@48 | |
2146 int v128; // [sp+88h] [bp-Ch]@1 | |
2147 int v129; // [sp+8Ch] [bp-8h]@92 | |
1424 | 2148 |
723 | 2149 pZ = pParty->vPosition.z; |
0 | 2150 v1 = 0; |
2151 v103 = 0; | |
2152 v2 = 0; | |
1061 | 2153 //*(float *)&v128 = 0.0; |
2154 v128 = 0; | |
2155 v129 = 0; | |
723 | 2156 pX = pParty->vPosition.x; |
2157 pY = pParty->vPosition.y; | |
0 | 2158 v113 = pParty->field_6F0; |
2159 bJumping = 0; | |
138 | 2160 auto partyAtHighSlope = IsTerrainSlopeTooHigh(pParty->vPosition.x, pParty->vPosition.y); |
0 | 2161 v114 = 0; |
2162 v124 = 0; | |
2163 v102 = 0; | |
1424 | 2164 pModel = 0; |
0 | 2165 bWaterWalk = 0; |
122 | 2166 if (!pParty->FeatherFallActive()) |
0 | 2167 { |
2168 bFeatherFall = 0; | |
122 | 2169 for (int i = 0; i < 4; ++i) |
1563 | 2170 if (pParty->pPlayers[i].WearsItemAnyWhere(ITEM_ARTIFACT_LADYS_ESCORT)) // seems like flying boots |
122 | 2171 { |
2172 bFeatherFall = 1; | |
2173 break; | |
2174 } | |
2175 } | |
889 | 2176 else |
2177 { | |
2178 bFeatherFall = 1; | |
2179 } | |
122 | 2180 //LABEL_9: |
569 | 2181 pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER; |
122 | 2182 if (pParty->WaterWalkActive()) |
2183 { | |
2184 //LOBYTE(pParty->uFlags) &= 0x7Fu; | |
0 | 2185 bWaterWalk = 1; |
1167 | 2186 *(short *)&stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID + 119] |= 1u; |
122 | 2187 if (!(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1) && |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
2188 pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster - 1].sMana <= 0 ) |
0 | 2189 bWaterWalk = 0; |
2190 } | |
1413 | 2191 int bmodel_standing_on_pid; |
2192 int is_on_water = false; | |
2193 v3 = ODM_GetFloorLevel(pX, pY, pZ, pParty->uPartyHeight, &is_on_water, &bmodel_standing_on_pid, bWaterWalk); | |
2194 int is_not_on_bmodel = bmodel_standing_on_pid == 0; | |
2195 | |
0 | 2196 v111 = v3; |
2197 if ( bFeatherFall ) | |
2198 pParty->uFallStartY = v3; | |
2199 else | |
2200 v3 = pParty->uFallStartY; | |
723 | 2201 if ( v3 - pZ > 512 && !bFeatherFall && pZ <= v111 + 1 ) |
0 | 2202 { |
141 | 2203 if (pParty->uFlags & PARTY_FLAGS_1_LANDING) |
2204 { | |
2205 pParty->uFlags &= ~PARTY_FLAGS_1_LANDING; | |
2206 } | |
2207 else for (int _i = 0; _i < 4; ++_i) // receive falling damage | |
2208 { | |
2209 auto player = pParty->pPlayers + _i; | |
2210 | |
1080 | 2211 if ( !player->HasEnchantedItemEquipped(72) && !player->WearsItem(ITEM_ARTIFACT_HERMES_SANDALS, EQUIP_BOOTS) ) |
141 | 2212 { |
2213 player->ReceiveDamage( | |
723 | 2214 (signed int)((pParty->uFallStartY - pZ) * (unsigned __int64)(player->GetMaxHealth() / 10)) / 256, |
1036 | 2215 DMGT_PHISYCAL); |
2216 v105 = 20 - player->GetParameterBonus(player->GetActualEndurance()); | |
141 | 2217 player->SetRecoveryTime((signed __int64)((double)v105 * flt_6BE3A4_debug_recmod1 * 2.133333333333333)); |
2218 } | |
2219 //} | |
2220 //while ( (signed int)v4 <= (signed int)&pPlayers[4] ); | |
0 | 2221 } |
2222 } | |
2223 v109 = -1; | |
138 | 2224 if ( pParty->bFlying ) |
723 | 2225 v109 = sub_46D8E3(pX, pY, pZ + pParty->uPartyHeight, (int)&v102); |
1413 | 2226 //v107 = bmodel_standing_on_pid == 0; |
0 | 2227 v105 = v111 + 1; |
723 | 2228 if ( pZ <= v111 + 1 ) |
0 | 2229 { |
2230 v109 = -1; | |
138 | 2231 pParty->bFlying = false; |
0 | 2232 } |
2233 else | |
2234 { | |
2235 bJumping = 1; | |
2236 } | |
723 | 2237 v101 = pZ - v111 <= 32; |
831 | 2238 if ( bWalkSound && pParty->walk_sound_timer) |
2239 { | |
2240 if (pParty->walk_sound_timer >= pEventTimer->uTimeElapsed) | |
2241 pParty->walk_sound_timer -= pEventTimer->uTimeElapsed; | |
2242 else pParty->walk_sound_timer = 0; | |
2243 } | |
1413 | 2244 if (!bUnderwater && pParty->pPartyBuffs[PARTY_BUFF_FLY].uExpireTime <= 0) |
138 | 2245 pParty->bFlying = false; |
2246 if (!bJumping) | |
0 | 2247 { |
1413 | 2248 if ( pParty->floor_face_pid != PID(OBJECT_BModel, bmodel_standing_on_pid) ) |
0 | 2249 { |
1413 | 2250 if (bmodel_standing_on_pid) |
0 | 2251 { |
1413 | 2252 if ( (bmodel_standing_on_pid >> 6) < pOutdoor->uNumBModels ) |
0 | 2253 { |
1413 | 2254 v7 = pOutdoor->pBModels[bmodel_standing_on_pid >> 6].pFaces; |
2255 v6 = bmodel_standing_on_pid & 0x3F; | |
79 | 2256 /*if ( *(char *)(v7->pFacePlane.vNormal.x + 308 * v6 + 31) & 4 ) |
0 | 2257 { |
862 | 2258 pParty->field_6F4_packedid = PID(OBJECT_BModel,v108); |
0 | 2259 v103 = *(short *)(v7->pFacePlane.vNormal.x + 308 * v6 + 292); |
79 | 2260 }*/ |
2261 if ( BYTE3(v7[v6].uAttributes) & 4 ) | |
2262 { | |
1413 | 2263 pParty->floor_face_pid = PID(OBJECT_BModel, bmodel_standing_on_pid); |
79 | 2264 v103 = v7[v6].sCogTriggeredID; |
0 | 2265 } |
2266 } | |
2267 } | |
2268 } | |
1413 | 2269 pParty->floor_face_pid = PID(OBJECT_BModel, bmodel_standing_on_pid); |
0 | 2270 } |
2271 _walk_speed = pParty->uWalkSpeed; | |
2272 _angle_y = pParty->sRotationY; | |
2273 _angle_x = pParty->sRotationX; | |
2274 v126 = pEventTimer->dt_in_some_format; | |
122 | 2275 /*v119 = (Player **)((unsigned __int64)(pEventTimer->dt_in_some_format |
0 | 2276 * (signed __int64)((signed int)(pParty->field_20_prolly_turn_speed |
2277 * stru_5C6E00->uIntegerPi) | |
122 | 2278 / 180)) >> 16);*/ |
2279 __int64 dturn = (unsigned __int64)(pEventTimer->dt_in_some_format * (signed __int64)((signed int)(pParty->y_rotation_speed * stru_5C6E00->uIntegerPi) / 180)) >> 16; | |
140 | 2280 while (pPartyActionQueue->uNumActions) |
2281 { | |
2282 switch (pPartyActionQueue->Next()) | |
0 | 2283 { |
2284 case PARTY_FlyUp: | |
138 | 2285 { |
2286 if (!pParty->FlyActive() && !bUnderwater) | |
2287 break; | |
2288 | |
2289 pParty->bFlying = false; | |
2290 if (bUnderwater || | |
2291 pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1 || | |
569 | 2292 pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster - 1].sMana > 0 ) |
0 | 2293 { |
2294 if ( pParty->vPosition.z < 4000 || bJumping ) | |
2295 { | |
723 | 2296 pZ += 30; |
0 | 2297 v113 += 30; |
2298 pParty->bFlying = 1; | |
723 | 2299 if ( pZ > 4000 ) |
0 | 2300 { |
723 | 2301 pZ = 4000; |
0 | 2302 v113 = 4000; |
2303 } | |
2304 v1 = 0; | |
2305 v2 = 0; | |
1424 | 2306 pParty->uFallSpeed = 0; |
0 | 2307 *(float *)&v128 = 0.0; |
723 | 2308 if ( v102 && pZ < v109 && (signed int)(pParty->uPartyHeight + pZ) >= v109 ) |
0 | 2309 { |
2310 pParty->field_6E0 = 0; | |
2311 pParty->field_6E4 = 0; | |
2312 pPartyActionQueue->uNumActions = 0; | |
569 | 2313 pParty->uFlags |= PARTY_FLAGS_1_LANDING; |
0 | 2314 pParty->vPosition.z = v109 - pParty->uPartyHeight - 31; |
723 | 2315 pParty->field_6F0 = pZ; |
0 | 2316 pParty->bFlying = 0; |
723 | 2317 pZ = v109 - pParty->uPartyHeight - 31; |
0 | 2318 v113 = pParty->field_6F0; |
2319 } | |
2320 pParty->uFallSpeed = 0; | |
1424 | 2321 pModel = (BSPModel *)1; |
0 | 2322 } |
2323 } | |
138 | 2324 } |
2325 break; | |
2326 | |
0 | 2327 case PARTY_FlyDown: |
139 | 2328 if (pParty->FlyActive() || bUnderwater) |
0 | 2329 { |
2330 pParty->bFlying = 0; | |
2331 if ( bUnderwater | |
1167 | 2332 || pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1 |
2333 || pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster - 1].sMana > 0 )//*(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster + 10] > 0 ) | |
0 | 2334 { |
723 | 2335 pZ -= 30; |
0 | 2336 v113 -= 30; |
2337 pParty->uFallSpeed = 0; | |
1424 | 2338 //pParty->uFallSpeed = 0; |
0 | 2339 pParty->bFlying = 1; |
1424 | 2340 pModel = (BSPModel *)1; |
723 | 2341 if ( pZ <= v111 ) |
0 | 2342 { |
2343 pParty->bFlying = 0; | |
2344 pPartyActionQueue->uNumActions = 0; | |
2345 } | |
2346 } | |
2347 } | |
139 | 2348 break; |
2349 | |
0 | 2350 case PARTY_TurnLeft: |
139 | 2351 if (uTurnSpeed) |
2352 _angle_y += uTurnSpeed; //descrete turn | |
2353 else | |
2354 _angle_y += dturn * fTurnSpeedMultiplier; // time-based smooth turn | |
2355 | |
2356 _angle_y &= stru_5C6E00->uDoublePiMask; | |
2357 break; | |
122 | 2358 |
2359 case PARTY_TurnRight: | |
139 | 2360 if (uTurnSpeed) |
2361 _angle_y -= uTurnSpeed; | |
2362 else | |
2363 _angle_y -= dturn * fTurnSpeedMultiplier; | |
2364 | |
2365 _angle_y &= stru_5C6E00->uDoublePiMask; | |
2366 break; | |
122 | 2367 |
2368 case PARTY_FastTurnLeft: | |
139 | 2369 if (uTurnSpeed) |
2370 _angle_y += uTurnSpeed; | |
2371 else | |
2372 _angle_y += 2.0f * fTurnSpeedMultiplier * (double)dturn; | |
2373 | |
2374 _angle_y &= stru_5C6E00->uDoublePiMask; | |
2375 break; | |
122 | 2376 |
0 | 2377 case PARTY_FastTurnRight: |
139 | 2378 if (!uTurnSpeed) |
2379 _angle_y -= 2.0f * fTurnSpeedMultiplier * (double)dturn; | |
2380 else | |
2381 _angle_y -= uTurnSpeed; | |
2382 | |
2383 _angle_y &= stru_5C6E00->uDoublePiMask; | |
2384 break; | |
122 | 2385 |
0 | 2386 case PARTY_StrafeLeft: |
139 | 2387 { |
2388 *(float *)&v128 = pParty->uWalkSpeed; | |
2389 | |
2390 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0); | |
2391 int dx = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier; | |
2392 v2 -= 3 * dx / 4; | |
2393 | |
2394 float cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0); | |
2395 int dy = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier; | |
2396 v1 += 3 * dy / 4; | |
2397 | |
2398 v128 = v1; | |
2399 v124 = 1; | |
2400 } | |
2401 break; | |
2402 | |
0 | 2403 case PARTY_StrafeRight: |
139 | 2404 { |
2405 *(float *)&v128 = pParty->uWalkSpeed; | |
140 | 2406 |
139 | 2407 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0); |
2408 int dx = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier; | |
2409 v2 += 3 * dx / 4; | |
2410 | |
2411 float cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0); | |
2412 int dy = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier; | |
2413 v1 -= 3 * dy / 4; | |
2414 | |
2415 v128 = v1; | |
2416 v124 = 1; | |
2417 } | |
2418 break; | |
2419 | |
0 | 2420 case PARTY_WalkForward: |
140 | 2421 { |
2422 *(float *)&v128 = _walk_speed; | |
2423 | |
2424 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0), | |
2425 cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0); | |
2426 | |
2427 int dx = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier; | |
433 | 2428 v2 += dx * 12; |
140 | 2429 |
2430 int dy = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier; | |
433 | 2431 v1 += dy * 12; |
140 | 2432 |
139 | 2433 v128 = v1; |
2434 v124 = 1; | |
140 | 2435 } |
139 | 2436 break; |
2437 | |
0 | 2438 case PARTY_RunForward: |
140 | 2439 { |
2440 *(float *)&v128 = _walk_speed; | |
2441 | |
2442 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0), | |
2443 cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0); | |
2444 | |
1424 | 2445 int dx = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier; |
140 | 2446 int dy = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier; |
2447 | |
2448 if (pParty->bFlying) | |
2449 { | |
2450 v2 += 4 * dx; | |
2451 v1 += 4 * dy; | |
2452 | |
2453 v128 = v1; | |
2454 } | |
1413 | 2455 else if (partyAtHighSlope && !bmodel_standing_on_pid) |
140 | 2456 { |
2457 v2 += dx; | |
2458 v1 += dy; | |
2459 | |
139 | 2460 v128 = v1; |
2461 v124 = 1; | |
140 | 2462 } |
2463 else | |
2464 { | |
2465 v2 += 2 * dx; | |
2466 v1 += 2 * dy; | |
2467 | |
2468 v128 = v1; | |
2469 v114 = 1; | |
2470 } | |
2471 } | |
2472 break; | |
2473 | |
2474 | |
2475 case PARTY_WalkBackward: | |
2476 { | |
2477 *(float *)&v128 = _walk_speed; | |
2478 | |
2479 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0), | |
2480 cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0); | |
2481 | |
2482 int dx = cos_y * pParty->uWalkSpeed * fBackwardWalkSpeedMultiplier; | |
2483 v2 -= dx; | |
2484 | |
2485 int dy = sin_y * pParty->uWalkSpeed * fBackwardWalkSpeedMultiplier; | |
2486 v1 -= dy; | |
2487 | |
0 | 2488 v128 = v1; |
140 | 2489 v124 = 1; |
2490 } | |
2491 break; | |
2492 | |
139 | 2493 |
0 | 2494 case PARTY_RunBackward: |
140 | 2495 { |
2496 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0), | |
2497 cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0); | |
2498 | |
2499 int dx = cos_y * pParty->uWalkSpeed * fBackwardWalkSpeedMultiplier; | |
2500 int dy = sin_y * pParty->uWalkSpeed * fBackwardWalkSpeedMultiplier; | |
2501 | |
2502 if (pParty->bFlying) | |
2503 { | |
2504 v2 -= 4 * dx; | |
2505 v1 -= 4 * dy; | |
0 | 2506 v128 = v1; |
2507 } | |
2508 else | |
2509 { | |
140 | 2510 v2 -= dx; |
2511 v1 -= dy; | |
2512 | |
0 | 2513 v128 = v1; |
2514 v124 = 1; | |
2515 } | |
140 | 2516 } |
2517 break; | |
2518 | |
2519 case PARTY_CenterView: | |
2520 _angle_x = 0; | |
2521 break; | |
2522 | |
0 | 2523 case PARTY_LookUp: |
2524 _angle_x += (signed __int64)(flt_6BE150_look_up_down_dangle * 25.0); | |
2525 if ( _angle_x > 128 ) | |
2526 _angle_x = 128; | |
140 | 2527 if (uActiveCharacter) |
187 | 2528 pPlayers[uActiveCharacter]->PlaySound(SPEECH_63, 0); |
140 | 2529 break; |
2530 | |
0 | 2531 case PARTY_LookDown: |
2532 _angle_x += (signed __int64)(flt_6BE150_look_up_down_dangle * -25.0); | |
2533 if ( _angle_x < -128 ) | |
2534 _angle_x = -128; | |
140 | 2535 if (uActiveCharacter) |
187 | 2536 pPlayers[uActiveCharacter]->PlaySound(SPEECH_64, 0); |
140 | 2537 break; |
2538 | |
0 | 2539 case PARTY_Jump: |
1413 | 2540 if ( (!partyAtHighSlope || bmodel_standing_on_pid) && !bJumping && pParty->field_24 && !(pParty->uFlags & 4) && !(BYTE1(pParty->uFlags) & 2) ) |
0 | 2541 { |
2542 v126 = pParty->field_24 << 6; | |
2543 bJumping = 1; | |
1424 | 2544 pParty->uFallSpeed = (signed __int64)((double)(pParty->field_24 << 6) * 1.5 + (double)pParty->uFallSpeed); |
0 | 2545 } |
140 | 2546 break; |
2547 | |
0 | 2548 default: |
140 | 2549 assert(false); |
2550 | |
0 | 2551 case PARTY_Land: |
140 | 2552 if (pParty->bFlying) |
0 | 2553 { |
141 | 2554 pParty->uFlags |= PARTY_FLAGS_1_LANDING; |
0 | 2555 pParty->uFallSpeed = 0; |
2556 } | |
140 | 2557 pParty->bFlying = false; |
0 | 2558 pPartyActionQueue->uNumActions = 0; |
140 | 2559 break; |
2560 } | |
2561 } | |
2562 | |
1061 | 2563 //LABEL_123: |
0 | 2564 pParty->sRotationY = _angle_y; |
2565 pParty->sRotationX = _angle_x; | |
1061 | 2566 if ( pZ < v111 || pParty->bFlying) |
0 | 2567 { |
2568 if ( pParty->bFlying ) | |
2569 { | |
1424 | 2570 v126 = stru_5C6E00->Cos(GetTickCount()); |
0 | 2571 v129 = (unsigned __int64)(4i64 * v126) >> 16; |
723 | 2572 pZ = v113 + v129; |
1424 | 2573 if ( pModel ) |
723 | 2574 pZ = v113; |
141 | 2575 if (pParty->FlyActive()) |
1167 | 2576 stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] &= 0xFEu; |
723 | 2577 pParty->uFallStartY = pZ; |
1061 | 2578 } |
1424 | 2579 else |
2580 { | |
2581 if ( is_on_water && pParty->uFallSpeed ) | |
2582 sub_42F960_create_object(pX, pY, v111); | |
2583 pParty->uFallSpeed = 0; | |
2584 pZ = v111; | |
2585 pParty->uFallStartY = v111; | |
2586 v113 = pZ; | |
2587 if (pParty->FlyActive()) | |
2588 stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] |= 1u; | |
2589 } | |
1061 | 2590 } |
2591 else | |
2592 { | |
2593 v113 = pZ; | |
2594 if (pParty->FlyActive()) | |
1167 | 2595 stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] |= 1u; |
1061 | 2596 } |
2597 //LABEL_141: | |
141 | 2598 if (bJumping && !pParty->bFlying) |
0 | 2599 { |
2600 v33 = -(pEventTimer->uTimeElapsed * GetGravityStrength()); | |
1424 | 2601 v34 = pParty->uFallSpeed + 2 * v33; |
2602 pParty->uFallSpeed += 2 * v33; | |
1061 | 2603 } |
2604 else if (!partyAtHighSlope) | |
0 | 2605 { |
1424 | 2606 v34 = pParty->uFallSpeed; |
1061 | 2607 } |
2608 else if (!bJumping) | |
2609 { | |
1413 | 2610 if ( !bmodel_standing_on_pid ) |
1061 | 2611 { |
2612 // rolling down the hill | |
2613 // how it's done: you get a little bit pushed in the air along terrain normal, getting in the air | |
2614 // and falling to the gravity, gradually sliding downwards. nice trick | |
2615 pZ = v111; | |
2616 ODM_GetTerrainNormalAt(pX, pY, &v98); | |
1424 | 2617 v35 = pParty->uFallSpeed + -8 * pEventTimer->uTimeElapsed * GetGravityStrength(); |
1061 | 2618 v129 = abs((signed __int64)v2 * v98.x + (signed __int64)v1 * v98.y + (signed __int64)v35 * v98.z) >> 16; |
2619 v2 += (unsigned __int64)(v129 * (signed __int64)v98.x) >> 16; | |
2620 v1 += (unsigned __int64)(v129 * (signed __int64)v98.y) >> 16; | |
2621 v34 = v35 + ((unsigned __int64)(v129 * (signed __int64)v98.z) >> 16); | |
2622 v128 = v1; | |
1424 | 2623 pParty->uFallSpeed = v34; |
1061 | 2624 } |
2625 } | |
2626 else | |
1424 | 2627 v34 = pParty->uFallSpeed; |
1061 | 2628 |
2629 //LABEL_164: | |
1070 | 2630 if(bJumping) |
2631 { | |
2632 if ( !bUnderwater && v34 <= 0) | |
2633 { | |
2634 if ( v34 < -500 | |
2635 && !pParty->bFlying | |
2636 && pParty->vPosition.z - v111 > 1000 | |
2637 && !pParty->FeatherFallActive()) | |
2638 { // falling scream | |
2639 for (int i = 0; i < 4; ++i) | |
2640 { | |
2641 auto player = pParty->pPlayers + i; | |
1080 | 2642 if (!player->HasEnchantedItemEquipped(72) && !player->WearsItem(ITEM_ARTIFACT_HERMES_SANDALS, EQUIP_BOOTS) && player->CanAct()) |
1070 | 2643 player->PlaySound(SPEECH_66, 0); |
2644 } | |
2645 } | |
2646 } | |
141 | 2647 } |
2648 else | |
2649 { | |
1061 | 2650 //LABEL_150: |
723 | 2651 pParty->uFallStartY = pZ; |
141 | 2652 } |
2653 | |
138 | 2654 if ( v2 * v2 + v1 * v1 < 400 && !partyAtHighSlope ) |
0 | 2655 { |
2656 *(float *)&v128 = 0.0; | |
2657 v2 = 0; | |
2658 } | |
2659 stru_721530.field_84 = -1; | |
2660 stru_721530.field_70 = 0; | |
1546 | 2661 stru_721530.prolly_normal_d = pParty->field_14_radius; |
2662 stru_721530.field_8_radius = pParty->field_14_radius >> 1; | |
0 | 2663 v126 = 0; |
2664 stru_721530.field_0 = 1; | |
1546 | 2665 stru_721530.height = pParty->uPartyHeight - 32; |
0 | 2666 do |
2667 { | |
1546 | 2668 stru_721530.position.x = pX; |
723 | 2669 stru_721530.normal.x = pX; |
1546 | 2670 stru_721530.velocity.x = v2; |
2671 stru_721530.position.y = pY; | |
723 | 2672 stru_721530.normal.y = pY; |
2673 stru_721530.normal.z = stru_721530.prolly_normal_d + pZ + 1; | |
1546 | 2674 stru_721530.position.z = stru_721530.height + pZ + 1; |
2675 stru_721530.velocity.y = v128; | |
2676 stru_721530.velocity.z = pParty->uFallSpeed; | |
0 | 2677 v36 = 0; |
2678 stru_721530.uSectorID = 0; | |
1340 | 2679 if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->turn_stage == 3 ) |
0 | 2680 v36 = 13312; |
2681 if ( stru_721530._47050A(v36) ) | |
2682 break; | |
2683 _46E889_collide_against_bmodels(1u); | |
2684 v37 = WorldPosToGridCellZ(pParty->vPosition.y); | |
2685 v38 = WorldPosToGridCellX(pParty->vPosition.x); | |
2686 _46E26D_collide_against_sprites(v38, v37); | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
2687 _46ED8A_collide_against_sprite_objects(4u); |
0 | 2688 for ( i = 0; i < (signed int)uNumActors; ++i ) |
2689 _46DF1A_collide_against_actor(i, 0); | |
2690 if ( stru_721530.field_7C >= stru_721530.field_6C ) | |
2691 { | |
2692 _angle_x = stru_721530.normal2.x; | |
2693 _angle_y = stru_721530.normal2.y; | |
2694 v40 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1; | |
2695 } | |
2696 else | |
2697 { | |
1546 | 2698 _angle_x = pX + fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.x); |
2699 _angle_y = pY + fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.y); | |
2700 pModel = (BSPModel *)fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.z); | |
2701 v40 = fixpoint_sub0(stru_721530.field_7C, stru_721530.direction.z) + pZ; | |
0 | 2702 } |
2703 v122 = v40; | |
1413 | 2704 ODM_GetFloorLevel(_angle_x, _angle_y, v40, pParty->uPartyHeight, &is_on_water, &bmodel_standing_on_pid, 0); |
2705 v129 = ODM_GetFloorLevel(_angle_x, pY, v40, pParty->uPartyHeight, &is_on_water, &v97, 0); | |
2706 auto v119 = ODM_GetFloorLevel(pX, _angle_y, v40, pParty->uPartyHeight, &is_on_water, &v110, 0); | |
1424 | 2707 pModel = (BSPModel *)IsTerrainSlopeTooHigh(_angle_x, pY); |
723 | 2708 v42 = IsTerrainSlopeTooHigh(pX, _angle_y); |
1413 | 2709 is_not_on_bmodel = false; |
0 | 2710 v118 = v42; |
1413 | 2711 if ( !v97 && !v110 && !bmodel_standing_on_pid ) |
2712 is_not_on_bmodel = true; | |
0 | 2713 v43 = 1; |
2714 v44 = 1; | |
1413 | 2715 if ( bUnderwater || !is_not_on_bmodel ) |
1061 | 2716 { |
2717 pX = _angle_x; | |
2718 if ( v43 ) | |
2719 pY = _angle_y; | |
2720 } | |
2721 else | |
2722 { | |
1424 | 2723 if ( pModel && v129 > pZ ) |
1061 | 2724 v44 = 0; |
2725 if ( v118 && v119 > pZ ) | |
2726 v43 = 0; | |
2727 if ( v44 ) | |
2728 { | |
2729 pX = _angle_x; | |
2730 if ( v43 ) | |
2731 pY = _angle_y; | |
2732 } | |
2733 else if ( v43 ) | |
2734 pY = _angle_y; | |
2735 else | |
2736 { | |
1424 | 2737 pModel = (BSPModel *)ODM_GetFloorLevel(_angle_x, _angle_y, v40, pParty->uPartyHeight, &is_on_water, &bmodel_standing_on_pid, 0); |
2738 if ( IsTerrainSlopeTooHigh(_angle_x, _angle_y) && (signed int)pModel <= pZ ) | |
1061 | 2739 { |
2740 v43 = 1; | |
2741 pX = _angle_x; | |
2742 if ( v43 ) | |
2743 pY = _angle_y; | |
2744 } | |
2745 } | |
2746 } | |
0 | 2747 if ( stru_721530.field_7C >= stru_721530.field_6C ) |
2748 { | |
1413 | 2749 if ( !is_not_on_bmodel ) |
0 | 2750 { |
723 | 2751 pX = stru_721530.normal2.x; |
2752 pY = stru_721530.normal2.y; | |
2753 } | |
2754 pZ = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1; | |
0 | 2755 break; |
2756 } | |
2757 stru_721530.field_70 += stru_721530.field_7C; | |
723 | 2758 pX = _angle_x; |
2759 pY = _angle_y; | |
0 | 2760 v45 = stru_721530.uFaceID; |
723 | 2761 pZ = v40; |
848 | 2762 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Actor) |
141 | 2763 { |
2764 if (pParty->Invisible()) | |
2765 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); | |
2766 | |
0 | 2767 viewparams->bRedrawGameUI = 1; |
1061 | 2768 v2 = (unsigned __int64)(58500i64 * v2) >> 16; |
1424 | 2769 pModel = (BSPModel *)58500; |
1061 | 2770 v128 = (unsigned __int64)(58500i64 * v128) >> 16; |
1424 | 2771 v122 = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16; |
1061 | 2772 ++v126; |
1424 | 2773 pParty->uFallSpeed = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16; |
1061 | 2774 continue; |
2775 } | |
848 | 2776 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Decoration) |
0 | 2777 { |
295 | 2778 v56 = integer_sqrt(v2 * v2 + v128 * v128); |
0 | 2779 v118 = v56; |
1413 | 2780 v57 = stru_5C6E00->Atan2(_angle_x - pLevelDecorations[(signed int)stru_721530.uFaceID >> 3].vPosition.x, |
2781 _angle_y - pLevelDecorations[(signed int)stru_721530.uFaceID >> 3].vPosition.y); | |
0 | 2782 v129 = v57; |
323 | 2783 v58 = (BSPModel *)stru_5C6E00->Cos(v57); |
1424 | 2784 pModel = v58; |
0 | 2785 v59 = (signed int)v58 * (signed __int64)v56; |
2786 v122 = v59 >> 16; | |
2787 v2 = v59 >> 16; | |
323 | 2788 v60 = (BSPModel *)stru_5C6E00->Sin(v129); |
1424 | 2789 pModel = v60; |
0 | 2790 v61 = (signed int)v60 * (signed __int64)v118; |
2791 v122 = v61 >> 16; | |
2792 v128 = v61 >> 16; | |
2793 } | |
2794 else | |
2795 { | |
848 | 2796 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_BModel) |
0 | 2797 { |
2798 pParty->bFlying = 0; | |
1424 | 2799 pModel = &pOutdoor->pBModels[(signed int)stru_721530.uFaceID >> 9]; |
2800 //v127 = v46; | |
2801 pODMFace = &pModel->pFaces[((signed int)stru_721530.uFaceID >> 3) & 0x3F]; | |
2802 v48 = pODMFace->pBoundingBox.z2 - pODMFace->pBoundingBox.z1; | |
0 | 2803 v51 = __OFSUB__(v48, 32); |
2804 v49 = v48 == 32; | |
2805 v50 = v48 - 32 < 0; | |
1424 | 2806 v52 = pODMFace->pFacePlane.vNormal.z; |
0 | 2807 v129 = (unsigned __int8)(v50 ^ v51 | v49); |
122 | 2808 v119 = v52 < 46378; |
0 | 2809 if ( bUnderwater == 1 ) |
2810 v119 = 0; | |
1424 | 2811 if ( pODMFace->uPolygonType == POLYGON_Floor ) |
0 | 2812 { |
1424 | 2813 if ( pParty->uFallSpeed < 0 ) |
2814 pParty->uFallSpeed = 0; | |
2815 pZ = pModel->pVertices.pVertices[pODMFace->pVertexIDs[0]].z + 1; | |
2816 if ( v2 * v2 + v128 * v128 < 400 ) | |
2817 { | |
2818 v2 = 0; | |
2819 *(float *)&v128 = 0.0; | |
2820 } | |
2821 if ( pParty->floor_face_pid != v45 && (pODMFace->uAttributes & FACE_PRESSURE_PLATE)) | |
2822 { | |
2823 pParty->floor_face_pid = v45; | |
2824 v103 = pODMFace->sCogTriggeredID; | |
2825 } | |
2826 v2 = (unsigned __int64)(58500i64 * v2) >> 16; | |
2827 pModel = (BSPModel *)58500; | |
2828 v128 = (unsigned __int64)(58500i64 * v128) >> 16; | |
2829 v122 = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16; | |
2830 ++v126; | |
2831 pParty->uFallSpeed = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16; | |
2832 continue; | |
0 | 2833 } |
1424 | 2834 if ( !v129 && (pODMFace->uPolygonType != POLYGON_InBetweenFloorAndWall || v119) )// |
0 | 2835 { |
1424 | 2836 v118 = abs(v128 * pODMFace->pFacePlane.vNormal.y + pParty->uFallSpeed * v52 + v2 * pODMFace->pFacePlane.vNormal.x) >> 16; |
1546 | 2837 if ((stru_721530.speed >> 3) > v118 ) |
2838 v118 = stru_721530.speed >> 3; | |
1424 | 2839 v129 = (unsigned __int64)(v118 * (signed __int64)pODMFace->pFacePlane.vNormal.x) >> 16; |
2840 _walk_speed = (unsigned __int64)(v118 * (signed __int64)pODMFace->pFacePlane.vNormal.y) >> 16; | |
0 | 2841 v54 = 0; |
2842 if ( !v119 ) | |
2843 { | |
1424 | 2844 pModel = (BSPModel *)pODMFace->pFacePlane.vNormal.z; |
2845 pModel = (BSPModel *)((unsigned __int64)(v118 * (signed __int64)(signed int)pModel) >> 16); | |
2846 v54 = pModel; | |
0 | 2847 } |
1424 | 2848 pParty->uFallSpeed += (int)v54; |
0 | 2849 v128 += _walk_speed; |
2850 v2 += v129; | |
2851 v55 = stru_721530.prolly_normal_d | |
1424 | 2852 - ((signed int)(pODMFace->pFacePlane.dist |
2853 + v122 * pODMFace->pFacePlane.vNormal.z | |
2854 + _angle_y * pODMFace->pFacePlane.vNormal.y | |
2855 + _angle_x * pODMFace->pFacePlane.vNormal.x) >> 16); | |
0 | 2856 if ( v55 > 0 ) |
2857 { | |
1424 | 2858 pX = _angle_x + (pODMFace->pFacePlane.vNormal.x * v55 >> 16); |
2859 pY = _angle_y + (pODMFace->pFacePlane.vNormal.y * v55 >> 16); | |
0 | 2860 if ( !v119 ) |
1424 | 2861 pZ = v122 + (pODMFace->pFacePlane.vNormal.z * v55 >> 16); |
0 | 2862 } |
1061 | 2863 //LABEL_220: |
2864 v45 = stru_721530.uFaceID; | |
1424 | 2865 if ( pParty->floor_face_pid != v45 && BYTE3(pODMFace->uAttributes) & 4 ) |
1061 | 2866 { |
2867 pParty->floor_face_pid = v45; | |
1424 | 2868 v103 = pODMFace->sCogTriggeredID; |
1061 | 2869 } |
2870 v2 = (unsigned __int64)(58500i64 * v2) >> 16; | |
1424 | 2871 pModel = (BSPModel *)58500; |
1061 | 2872 v128 = (unsigned __int64)(58500i64 * v128) >> 16; |
1424 | 2873 v122 = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16; |
1061 | 2874 ++v126; |
1424 | 2875 pParty->uFallSpeed = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16; |
1061 | 2876 continue; |
0 | 2877 } |
1424 | 2878 v118 = abs(v128 * pODMFace->pFacePlane.vNormal.y + pParty->uFallSpeed * v52 + v2 * pODMFace->pFacePlane.vNormal.x) >> 16; |
1546 | 2879 if ((stru_721530.speed >> 3) > v118 ) |
2880 v118 = stru_721530.speed >> 3; | |
1424 | 2881 v122 = pODMFace->pFacePlane.vNormal.x; |
0 | 2882 v122 = (unsigned __int64)(v118 * (signed __int64)(signed int)v122) >> 16; |
1424 | 2883 pModel = (BSPModel *)pODMFace->pFacePlane.vNormal.y; |
2884 pModel = (BSPModel *)((unsigned __int64)(v118 * (signed __int64)(signed int)pModel) >> 16); | |
2885 v129 = pODMFace->pFacePlane.vNormal.z; | |
0 | 2886 v129 = (unsigned __int64)(v118 * (signed __int64)v129) >> 16; |
1424 | 2887 pParty->uFallSpeed += v129; |
0 | 2888 v2 += v122; |
1424 | 2889 v128 += (int)pModel; |
0 | 2890 if ( v2 * v2 + v128 * v128 >= 400 ) |
1061 | 2891 { |
2892 v45 = stru_721530.uFaceID; | |
1424 | 2893 if ( pParty->floor_face_pid != v45 && BYTE3(pODMFace->uAttributes) & 4 ) |
1061 | 2894 { |
2895 pParty->floor_face_pid = v45; | |
1424 | 2896 v103 = pODMFace->sCogTriggeredID; |
1061 | 2897 } |
2898 v2 = (unsigned __int64)(58500i64 * v2) >> 16; | |
1424 | 2899 pModel = (BSPModel *)58500; |
1061 | 2900 v128 = (unsigned __int64)(58500i64 * v128) >> 16; |
1424 | 2901 v122 = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16; |
1061 | 2902 ++v126; |
1424 | 2903 pParty->uFallSpeed = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16; |
1061 | 2904 continue; |
2905 } | |
0 | 2906 v2 = 0; |
1424 | 2907 pParty->uFallSpeed = 0; |
0 | 2908 *(float *)&v128 = 0.0; |
2909 } | |
2910 } | |
1061 | 2911 //LABEL_234: |
0 | 2912 v2 = (unsigned __int64)(58500i64 * v2) >> 16; |
1424 | 2913 pModel = (BSPModel *)58500; |
0 | 2914 v128 = (unsigned __int64)(58500i64 * v128) >> 16; |
1424 | 2915 v122 = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16; |
0 | 2916 ++v126; |
1424 | 2917 pParty->uFallSpeed = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16; |
0 | 2918 } |
2919 while ( v126 < 100 ); | |
831 | 2920 if ( bWalkSound && pParty->walk_sound_timer <= 0 ) |
0 | 2921 { |
723 | 2922 v122 = abs(pParty->vPosition.x - pX); |
2923 v126 = abs(pParty->vPosition.y - pY); | |
2924 v62 = abs(pParty->vPosition.z - pZ); | |
295 | 2925 if ( integer_sqrt(v122 * v122 + v126 * v126 + v62 * v62) < 8 ) |
1061 | 2926 { |
2927 pAudioPlayer->_4AA258(804); | |
2928 pParty->walk_sound_timer = 64; | |
2929 } | |
2930 else | |
2931 { | |
2932 if ( v114 && (!bJumping || v101) ) | |
2933 { | |
1413 | 2934 if ( !is_not_on_bmodel |
1061 | 2935 && !(BYTE1(pOutdoor->pBModels[pParty->floor_face_pid >> 9].pFaces[(pParty->floor_face_pid >> 3) & 0x3F].uAttributes) & 0x20) ) |
2936 { | |
1424 | 2937 pAudioPlayer->PlaySound(SOUND_64, 804, 1, -1, 0, 0, 0, 0); |
1061 | 2938 } |
2939 else | |
2940 { | |
1424 | 2941 //v63 = WorldPosToGridCellZ(pParty->vPosition.y) - 1; |
2942 //v64 = WorldPosToGridCellX(pParty->vPosition.x); | |
2943 v87 = pOutdoor->GetSoundIdByPosition(WorldPosToGridCellX(pParty->vPosition.x), WorldPosToGridCellZ(pParty->vPosition.y) - 1, 1); | |
1398 | 2944 pAudioPlayer->PlaySound((SoundID)v87, 804, 1, -1, 0, 0, 0, 0); |
1061 | 2945 } |
2946 } | |
2947 else | |
2948 { | |
2949 if ( v124 && (!bJumping || v101) ) | |
2950 { | |
1413 | 2951 if ( is_not_on_bmodel |
1061 | 2952 || BYTE1(pOutdoor->pBModels[pParty->floor_face_pid >> 9].pFaces[(pParty->floor_face_pid >> 3) & 0x3F].uAttributes) & 0x20 ) |
2953 { | |
1424 | 2954 //v63 = WorldPosToGridCellZ(pParty->vPosition.y) - 1; |
2955 //v64 = WorldPosToGridCellX(pParty->vPosition.x); | |
2956 v87 = pOutdoor->GetSoundIdByPosition(WorldPosToGridCellX(pParty->vPosition.x), WorldPosToGridCellZ(pParty->vPosition.y) - 1, 0); | |
1398 | 2957 pAudioPlayer->PlaySound((SoundID)v87, 804, 1, -1, 0, 0, 0, 0); |
1061 | 2958 } |
2959 else | |
1424 | 2960 pAudioPlayer->PlaySound(SOUND_103, 804, 1, -1, 0, 0, 0, 0); |
1061 | 2961 } |
2962 else | |
2963 { | |
2964 pAudioPlayer->_4AA258(804); | |
2965 pParty->walk_sound_timer = 64; | |
2966 } | |
2967 } | |
0 | 2968 } |
2969 } | |
2970 if ( !bJumping || v101 ) | |
569 | 2971 pParty->uFlags &= ~PARTY_FLAGS_1_FALLING; |
2972 else | |
2973 pParty->uFlags |= PARTY_FLAGS_1_FALLING; | |
0 | 2974 v126 = WorldPosToGridCellX(pParty->vPosition.x); |
2975 v65 = WorldPosToGridCellZ(pParty->vPosition.y) - 1; | |
723 | 2976 v114 = WorldPosToGridCellX(pX); |
2977 v66 = WorldPosToGridCellZ(pY) - 1; | |
1424 | 2978 pModel = (BSPModel *)((~(unsigned int)pOutdoor->ActuallyGetSomeOtherTileInfo(v126, v65) >> 1) & 1); |
1413 | 2979 v122 = (~(unsigned int)pOutdoor->ActuallyGetSomeOtherTileInfo(v114, v65) >> 1) & 1; |
0 | 2980 v67 = pOutdoor->ActuallyGetSomeOtherTileInfo(v126, v66); |
2981 v68 = 0; | |
1413 | 2982 v69 = (~(unsigned int)v67 >> 1) & 1; |
0 | 2983 if ( v114 == v126 && v66 == v65 && v122 && v69 ) |
2984 v68 = 1; | |
1413 | 2985 if ( !is_not_on_bmodel ) |
0 | 2986 v68 = 1; |
2987 if ( v68 ) | |
2988 { | |
723 | 2989 v70 = pZ; |
2990 v71 = pX; | |
2991 v72 = pY; | |
1424 | 2992 //pParty->uFallSpeed = v121; |
723 | 2993 v73 = pZ; |
2994 pParty->vPosition.x = pX; | |
2995 pParty->vPosition.y = pY; | |
2996 pParty->vPosition.z = pZ; | |
0 | 2997 pParty->field_6F0 = v113; |
723 | 2998 if ( pZ > 8160 ) |
0 | 2999 { |
3000 v73 = 8160; | |
3001 pParty->uFallStartY = 8160; | |
3002 pParty->vPosition.z = 8160; | |
3003 } | |
3004 if ( !v103 | |
3005 || (EventProcessor(v103, 0, 1), pParty->vPosition.x == v71) | |
3006 && pParty->vPosition.y == v72 | |
3007 && (v73 = pParty->vPosition.z, pParty->vPosition.z == v70) ) | |
3008 { | |
3009 if ( v73 < v111 ) | |
3010 { | |
3011 pParty->uFallSpeed = 0; | |
3012 v73 = v105; | |
3013 pParty->vPosition.z = v105; | |
1424 | 3014 if ( pParty->uFallStartY - v70 > 512 && !bFeatherFall && v70 <= v105 && !bUnderwater )//Fall to the ground( ) |
0 | 3015 { |
569 | 3016 if ( pParty->uFlags & PARTY_FLAGS_1_LANDING ) |
3017 { | |
3018 pParty->uFlags &= ~PARTY_FLAGS_1_LANDING; | |
0 | 3019 } |
3020 else | |
3021 { | |
1424 | 3022 for ( uint i = 1; i <= 4; ++i ) |
0 | 3023 { |
1424 | 3024 v110 = pPlayers[i]->GetMaxHealth(); |
3025 pPlayers[i]->ReceiveDamage((signed int)((pParty->uFallStartY - v70) * (unsigned __int64)(signed __int64)((double)v110 * 0.1)) / 256, | |
1036 | 3026 DMGT_PHISYCAL); |
1424 | 3027 v110 = 20 - pPlayers[i]->GetParameterBonus(pPlayers[i]->GetActualEndurance()); |
3028 pPlayers[i]->SetRecoveryTime((signed __int64)((double)v110 * flt_6BE3A4_debug_recmod1 * 2.133333333333333)); | |
0 | 3029 } |
3030 v73 = pParty->vPosition.z; | |
3031 } | |
3032 } | |
3033 pParty->uFallStartY = v70; | |
3034 } | |
3035 if ( v102 && v73 < v109 ) | |
3036 { | |
3037 if ( (signed int)(pParty->uPartyHeight + v73) >= v109 ) | |
3038 { | |
3039 pParty->vPosition.z = v109 - pParty->uPartyHeight - 1; | |
3040 pParty->field_6F0 = v109 - pParty->uPartyHeight - 1; | |
3041 } | |
3042 } | |
569 | 3043 pParty->uFlags &= ~0x204; |
0 | 3044 } |
3045 return; | |
3046 } | |
3047 v76 = pParty->bFlying; | |
1424 | 3048 if ( pParty->bFlying || v101 == 0 || bWaterWalk || !pModel ) |
0 | 3049 v77 = 1; |
3050 else | |
3051 v77 = v122 != 0; | |
3052 v114 = 0; | |
3053 if ( !pParty->bFlying && v101 != 0 && !bWaterWalk ) | |
3054 { | |
1424 | 3055 if ( pModel ) |
0 | 3056 { |
3057 v78 = v69 != 0; | |
1061 | 3058 } |
3059 else | |
3060 { | |
3061 v114 = 1; | |
3062 v78 = 1; | |
3063 } | |
3064 } | |
3065 else | |
3066 v78 = 1; | |
3067 //LABEL_306: | |
0 | 3068 if ( v77 ) |
3069 { | |
723 | 3070 pParty->vPosition.x = pX; |
0 | 3071 } |
3072 if ( v78 ) | |
3073 { | |
723 | 3074 pParty->vPosition.y = pY; |
1061 | 3075 } |
3076 if ( v78 || v77) | |
3077 { | |
0 | 3078 if ( bWaterWalk ) |
3079 { | |
569 | 3080 pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER; |
1167 | 3081 //v79 = 20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID + 6180178; |
3082 //*(short *)&stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID + 119] |= 1u; | |
3083 v79 = (int)&stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID + 119]; | |
569 | 3084 *(short *)v79 |= 1u; |
0 | 3085 if ( !v122 || !v69 ) |
3086 { | |
3087 if ( !v76 ) | |
3088 { | |
3089 v80 = *(short *)v79; | |
569 | 3090 pParty->uFlags |= PARTY_FLAGS_1_STANDING_ON_WATER; |
0 | 3091 *(short *)v79 = v80 & 0xFFFE; |
3092 } | |
3093 } | |
3094 } | |
1061 | 3095 } |
3096 else if ( bWalkSound && pParty->walk_sound_timer <= 0 ) | |
0 | 3097 { |
3098 pAudioPlayer->_4AA258(804); | |
831 | 3099 pParty->walk_sound_timer = 64; |
0 | 3100 } |
1061 | 3101 //LABEL_318: |
723 | 3102 v81 = pZ; |
3103 v82 = pZ; | |
3104 pParty->vPosition.z = pZ; | |
3105 if ( pZ > 8160 ) | |
0 | 3106 { |
3107 v82 = 8160; | |
3108 pParty->uFallStartY = 8160; | |
3109 pParty->vPosition.z = 8160; | |
3110 } | |
3111 LOWORD(pParty->uFlags) &= 0xFDFBu; | |
1424 | 3112 //pParty->uFallSpeed = v121; |
0 | 3113 pParty->field_6F0 = v113; |
1424 | 3114 if ( v114 )//party stand to the water( ) |
3115 { | |
3116 pTerrainHeight = GetTerrainHeightsAroundParty2(pParty->vPosition.x, pParty->vPosition.y, &v110, 1); | |
3117 if ( pParty->vPosition.z <= pTerrainHeight + 1 )// +1 | |
3118 pParty->uFlags |= PARTY_FLAGS_1_WATER_DAMAGE; | |
0 | 3119 } |
3120 if ( !v103 | |
723 | 3121 || (EventProcessor(v103, 0, 1), pParty->vPosition.x == pX) |
3122 && pParty->vPosition.y == pY | |
0 | 3123 && (v82 = pParty->vPosition.z, pParty->vPosition.z == v81) ) |
3124 { | |
3125 if ( v82 < v111 ) | |
3126 { | |
3127 v82 = v105; | |
3128 pParty->uFallSpeed = 0; | |
3129 pParty->vPosition.z = v105; | |
1424 | 3130 if ( pParty->uFallStartY - v81 > 512 && !bFeatherFall && v81 <= v105 && !bUnderwater )//Fall to the water( ) |
0 | 3131 { |
569 | 3132 if ( pParty->uFlags & PARTY_FLAGS_1_LANDING ) |
3133 { | |
3134 pParty->uFlags &= ~PARTY_FLAGS_1_LANDING; | |
0 | 3135 } |
3136 else | |
3137 { | |
1424 | 3138 for ( uint i = 1; i <= 4; ++i ) |
0 | 3139 { |
1424 | 3140 v110 = pPlayers[i]->GetMaxHealth(); |
3141 pPlayers[i]->ReceiveDamage((signed int)((pParty->uFallStartY - v81) * (unsigned __int64)(signed __int64)((double)v110 * 0.1)) / 256, | |
1036 | 3142 DMGT_PHISYCAL); |
1424 | 3143 v110 = 20 - pPlayers[i]->GetParameterBonus(pPlayers[i]->GetActualEndurance()); |
3144 pPlayers[i]->SetRecoveryTime((signed __int64)((double)v110 * flt_6BE3A4_debug_recmod1 * 2.133333333333333)); | |
0 | 3145 } |
3146 v82 = pParty->vPosition.z; | |
3147 } | |
3148 } | |
3149 pParty->uFallStartY = v81; | |
3150 } | |
3151 if ( v102 && v82 < v109 && (signed int)(pParty->uPartyHeight + v82) >= v109 ) | |
3152 { | |
3153 pParty->vPosition.z = v82 + pParty->uPartyHeight - v109 + 1; | |
3154 pParty->field_6F0 = v82 + pParty->uPartyHeight - v109 + 1; | |
3155 } | |
3156 } | |
3157 } | |
3158 | |
3159 //----- (0047531C) -------------------------------------------------------- | |
3160 bool __fastcall sub_47531C(int a1, int *a2, int a3, int a4, int a5, int a6, int a7, int a8, BLVFace *a9, int a10) | |
3161 { | |
3162 BLVFace *v10; // ebx@1 | |
3163 int v11; // ST1C_4@3 | |
3164 int v12; // edi@3 | |
3165 int v13; // esi@3 | |
3166 int v14; // edi@4 | |
3167 signed __int64 v15; // qtt@6 | |
3168 __int16 v16; // si@7 | |
3169 int *v18; // [sp+Ch] [bp-Ch]@1 | |
3170 int v19; // [sp+10h] [bp-8h]@1 | |
3171 int a7a; // [sp+30h] [bp+18h]@7 | |
3172 int a9b; // [sp+38h] [bp+20h]@3 | |
3173 int a9a; // [sp+38h] [bp+20h]@3 | |
3174 int a10b; // [sp+3Ch] [bp+24h]@3 | |
3175 signed int a10a; // [sp+3Ch] [bp+24h]@4 | |
3176 int a10c; // [sp+3Ch] [bp+24h]@5 | |
3177 | |
3178 v10 = a9; | |
3179 v18 = a2; | |
3180 v19 = a1; | |
3181 if ( a10 && BYTE3(a9->uAttributes) & 0x20 ) | |
3182 return 0; | |
3183 v11 = (unsigned __int64)(a6 * (signed __int64)a9->pFacePlane_old.vNormal.x) >> 16; | |
3184 a10b = (unsigned __int64)(a7 * (signed __int64)a9->pFacePlane_old.vNormal.y) >> 16; | |
3185 a9b = (unsigned __int64)(a8 * (signed __int64)a9->pFacePlane_old.vNormal.z) >> 16; | |
3186 v12 = v11 + a9b + a10b; | |
3187 a9a = v11 + a9b + a10b; | |
3188 v13 = (a1 << 16) | |
3189 - a3 * v10->pFacePlane_old.vNormal.x | |
3190 - a4 * v10->pFacePlane_old.vNormal.y | |
3191 - a5 * v10->pFacePlane_old.vNormal.z | |
3192 - v10->pFacePlane_old.dist; | |
3193 if ( abs((a1 << 16) | |
3194 - a3 * v10->pFacePlane_old.vNormal.x | |
3195 - a4 * v10->pFacePlane_old.vNormal.y | |
3196 - a5 * v10->pFacePlane_old.vNormal.z - v10->pFacePlane_old.dist) >= a1 << 16 ) | |
3197 { | |
3198 a10c = abs(v13) >> 14; | |
3199 if ( a10c > abs(v12) ) | |
3200 return 0; | |
3201 LODWORD(v15) = v13 << 16; | |
3202 HIDWORD(v15) = v13 >> 16; | |
3203 v14 = v19; | |
3204 a10a = v15 / a9a; | |
3205 } | |
3206 else | |
3207 { | |
3208 a10a = 0; | |
3209 v14 = abs(v13) >> 16; | |
3210 } | |
3211 v16 = a4 + ((unsigned int)((unsigned __int64)(a10a * (signed __int64)a7) >> 16) >> 16); | |
3212 LOWORD(a7a) = (short)a3 | |
3213 + ((unsigned int)((unsigned __int64)(a10a * (signed __int64)a6) >> 16) >> 16) | |
3214 - ((unsigned int)(v14 * v10->pFacePlane_old.vNormal.x) >> 16); | |
3215 HIWORD(a7a) = v16 - ((unsigned int)(v14 * v10->pFacePlane_old.vNormal.y) >> 16); | |
3216 if ( !sub_475665( | |
3217 v10, | |
3218 a7a, | |
3219 (short)a5 | |
3220 + ((unsigned int)((unsigned __int64)(a10a * (signed __int64)a8) >> 16) >> 16) | |
3221 - ((unsigned int)(v14 * v10->pFacePlane_old.vNormal.z) >> 16)) ) | |
3222 return 0; | |
3223 *v18 = a10a >> 16; | |
3224 if ( a10a >> 16 < 0 ) | |
3225 *v18 = 0; | |
3226 return 1; | |
3227 } | |
3228 | |
3229 //----- (004754BF) -------------------------------------------------------- | |
3230 bool __fastcall sub_4754BF(int a1, int *a2, int a3, int a4, int a5, int a6, int a7, int a8, BLVFace *a9, int a10, int a11) | |
3231 { | |
3232 BLVFace *v11; // ebx@1 | |
3233 int v12; // ST1C_4@3 | |
3234 int v13; // edi@3 | |
3235 int v14; // esi@3 | |
3236 int v15; // edi@4 | |
3237 signed __int64 v16; // qtt@6 | |
3238 __int16 v17; // si@7 | |
3239 int *v19; // [sp+Ch] [bp-Ch]@1 | |
3240 int v20; // [sp+10h] [bp-8h]@1 | |
3241 int a7a; // [sp+30h] [bp+18h]@7 | |
3242 int a1b; // [sp+38h] [bp+20h]@3 | |
3243 int a1a; // [sp+38h] [bp+20h]@3 | |
3244 int a11b; // [sp+40h] [bp+28h]@3 | |
3245 signed int a11a; // [sp+40h] [bp+28h]@4 | |
3246 int a11c; // [sp+40h] [bp+28h]@5 | |
3247 | |
3248 v11 = a9; | |
3249 v19 = a2; | |
3250 v20 = a1; | |
3251 if ( a11 && BYTE3(a9->uAttributes) & 0x20 ) | |
3252 return 0; | |
3253 v12 = (unsigned __int64)(a6 * (signed __int64)a9->pFacePlane_old.vNormal.x) >> 16; | |
3254 a11b = (unsigned __int64)(a7 * (signed __int64)a9->pFacePlane_old.vNormal.y) >> 16; | |
3255 a1b = (unsigned __int64)(a8 * (signed __int64)a9->pFacePlane_old.vNormal.z) >> 16; | |
3256 v13 = v12 + a1b + a11b; | |
3257 a1a = v12 + a1b + a11b; | |
3258 v14 = (a1 << 16) | |
3259 - a3 * v11->pFacePlane_old.vNormal.x | |
3260 - a4 * v11->pFacePlane_old.vNormal.y | |
3261 - a5 * v11->pFacePlane_old.vNormal.z | |
3262 - v11->pFacePlane_old.dist; | |
3263 if ( abs((a1 << 16) | |
3264 - a3 * v11->pFacePlane_old.vNormal.x | |
3265 - a4 * v11->pFacePlane_old.vNormal.y | |
3266 - a5 * v11->pFacePlane_old.vNormal.z - v11->pFacePlane_old.dist) >= a1 << 16 ) | |
3267 { | |
3268 a11c = abs(v14) >> 14; | |
3269 if ( a11c > abs(v13) ) | |
3270 return 0; | |
3271 LODWORD(v16) = v14 << 16; | |
3272 HIDWORD(v16) = v14 >> 16; | |
3273 v15 = v20; | |
3274 a11a = v16 / a1a; | |
3275 } | |
3276 else | |
3277 { | |
3278 a11a = 0; | |
3279 v15 = abs(v14) >> 16; | |
3280 } | |
3281 v17 = a4 + ((unsigned int)((unsigned __int64)(a11a * (signed __int64)a7) >> 16) >> 16); | |
3282 LOWORD(a7a) = (short)a3 | |
3283 + ((unsigned int)((unsigned __int64)(a11a * (signed __int64)a6) >> 16) >> 16) | |
3284 - ((unsigned int)(v15 * v11->pFacePlane_old.vNormal.x) >> 16); | |
3285 HIWORD(a7a) = v17 - ((unsigned int)(v15 * v11->pFacePlane_old.vNormal.y) >> 16); | |
3286 if ( !sub_4759C9( | |
3287 v11, | |
3288 a10, | |
3289 a7a, | |
3290 (short)a5 | |
3291 + ((unsigned int)((unsigned __int64)(a11a * (signed __int64)a8) >> 16) >> 16) | |
3292 - ((unsigned int)(v15 * v11->pFacePlane_old.vNormal.z) >> 16)) ) | |
3293 return 0; | |
3294 *v19 = a11a >> 16; | |
3295 if ( a11a >> 16 < 0 ) | |
3296 *v19 = 0; | |
3297 return 1; | |
3298 } | |
3299 | |
3300 //----- (00475665) -------------------------------------------------------- | |
1459 | 3301 int sub_475665(BLVFace *_this, int a2, __int16 a3) |
0 | 3302 { |
3303 unsigned int v3; // eax@1 | |
3304 Vec3_short_ *v4; // edx@3 | |
3305 signed int v5; // eax@4 | |
3306 int v6; // esi@4 | |
3307 signed int v7; // eax@7 | |
3308 Vec3_short_ *v8; // edx@8 | |
3309 signed int v9; // eax@9 | |
3310 int v10; // esi@9 | |
3311 signed int v11; // eax@11 | |
3312 Vec3_short_ *v12; // edx@12 | |
3313 signed int v13; // eax@13 | |
3314 int v14; // esi@13 | |
3315 int v15; // esi@14 | |
3316 bool v16; // edi@14 | |
3317 int v17; // ecx@16 | |
3318 signed int v18; // edx@16 | |
3319 int v19; // eax@17 | |
3320 signed int v20; // ebx@18 | |
3321 int v21; // edi@20 | |
3322 signed int v22; // ST14_4@22 | |
3323 signed __int64 v23; // qtt@22 | |
3324 signed int result; // eax@25 | |
3325 int v25; // [sp+14h] [bp-10h]@14 | |
3326 int v26; // [sp+1Ch] [bp-8h]@2 | |
3327 signed int v27; // [sp+20h] [bp-4h]@2 | |
3328 signed int v28; // [sp+30h] [bp+Ch]@2 | |
3329 signed int v29; // [sp+30h] [bp+Ch]@7 | |
3330 signed int v30; // [sp+30h] [bp+Ch]@11 | |
3331 signed int v31; // [sp+30h] [bp+Ch]@14 | |
3332 | |
3333 v3 = _this->uAttributes; | |
3334 if ( BYTE1(v3) & 1 ) | |
3335 { | |
3336 v28 = 0; | |
3337 v26 = (signed __int16)a2; | |
3338 v27 = SHIWORD(a2); | |
3339 if ( _this->uNumVertices ) | |
3340 { | |
3341 v4 = pIndoor->pVertices; | |
3342 do | |
3343 { | |
3344 v5 = v28; | |
3345 v6 = 2 * v28; | |
3346 word_720C10_intercepts_xs[2 * v28] = _this->pXInterceptDisplacements[v28] + v4[_this->pVertexIDs[v28]].x; | |
3347 word_720B40_intercepts_zs[2 * v28] = _this->pYInterceptDisplacements[v5] + v4[_this->pVertexIDs[v5]].y; | |
3348 word_720C10_intercepts_xs[2 * v28++ + 1] = _this->pXInterceptDisplacements[v5 + 1] | |
3349 + v4[_this->pVertexIDs[v5 + 1]].x; | |
3350 word_720B40_intercepts_zs[v6 + 1] = _this->pYInterceptDisplacements[v5 + 1] + v4[_this->pVertexIDs[v5 + 1]].y; | |
3351 } | |
3352 while ( v28 < _this->uNumVertices ); | |
3353 } | |
3354 } | |
3355 else | |
3356 { | |
3357 if ( BYTE1(v3) & 2 ) | |
3358 { | |
3359 v26 = (signed __int16)a2; | |
3360 v7 = a3; | |
3361 v29 = 0; | |
3362 v27 = v7; | |
3363 if ( _this->uNumVertices ) | |
3364 { | |
3365 v8 = pIndoor->pVertices; | |
3366 do | |
3367 { | |
3368 v9 = v29; | |
3369 v10 = 2 * v29; | |
3370 word_720C10_intercepts_xs[2 * v29] = _this->pXInterceptDisplacements[v29] + v8[_this->pVertexIDs[v29]].x; | |
3371 word_720B40_intercepts_zs[2 * v29] = _this->pZInterceptDisplacements[v9] + v8[_this->pVertexIDs[v9]].z; | |
3372 word_720C10_intercepts_xs[2 * v29++ + 1] = _this->pXInterceptDisplacements[v9 + 1] + v8[_this->pVertexIDs[v9 + 1]].x; | |
3373 word_720B40_intercepts_zs[v10 + 1] = _this->pZInterceptDisplacements[v9 + 1] + v8[_this->pVertexIDs[v9 + 1]].z; | |
3374 } | |
3375 while ( v29 < _this->uNumVertices ); | |
3376 } | |
3377 } | |
3378 else | |
3379 { | |
3380 v26 = SHIWORD(a2); | |
3381 v11 = a3; | |
3382 v30 = 0; | |
3383 v27 = v11; | |
3384 if ( _this->uNumVertices ) | |
3385 { | |
3386 v12 = pIndoor->pVertices; | |
3387 do | |
3388 { | |
3389 v13 = v30; | |
3390 v14 = 2 * v30; | |
3391 word_720C10_intercepts_xs[2 * v30] = _this->pYInterceptDisplacements[v30] + v12[_this->pVertexIDs[v30]].y; | |
3392 word_720B40_intercepts_zs[2 * v30] = _this->pZInterceptDisplacements[v13] + v12[_this->pVertexIDs[v13]].z; | |
3393 word_720C10_intercepts_xs[2 * v30++ + 1] = _this->pYInterceptDisplacements[v13 + 1] + v12[_this->pVertexIDs[v13 + 1]].y; | |
3394 word_720B40_intercepts_zs[v14 + 1] = _this->pZInterceptDisplacements[v13 + 1] + v12[_this->pVertexIDs[v13 + 1]].z; | |
3395 } | |
3396 while ( v30 < _this->uNumVertices ); | |
3397 } | |
3398 } | |
3399 } | |
3400 v15 = 2 * _this->uNumVertices; | |
3401 v31 = 0; | |
3402 word_720C10_intercepts_xs[2 * _this->uNumVertices] = word_720C10_intercepts_xs[0]; | |
3403 word_720B40_intercepts_zs[v15] = word_720B40_intercepts_zs[0]; | |
3404 v25 = 0; | |
3405 v16 = word_720B40_intercepts_zs[0] >= v27; | |
3406 if ( v15 <= 0 ) | |
1418 | 3407 return 0; |
0 | 3408 do |
3409 { | |
3410 if ( v31 >= 2 ) | |
3411 break; | |
3412 v17 = v25; | |
3413 v18 = word_720B40_intercepts_zs[v25 + 1]; | |
1110 | 3414 if ( v16 ^ (v18 >= v27) ) |
0 | 3415 { |
3416 v19 = word_720C10_intercepts_xs[v17 + 1]; | |
3417 if ( v19 >= v26 ) | |
3418 v20 = 0; | |
3419 else | |
3420 v20 = 2; | |
1110 | 3421 v21 = v20 | (word_720C10_intercepts_xs[v17] < v26); |
0 | 3422 if ( v21 != 3 ) |
3423 { | |
3424 if ( !v21 | |
3425 || (v22 = v19 - word_720C10_intercepts_xs[v17], | |
3426 LODWORD(v23) = v22 << 16, | |
3427 HIDWORD(v23) = v22 >> 16, | |
3428 word_720C10_intercepts_xs[v17] | |
3429 + ((signed int)(((unsigned __int64)(v23 | |
3430 / (v18 - word_720B40_intercepts_zs[v17]) | |
3431 * ((v27 - (signed int)word_720B40_intercepts_zs[v17]) << 16)) >> 16) | |
3432 + 32768) >> 16) >= v26) ) | |
3433 ++v31; | |
3434 } | |
3435 } | |
3436 ++v25; | |
3437 v16 = v18 >= v27; | |
3438 } | |
3439 while ( v25 < v15 ); | |
3440 result = 1; | |
3441 if ( v31 != 1 ) | |
3442 result = 0; | |
3443 return result; | |
3444 } | |
3445 | |
3446 //----- (004759C9) -------------------------------------------------------- | |
3447 bool __fastcall sub_4759C9(BLVFace *a1, int a2, int a3, __int16 a4) | |
3448 { | |
3449 unsigned int v4; // eax@1 | |
3450 int v5; // edx@4 | |
3451 __int16 v6; // si@4 | |
3452 int v7; // edx@9 | |
3453 __int16 v8; // si@9 | |
3454 int v9; // edx@13 | |
3455 __int16 v10; // si@13 | |
3456 int v11; // esi@14 | |
3457 bool v12; // edi@14 | |
3458 int v13; // ecx@16 | |
3459 signed int v14; // edx@16 | |
3460 int v15; // eax@17 | |
3461 signed int v16; // ebx@18 | |
3462 int v17; // edi@20 | |
3463 signed int v18; // ST14_4@22 | |
3464 signed __int64 v19; // qtt@22 | |
3465 bool result; // eax@25 | |
3466 int v21; // [sp+14h] [bp-10h]@14 | |
3467 signed int v22; // [sp+18h] [bp-Ch]@1 | |
3468 int v23; // [sp+1Ch] [bp-8h]@2 | |
3469 signed int v24; // [sp+20h] [bp-4h]@2 | |
3470 Vec3_int_ **a4a; // [sp+30h] [bp+Ch]@3 | |
3471 Vec3_int_ **a4b; // [sp+30h] [bp+Ch]@8 | |
3472 Vec3_int_ **a4c; // [sp+30h] [bp+Ch]@12 | |
3473 signed int a4d; // [sp+30h] [bp+Ch]@14 | |
3474 | |
3475 v4 = a1->uAttributes; | |
3476 v22 = 0; | |
3477 if ( BYTE1(v4) & 1 ) | |
3478 { | |
3479 v23 = (signed __int16)a3; | |
3480 v24 = SHIWORD(a3); | |
3481 if ( a1->uNumVertices ) | |
3482 { | |
3483 a4a = &pOutdoor->pBModels[a2].pVertices.pVertices; | |
3484 do | |
3485 { | |
3486 v5 = 2 * v22; | |
3487 word_720A70_intercepts_xs_plus_xs[2 * v22] = a1->pXInterceptDisplacements[v22] + LOWORD((*a4a)[a1->pVertexIDs[v22]].x); | |
3488 word_7209A0_intercepts_ys_plus_ys[2 * v22] = a1->pYInterceptDisplacements[v22] + LOWORD((*a4a)[a1->pVertexIDs[v22]].y); | |
3489 word_720A70_intercepts_xs_plus_xs[2 * v22 + 1] = a1->pXInterceptDisplacements[v22 + 1] + LOWORD((*a4a)[a1->pVertexIDs[v22 + 1]].x); | |
3490 word_7209A0_intercepts_ys_plus_ys[v5 + 1] = v6 = a1->pYInterceptDisplacements[v22 + 1] + LOWORD((*a4a)[a1->pVertexIDs[v22 + 1]].y); | |
3491 ++v22; | |
3492 } | |
3493 while ( v22 < a1->uNumVertices ); | |
3494 } | |
3495 } | |
3496 else | |
3497 { | |
3498 if ( BYTE1(v4) & 2 ) | |
3499 { | |
3500 v23 = (signed __int16)a3; | |
3501 v24 = a4; | |
3502 if ( a1->uNumVertices ) | |
3503 { | |
3504 a4b = &pOutdoor->pBModels[a2].pVertices.pVertices; | |
3505 do | |
3506 { | |
3507 v7 = 2 * v22; | |
3508 word_720A70_intercepts_xs_plus_xs[2 * v22] = a1->pXInterceptDisplacements[v22] + LOWORD((*a4b)[a1->pVertexIDs[v22]].x); | |
3509 word_7209A0_intercepts_ys_plus_ys[2 * v22] = a1->pZInterceptDisplacements[v22] + LOWORD((*a4b)[a1->pVertexIDs[v22]].z); | |
3510 word_720A70_intercepts_xs_plus_xs[2 * v22 + 1] = a1->pXInterceptDisplacements[v22 + 1] + LOWORD((*a4b)[a1->pVertexIDs[v22 + 1]].x); | |
3511 word_7209A0_intercepts_ys_plus_ys[v7 + 1] = v8 = a1->pZInterceptDisplacements[v22 + 1] + LOWORD((*a4b)[a1->pVertexIDs[v22 + 1]].z); | |
3512 ++v22; | |
3513 } | |
3514 while ( v22 < a1->uNumVertices ); | |
3515 } | |
3516 } | |
3517 else | |
3518 { | |
3519 v23 = SHIWORD(a3); | |
3520 v24 = a4; | |
3521 if ( a1->uNumVertices ) | |
3522 { | |
3523 a4c = &pOutdoor->pBModels[a2].pVertices.pVertices; | |
3524 do | |
3525 { | |
3526 v9 = 2 * v22; | |
3527 word_720A70_intercepts_xs_plus_xs[2 * v22] = a1->pYInterceptDisplacements[v22] + LOWORD((*a4c)[a1->pVertexIDs[v22]].y); | |
3528 word_7209A0_intercepts_ys_plus_ys[2 * v22] = a1->pZInterceptDisplacements[v22] + LOWORD((*a4c)[a1->pVertexIDs[v22]].z); | |
3529 word_720A70_intercepts_xs_plus_xs[2 * v22 + 1] = a1->pYInterceptDisplacements[v22 + 1] + LOWORD((*a4c)[a1->pVertexIDs[v22 + 1]].y); | |
3530 word_7209A0_intercepts_ys_plus_ys[v9 + 1] = v10 = a1->pZInterceptDisplacements[v22 + 1] + LOWORD((*a4c)[a1->pVertexIDs[v22 + 1]].z); | |
3531 ++v22; | |
3532 } | |
3533 while ( v22 < a1->uNumVertices ); | |
3534 } | |
3535 } | |
3536 } | |
3537 v11 = 2 * a1->uNumVertices; | |
3538 a4d = 0; | |
3539 word_720A70_intercepts_xs_plus_xs[2 * a1->uNumVertices] = word_720A70_intercepts_xs_plus_xs[0]; | |
3540 word_7209A0_intercepts_ys_plus_ys[v11] = word_7209A0_intercepts_ys_plus_ys[0]; | |
3541 v21 = 0; | |
3542 v12 = word_7209A0_intercepts_ys_plus_ys[0] >= v24; | |
3543 if ( v11 <= 0 ) | |
1418 | 3544 return 0; |
0 | 3545 do |
3546 { | |
3547 if ( a4d >= 2 ) | |
3548 break; | |
3549 v13 = v21; | |
3550 v14 = word_7209A0_intercepts_ys_plus_ys[v21 + 1]; | |
1110 | 3551 if ( v12 ^ (v14 >= v24) ) |
0 | 3552 { |
3553 v15 = word_720A70_intercepts_xs_plus_xs[v13 + 1]; | |
3554 if ( v15 >= v23 ) | |
3555 v16 = 0; | |
3556 else | |
3557 v16 = 2; | |
1110 | 3558 v17 = v16 | (word_720A70_intercepts_xs_plus_xs[v13] < v23); |
0 | 3559 if ( v17 != 3 ) |
3560 { | |
3561 if ( !v17 | |
3562 || (v18 = v15 - word_720A70_intercepts_xs_plus_xs[v13], | |
3563 LODWORD(v19) = v18 << 16, | |
3564 HIDWORD(v19) = v18 >> 16, | |
3565 word_720A70_intercepts_xs_plus_xs[v13] | |
3566 + ((signed int)(((unsigned __int64)(v19 | |
3567 / (v14 - word_7209A0_intercepts_ys_plus_ys[v13]) | |
3568 * ((v24 - (signed int)word_7209A0_intercepts_ys_plus_ys[v13]) << 16)) >> 16) | |
3569 + 32768) >> 16) >= v23) ) | |
3570 ++a4d; | |
3571 } | |
3572 } | |
3573 ++v21; | |
3574 v12 = v14 >= v24; | |
3575 } | |
3576 while ( v21 < v11 ); | |
3577 result = 1; | |
3578 if ( a4d != 1 ) | |
3579 result = 0; | |
3580 return result; | |
3581 } | |
3582 | |
3583 //----- (00475D85) -------------------------------------------------------- | |
3584 bool __fastcall sub_475D85(Vec3_int_ *a1, Vec3_int_ *a2, int *a3, BLVFace *a4) | |
3585 { | |
3586 BLVFace *v4; // ebx@1 | |
3587 int v5; // ST24_4@2 | |
3588 int v6; // ST28_4@2 | |
3589 int v7; // edi@2 | |
3590 int v8; // eax@5 | |
3591 signed int v9; // esi@5 | |
3592 signed __int64 v10; // qtt@10 | |
3593 Vec3_int_ *v11; // esi@11 | |
3594 int v12; // ST14_4@11 | |
3595 Vec3_int_ *v14; // [sp+Ch] [bp-18h]@1 | |
3596 Vec3_int_ *v15; // [sp+14h] [bp-10h]@1 | |
3597 int v16; // [sp+18h] [bp-Ch]@2 | |
3598 int v17; // [sp+20h] [bp-4h]@10 | |
3599 int a4b; // [sp+30h] [bp+Ch]@2 | |
3600 int a4c; // [sp+30h] [bp+Ch]@9 | |
3601 signed int a4a; // [sp+30h] [bp+Ch]@10 | |
3602 | |
3603 v4 = a4; | |
3604 v15 = a2; | |
3605 v14 = a1; | |
3606 if ( BYTE3(a4->uAttributes) & 0x20 | |
3607 || (v5 = (unsigned __int64)(a2->x * (signed __int64)a4->pFacePlane_old.vNormal.x) >> 16, | |
3608 a4b = (unsigned __int64)(a2->y * (signed __int64)a4->pFacePlane_old.vNormal.y) >> 16, | |
3609 v6 = (unsigned __int64)(a2->z * (signed __int64)v4->pFacePlane_old.vNormal.z) >> 16, | |
3610 v7 = v5 + v6 + a4b, | |
3611 (v16 = v5 + v6 + a4b) == 0) | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
675
diff
changeset
|
3612 || v7 > 0 && !v4->Portal()) |
0 | 3613 return 0; |
3614 v8 = v4->pFacePlane_old.vNormal.z * a1->z; | |
3615 v9 = -(v4->pFacePlane_old.dist + v8 + a1->y * v4->pFacePlane_old.vNormal.y + a1->x * v4->pFacePlane_old.vNormal.x); | |
3616 if ( v7 <= 0 ) | |
3617 { | |
3618 if ( v4->pFacePlane_old.dist + v8 + a1->y * v4->pFacePlane_old.vNormal.y + a1->x * v4->pFacePlane_old.vNormal.x < 0 ) | |
3619 return 0; | |
3620 } | |
3621 else | |
3622 { | |
3623 if ( v9 < 0 ) | |
3624 return 0; | |
3625 } | |
3626 a4c = abs(-(v4->pFacePlane_old.dist + v8 + a1->y * v4->pFacePlane_old.vNormal.y + a1->x * v4->pFacePlane_old.vNormal.x)) >> 14; | |
3627 if ( a4c > abs(v7) | |
3628 || (LODWORD(v10) = v9 << 16, HIDWORD(v10) = v9 >> 16, a4a = v10 / v16, v17 = v10 / v16, v17 > *a3 << 16) | |
3629 || (v11 = v14, | |
3630 LOWORD(v12) = LOWORD(v14->x) | |
3631 + (((unsigned int)((unsigned __int64)(v17 * (signed __int64)v15->x) >> 16) + 32768) >> 16), | |
3632 HIWORD(v12) = LOWORD(v11->y) | |
3633 + (((unsigned int)((unsigned __int64)(v17 * (signed __int64)v15->y) >> 16) + 32768) >> 16), | |
3634 !sub_475665( | |
3635 v4, | |
3636 v12, | |
3637 LOWORD(v11->z) + (((unsigned int)((unsigned __int64)(v17 * (signed __int64)v15->z) >> 16) + 32768) >> 16))) ) | |
3638 return 0; | |
3639 *a3 = a4a >> 16; | |
3640 return 1; | |
3641 } | |
3642 | |
3643 //----- (00475F30) -------------------------------------------------------- | |
3644 bool __fastcall sub_475F30(int *a1, BLVFace *a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9) | |
3645 { | |
3646 BLVFace *v9; // ebx@1 | |
3647 int v10; // ST20_4@2 | |
3648 int v11; // ST28_4@2 | |
3649 int v12; // ST24_4@2 | |
3650 char v13; // zf@2 | |
3651 int v14; // edi@2 | |
3652 int v15; // eax@5 | |
3653 signed int v16; // esi@5 | |
3654 int v17; // ST20_4@9 | |
3655 signed __int64 v18; // qtt@10 | |
3656 int v19; // ST14_4@11 | |
3657 int *v21; // [sp+14h] [bp-10h]@1 | |
3658 int v22; // [sp+1Ch] [bp-8h]@2 | |
3659 int v23; // [sp+1Ch] [bp-8h]@10 | |
3660 signed int v24; // [sp+20h] [bp-4h]@10 | |
3661 | |
3662 v9 = a2; | |
3663 v21 = a1; | |
3664 if ( BYTE3(a2->uAttributes) & 0x20 | |
3665 || (v10 = (unsigned __int64)(a6 * (signed __int64)a2->pFacePlane_old.vNormal.x) >> 16, | |
3666 v11 = (unsigned __int64)(a7 * (signed __int64)a2->pFacePlane_old.vNormal.y) >> 16, | |
3667 v12 = (unsigned __int64)(a8 * (signed __int64)a2->pFacePlane_old.vNormal.z) >> 16, | |
3668 v13 = v10 + v12 + v11 == 0, | |
3669 v14 = v10 + v12 + v11, | |
3670 v22 = v10 + v12 + v11, | |
3671 v13) | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
675
diff
changeset
|
3672 || v14 > 0 && !a2->Portal()) |
0 | 3673 return 0; |
3674 v15 = a4 * a2->pFacePlane_old.vNormal.y; | |
3675 v16 = -(a2->pFacePlane_old.dist + v15 + a3 * a2->pFacePlane_old.vNormal.x + a5 * a2->pFacePlane_old.vNormal.z); | |
3676 if ( v14 <= 0 ) | |
3677 { | |
3678 if ( a2->pFacePlane_old.dist + v15 + a3 * a2->pFacePlane_old.vNormal.x + a5 * a2->pFacePlane_old.vNormal.z < 0 ) | |
3679 return 0; | |
3680 } | |
3681 else | |
3682 { | |
3683 if ( v16 < 0 ) | |
3684 return 0; | |
3685 } | |
3686 v17 = abs(-(a2->pFacePlane_old.dist + v15 + a3 * a2->pFacePlane_old.vNormal.x + a5 * a2->pFacePlane_old.vNormal.z)) >> 14; | |
3687 if ( v17 > abs(v14) | |
3688 || (LODWORD(v18) = v16 << 16, HIDWORD(v18) = v16 >> 16, v24 = v18 / v22, v23 = v18 / v22, v23 > *v21 << 16) | |
3689 || (LOWORD(v19) = a3 + (((unsigned int)((unsigned __int64)(v23 * (signed __int64)a6) >> 16) + 32768) >> 16), | |
3690 HIWORD(v19) = a4 + (((unsigned int)((unsigned __int64)(v23 * (signed __int64)a7) >> 16) + 32768) >> 16), | |
3691 !sub_4759C9( | |
3692 v9, | |
3693 a9, | |
3694 v19, | |
3695 a5 + (((unsigned int)((unsigned __int64)(v23 * (signed __int64)a8) >> 16) + 32768) >> 16))) ) | |
3696 return 0; | |
3697 *v21 = v24 >> 16; | |
3698 return 1; | |
3699 } | |
3700 | |
3701 //----- (004760D5) -------------------------------------------------------- | |
3702 PartyAction ActionQueue::Next() | |
3703 { | |
3704 if (!uNumActions) | |
3705 return PARTY_INVALID; | |
3706 | |
3707 auto result = pActions[0]; | |
3708 for (unsigned int i = 0; i < uNumActions - 1; ++i) | |
3709 pActions[i] = pActions[i + 1]; | |
3710 --uNumActions; | |
3711 | |
3712 return result; | |
3713 } | |
3714 | |
3715 //----- (004775ED) -------------------------------------------------------- | |
3716 int stru6_stru1_indoor_sw_billboard::_4775ED(float a2) | |
3717 { | |
3718 char *v2; // edi@1 | |
3719 int v3; // eax@1 | |
3720 char *v4; // edx@2 | |
3721 char *v5; // esi@3 | |
3722 double v6; // st7@6 | |
3723 signed __int64 v7; // ST84_8@6 | |
3724 double v8; // ST0C_8@6 | |
3725 int v9; // esi@6 | |
3726 double v10; // ST44_8@6 | |
3727 int v11; // ecx@6 | |
3728 double v12; // ST34_8@6 | |
3729 int v13; // ecx@6 | |
3730 double v14; // ST14_8@6 | |
3731 double v15; // st7@8 | |
3732 unsigned int v16; // ecx@8 | |
3733 signed __int64 v17; // ST64_8@8 | |
3734 double v18; // ST24_8@8 | |
3735 int v19; // edi@8 | |
3736 double v20; // ST3C_8@8 | |
3737 int v21; // ecx@8 | |
3738 double v22; // ST2C_8@8 | |
3739 int v23; // ST9C_4@8 | |
3740 double v24; // ST1C_8@8 | |
3741 int *v25; // edi@8 | |
3742 int v26; // esi@8 | |
3743 int *v27; // edi@10 | |
3744 int v28; // esi@10 | |
3745 int result; // eax@12 | |
3746 __int64 v30; // [sp+A8h] [bp-30h]@8 | |
3747 float v31; // [sp+B0h] [bp-28h]@6 | |
3748 float v32; // [sp+B4h] [bp-24h]@6 | |
3749 int v33; // [sp+B8h] [bp-20h]@6 | |
3750 int v34; // [sp+BCh] [bp-1Ch]@2 | |
3751 stru6_stru1_indoor_sw_billboard *v35; // [sp+C0h] [bp-18h]@1 | |
3752 float v36; // [sp+C4h] [bp-14h]@6 | |
3753 int v37; // [sp+C8h] [bp-10h]@6 | |
3754 int v38; // [sp+CCh] [bp-Ch]@1 | |
3755 float v39; // [sp+D0h] [bp-8h]@6 | |
3756 int *v40; // [sp+D4h] [bp-4h]@2 | |
3757 | |
1390 | 3758 v2 = (char *)&this->field_64[4 * this->uNumVertices]; |
0 | 3759 v38 = 0; |
1390 | 3760 *(int *)v2 = this->field_64[0]; |
0 | 3761 v2 += 4; |
1390 | 3762 *(int *)v2 = this->field_64[1]; |
0 | 3763 v2 += 4; |
1390 | 3764 *(int *)v2 = this->field_64[2]; |
3765 *((int *)v2 + 1) = this->field_64[3]; | |
3766 v3 = this->uNumVertices; | |
0 | 3767 v35 = this; |
3768 if ( v3 > 0 ) | |
3769 { | |
1390 | 3770 v40 = &this->field_64[20]; |
3771 v4 = (char *)&this->field_64[3] + 3; | |
0 | 3772 v34 = v3; |
3773 while ( 1 ) | |
3774 { | |
3775 v5 = v4 - 15; | |
3776 if ( *(float *)(v4 - 15) <= (double)a2 && *(float *)(v4 + 1) <= (double)a2 ) | |
1418 | 3777 { |
3778 v4 += 16; | |
3779 --v34; | |
3780 if ( !v34 ) | |
3781 return this->uNumVertices = v38; | |
3782 continue; | |
3783 } | |
0 | 3784 if ( *(float *)v5 <= (double)a2 ) |
1418 | 3785 { |
3786 v6 = (a2 - *(float *)v5) / (*(float *)(v4 + 1) - *(float *)v5); | |
3787 v7 = (unsigned __int8)v4[16] - (unsigned int)(unsigned __int8)*v4; | |
3788 v36 = v6; | |
3789 v31 = (*(float *)(v4 + 5) - *(float *)(v4 - 11)) * v6 + *(float *)(v4 - 11); | |
3790 v32 = (*(float *)(v4 + 9) - *(float *)(v4 - 7)) * v6 + *(float *)(v4 - 7); | |
3791 *(float *)&v37 = (double)v7 * v6; | |
3792 v8 = *(float *)&v37 + 6.7553994e15; | |
3793 v9 = (unsigned __int8)*v4; | |
3794 *(float *)&v37 = (double)((unsigned __int8)v4[15] - (unsigned int)(unsigned __int8)*(v4 - 1)) * v36; | |
3795 v10 = *(float *)&v37 + 6.7553994e15; | |
3796 v11 = (unsigned __int8)*(v4 - 2); | |
3797 v37 = LODWORD(v10) + (unsigned __int8)*(v4 - 1); | |
3798 v39 = (double)((unsigned int)(unsigned __int8)v4[14] - v11) * v36; | |
3799 v12 = v39 + 6.7553994e15; | |
3800 v13 = LODWORD(v12) + (unsigned __int8)*(v4 - 2); | |
3801 v39 = (double)((*(int *)(v4 + 13) & 0xFF) - (*(int *)(v4 - 3) & 0xFFu)) * v36; | |
3802 v14 = v39 + 6.7553994e15; | |
3803 v33 = (LODWORD(v14) + (*(int *)(v4 - 3) & 0xFF)) | ((v13 | ((v37 | ((LODWORD(v8) + v9) << 8)) << 8)) << 8); | |
3804 //this = v35; | |
3805 v5 = (char *)&v30 + 4; | |
3806 } | |
3807 else if ( *(float *)(v4 + 1) <= (double)a2 ) | |
0 | 3808 { |
3809 v15 = (a2 - *(float *)v5) / (*(float *)(v4 + 1) - *(float *)v5); | |
3810 v16 = (unsigned __int8)*v4; | |
3811 HIDWORD(v30) = LODWORD(a2); | |
3812 v17 = (unsigned __int8)v4[16] - v16; | |
3813 v36 = v15; | |
3814 v31 = (*(float *)(v4 + 5) - *(float *)(v4 - 11)) * v15 + *(float *)(v4 - 11); | |
3815 v32 = (*(float *)(v4 + 9) - *(float *)(v4 - 7)) * v15 + *(float *)(v4 - 7); | |
3816 v39 = (double)v17 * v15; | |
3817 v18 = v39 + 6.7553994e15; | |
3818 v19 = (unsigned __int8)*v4; | |
3819 v39 = (double)((unsigned __int8)v4[15] - (unsigned int)(unsigned __int8)*(v4 - 1)) * v36; | |
3820 v20 = v39 + 6.7553994e15; | |
3821 v21 = (unsigned __int8)*(v4 - 2); | |
3822 v37 = LODWORD(v20) + (unsigned __int8)*(v4 - 1); | |
3823 v39 = (double)((unsigned int)(unsigned __int8)v4[14] - v21) * v36; | |
3824 v22 = v39 + 6.7553994e15; | |
3825 v23 = LODWORD(v22) + (unsigned __int8)*(v4 - 2); | |
3826 v39 = (double)((*(int *)(v4 + 13) & 0xFF) - (*(int *)(v4 - 3) & 0xFFu)) * v36; | |
3827 v24 = v39 + 6.7553994e15; | |
3828 v33 = (LODWORD(v24) + (*(int *)(v4 - 3) & 0xFF)) | ((v23 | ((v37 | ((LODWORD(v18) + v19) << 8)) << 8)) << 8); | |
3829 v25 = v40; | |
3830 *v40 = *(int *)v5; | |
3831 v26 = (int)(v5 + 4); | |
3832 ++v25; | |
3833 *v25 = *(int *)v26; | |
3834 v26 += 4; | |
3835 ++v25; | |
3836 ++v38; | |
3837 v40 += 4; | |
3838 *v25 = *(int *)v26; | |
3839 v25[1] = *(int *)(v26 + 4); | |
1418 | 3840 v5 = (char *)&v30 + 4; |
0 | 3841 } |
3842 v27 = v40; | |
3843 ++v38; | |
3844 *v40 = *(int *)v5; | |
3845 v28 = (int)(v5 + 4); | |
3846 ++v27; | |
3847 *v27 = *(int *)v28; | |
3848 v28 += 4; | |
3849 ++v27; | |
3850 v40 += 4; | |
3851 *v27 = *(int *)v28; | |
3852 v27[1] = *(int *)(v28 + 4); | |
3853 v4 += 16; | |
3854 --v34; | |
3855 if ( !v34 ) | |
1418 | 3856 return this->uNumVertices = v38; |
0 | 3857 } |
1418 | 3858 } |
1390 | 3859 return this->uNumVertices = v38; |
0 | 3860 } |
3861 | |
3862 //----- (00477927) -------------------------------------------------------- | |
3863 int stru6_stru1_indoor_sw_billboard::_477927(float a2) | |
3864 { | |
3865 char *v2; // edi@1 | |
3866 int v3; // eax@1 | |
3867 char *v4; // edx@2 | |
3868 char *v5; // esi@3 | |
3869 double v6; // st7@6 | |
3870 signed __int64 v7; // ST84_8@6 | |
3871 double v8; // ST0C_8@6 | |
3872 int v9; // esi@6 | |
3873 double v10; // ST44_8@6 | |
3874 int v11; // ecx@6 | |
3875 double v12; // ST34_8@6 | |
3876 int v13; // ecx@6 | |
3877 double v14; // ST14_8@6 | |
3878 double v15; // st7@8 | |
3879 unsigned int v16; // ecx@8 | |
3880 signed __int64 v17; // ST64_8@8 | |
3881 double v18; // ST24_8@8 | |
3882 int v19; // edi@8 | |
3883 double v20; // ST3C_8@8 | |
3884 int v21; // ecx@8 | |
3885 double v22; // ST2C_8@8 | |
3886 int v23; // ST9C_4@8 | |
3887 double v24; // ST1C_8@8 | |
3888 int *v25; // edi@8 | |
3889 int v26; // esi@8 | |
3890 int *v27; // edi@10 | |
3891 int v28; // esi@10 | |
3892 int result; // eax@12 | |
3893 __int64 v30; // [sp+A8h] [bp-30h]@8 | |
3894 float v31; // [sp+B0h] [bp-28h]@6 | |
3895 float v32; // [sp+B4h] [bp-24h]@6 | |
3896 int v33; // [sp+B8h] [bp-20h]@6 | |
3897 int v34; // [sp+BCh] [bp-1Ch]@2 | |
3898 stru6_stru1_indoor_sw_billboard *v35; // [sp+C0h] [bp-18h]@1 | |
3899 float v36; // [sp+C4h] [bp-14h]@6 | |
3900 int v37; // [sp+C8h] [bp-10h]@6 | |
3901 int v38; // [sp+CCh] [bp-Ch]@1 | |
3902 float v39; // [sp+D0h] [bp-8h]@6 | |
3903 int *v40; // [sp+D4h] [bp-4h]@2 | |
3904 | |
1390 | 3905 v2 = (char *)&this->field_64[4 * this->uNumVertices]; |
0 | 3906 v38 = 0; |
1390 | 3907 *(int *)v2 = this->field_64[0]; |
0 | 3908 v2 += 4; |
1390 | 3909 *(int *)v2 = this->field_64[1]; |
0 | 3910 v2 += 4; |
1390 | 3911 *(int *)v2 = this->field_64[2]; |
3912 *((int *)v2 + 1) = this->field_64[3]; | |
3913 v3 = this->uNumVertices; | |
0 | 3914 v35 = this; |
3915 if ( v3 > 0 ) | |
3916 { | |
1390 | 3917 v40 = &this->field_64[20]; |
3918 v4 = (char *)&this->field_64[3] + 3; | |
0 | 3919 v34 = v3; |
3920 while ( 1 ) | |
3921 { | |
3922 v5 = v4 - 15; | |
3923 if ( *(float *)(v4 - 15) >= (double)a2 && *(float *)(v4 + 1) >= (double)a2 ) | |
1418 | 3924 { |
3925 v4 += 16; | |
3926 --v34; | |
3927 if ( !v34 ) | |
3928 return this->uNumVertices = v38; | |
3929 continue; | |
3930 } | |
0 | 3931 if ( *(float *)v5 >= (double)a2 ) |
1418 | 3932 { |
3933 v6 = (a2 - *(float *)v5) / (*(float *)(v4 + 1) - *(float *)v5); | |
3934 v7 = (unsigned __int8)v4[16] - (unsigned int)(unsigned __int8)*v4; | |
3935 v36 = v6; | |
3936 v31 = (*(float *)(v4 + 5) - *(float *)(v4 - 11)) * v6 + *(float *)(v4 - 11); | |
3937 v32 = (*(float *)(v4 + 9) - *(float *)(v4 - 7)) * v6 + *(float *)(v4 - 7); | |
3938 *(float *)&v37 = (double)v7 * v6; | |
3939 v8 = *(float *)&v37 + 6.7553994e15; | |
3940 v9 = (unsigned __int8)*v4; | |
3941 *(float *)&v37 = (double)((unsigned __int8)v4[15] - (unsigned int)(unsigned __int8)*(v4 - 1)) * v36; | |
3942 v10 = *(float *)&v37 + 6.7553994e15; | |
3943 v11 = (unsigned __int8)*(v4 - 2); | |
3944 v37 = LODWORD(v10) + (unsigned __int8)*(v4 - 1); | |
3945 v39 = (double)((unsigned int)(unsigned __int8)v4[14] - v11) * v36; | |
3946 v12 = v39 + 6.7553994e15; | |
3947 v13 = LODWORD(v12) + (unsigned __int8)*(v4 - 2); | |
3948 v39 = (double)((*(int *)(v4 + 13) & 0xFF) - (*(int *)(v4 - 3) & 0xFFu)) * v36; | |
3949 v14 = v39 + 6.7553994e15; | |
3950 v33 = (LODWORD(v14) + (*(int *)(v4 - 3) & 0xFF)) | ((v13 | ((v37 | ((LODWORD(v8) + v9) << 8)) << 8)) << 8); | |
3951 //this = v35; | |
3952 v5 = (char *)&v30 + 4; | |
3953 } | |
3954 else if ( *(float *)(v4 + 1) >= (double)a2 ) | |
0 | 3955 { |
3956 v15 = (a2 - *(float *)v5) / (*(float *)(v4 + 1) - *(float *)v5); | |
3957 v16 = (unsigned __int8)*v4; | |
3958 HIDWORD(v30) = LODWORD(a2); | |
3959 v17 = (unsigned __int8)v4[16] - v16; | |
3960 v36 = v15; | |
3961 v31 = (*(float *)(v4 + 5) - *(float *)(v4 - 11)) * v15 + *(float *)(v4 - 11); | |
3962 v32 = (*(float *)(v4 + 9) - *(float *)(v4 - 7)) * v15 + *(float *)(v4 - 7); | |
3963 v39 = (double)v17 * v15; | |
3964 v18 = v39 + 6.7553994e15; | |
3965 v19 = (unsigned __int8)*v4; | |
3966 v39 = (double)((unsigned __int8)v4[15] - (unsigned int)(unsigned __int8)*(v4 - 1)) * v36; | |
3967 v20 = v39 + 6.7553994e15; | |
3968 v21 = (unsigned __int8)*(v4 - 2); | |
3969 v37 = LODWORD(v20) + (unsigned __int8)*(v4 - 1); | |
3970 v39 = (double)((unsigned int)(unsigned __int8)v4[14] - v21) * v36; | |
3971 v22 = v39 + 6.7553994e15; | |
3972 v23 = LODWORD(v22) + (unsigned __int8)*(v4 - 2); | |
3973 v39 = (double)((*(int *)(v4 + 13) & 0xFF) - (*(int *)(v4 - 3) & 0xFFu)) * v36; | |
3974 v24 = v39 + 6.7553994e15; | |
3975 v33 = (LODWORD(v24) + (*(int *)(v4 - 3) & 0xFF)) | ((v23 | ((v37 | ((LODWORD(v18) + v19) << 8)) << 8)) << 8); | |
3976 v25 = v40; | |
3977 *v40 = *(int *)v5; | |
3978 v26 = (int)(v5 + 4); | |
3979 ++v25; | |
3980 *v25 = *(int *)v26; | |
3981 v26 += 4; | |
3982 ++v25; | |
3983 ++v38; | |
3984 v40 += 4; | |
3985 *v25 = *(int *)v26; | |
3986 v25[1] = *(int *)(v26 + 4); | |
1418 | 3987 v5 = (char *)&v30 + 4; |
0 | 3988 } |
3989 v27 = v40; | |
3990 ++v38; | |
3991 *v40 = *(int *)v5; | |
3992 v28 = (int)(v5 + 4); | |
3993 ++v27; | |
3994 *v27 = *(int *)v28; | |
3995 v28 += 4; | |
3996 ++v27; | |
3997 v40 += 4; | |
3998 *v27 = *(int *)v28; | |
3999 v27[1] = *(int *)(v28 + 4); | |
4000 v4 += 16; | |
4001 --v34; | |
4002 if ( !v34 ) | |
1418 | 4003 return this->uNumVertices = v38; |
0 | 4004 } |
1418 | 4005 } |
1390 | 4006 return this->uNumVertices = v38; |
0 | 4007 } |
4008 | |
4009 //----- (00477C61) -------------------------------------------------------- | |
4010 int stru6_stru1_indoor_sw_billboard::sub_477C61() | |
4011 { | |
998 | 4012 //stru6_stru1_indoor_sw_billboard *v1; // ebx@1 |
0 | 4013 int v2; // ecx@2 |
4014 int v3; // eax@3 | |
4015 double v4; // st7@4 | |
4016 double v5; // st7@5 | |
4017 double v6; // st6@5 | |
4018 double v7; // st5@6 | |
4019 float v8; // ST30_4@8 | |
4020 float v9; // ST24_4@8 | |
4021 double v10; // st7@8 | |
4022 double v11; // st6@8 | |
4023 double v12; // st5@8 | |
4024 float v13; // ST24_4@13 | |
4025 int v14; // esi@13 | |
4026 char *v15; // esi@15 | |
4027 signed int v16; // eax@16 | |
4028 __int16 v17; // fps@16 | |
4029 unsigned __int8 v18; // c2@16 | |
4030 unsigned __int8 v19; // c3@16 | |
4031 double v20; // st6@16 | |
4032 float v21; // ST18_4@17 | |
4033 float v22; // ST2C_4@17 | |
4034 float v23; // ST34_4@17 | |
4035 float v24; // ST24_4@17 | |
4036 double v25; // st7@17 | |
4037 double v26; // st6@17 | |
4038 float v27; // ST34_4@18 | |
4039 float v28; // ST30_4@18 | |
4040 int v29; // eax@19 | |
4041 signed int v31; // [sp+8h] [bp-28h]@15 | |
4042 float v32; // [sp+Ch] [bp-24h]@16 | |
4043 float v33; // [sp+14h] [bp-1Ch]@16 | |
4044 float v34; // [sp+18h] [bp-18h]@16 | |
4045 float v35; // [sp+1Ch] [bp-14h]@17 | |
4046 float v36; // [sp+20h] [bp-10h]@4 | |
4047 float v37; // [sp+24h] [bp-Ch]@4 | |
4048 float v38; // [sp+24h] [bp-Ch]@16 | |
4049 float v39; // [sp+28h] [bp-8h]@9 | |
4050 float v40; // [sp+28h] [bp-8h]@16 | |
4051 float v41; // [sp+2Ch] [bp-4h]@6 | |
4052 float v42; // [sp+2Ch] [bp-4h]@9 | |
4053 | |
998 | 4054 //v1 = this; |
0 | 4055 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) |
4056 { | |
4057 v2 = 0; | |
1390 | 4058 if ( this->uNumVertices > 0 ) |
998 | 4059 { |
4060 v3 = (int)&this->field_14[1]; | |
0 | 4061 do |
4062 { | |
4063 v4 = *(float *)(v3 - 4); | |
4064 LODWORD(v37) = *(int *)v3; | |
4065 LODWORD(v36) = *(int *)(v3 + 4); | |
4066 if ( pBLVRenderParams->sPartyRotX ) | |
4067 { | |
4068 v5 = v4 - (double)pBLVRenderParams->vPartyPos.x; | |
4069 v6 = v37 - (double)pBLVRenderParams->vPartyPos.y; | |
4070 if ( pRenderer->pRenderD3D ) | |
4071 { | |
4072 v41 = pBLVRenderParams->fSineY * v6 + pBLVRenderParams->fCosineY * v5; | |
4073 v7 = pBLVRenderParams->fSineY * v5 - pBLVRenderParams->fCosineY * v6; | |
4074 } | |
4075 else | |
4076 { | |
4077 v41 = pBLVRenderParams->fCosineY * v5 - pBLVRenderParams->fSineY * v6; | |
4078 v7 = pBLVRenderParams->fSineY * v5 + pBLVRenderParams->fCosineY * v6; | |
4079 } | |
4080 v8 = v7; | |
4081 v9 = v36 - (double)pBLVRenderParams->vPartyPos.z; | |
4082 v10 = pBLVRenderParams->fCosineNegX * v41 - pBLVRenderParams->fSineNegX * v9; | |
4083 v11 = v8; | |
4084 v12 = pBLVRenderParams->fCosineNegX * v9 + pBLVRenderParams->fSineNegX * v41; | |
4085 } | |
4086 else | |
4087 { | |
4088 v42 = v4 - (double)pBLVRenderParams->vPartyPos.x; | |
4089 v39 = v37 - (double)pBLVRenderParams->vPartyPos.y; | |
4090 if ( pRenderer->pRenderD3D ) | |
4091 { | |
4092 v10 = pBLVRenderParams->fSineY * v39 + pBLVRenderParams->fCosineY * v42; | |
4093 v11 = pBLVRenderParams->fSineY * v42 - pBLVRenderParams->fCosineY * v39; | |
4094 } | |
4095 else | |
4096 { | |
4097 v10 = pBLVRenderParams->fCosineY * v42 - pBLVRenderParams->fSineY * v39; | |
4098 v11 = pBLVRenderParams->fSineY * v42 + pBLVRenderParams->fCosineY * v39; | |
4099 } | |
4100 v12 = v36 - (double)pBLVRenderParams->vPartyPos.z; | |
4101 } | |
4102 v13 = v12; | |
4103 ++v2; | |
4104 *(int *)(v3 + 84) = LODWORD(v13); | |
4105 v14 = *(int *)(v3 + 8); | |
4106 *(float *)(v3 + 76) = v10; | |
4107 *(int *)(v3 + 88) = v14; | |
4108 *(float *)(v3 + 80) = v11; | |
4109 v3 += 16; | |
4110 } | |
1390 | 4111 while ( v2 < this->uNumVertices ); |
0 | 4112 } |
4113 } | |
4114 else | |
4115 { | |
4116 v15 = (char *)&this->field_14[1]; | |
4117 v31 = 3; | |
4118 do | |
4119 { | |
323 | 4120 v40 = (double)stru_5C6E00->Cos(pIndoorCamera->sRotationX) * 0.0000152587890625; |
4121 v32 = (double)stru_5C6E00->Sin(pIndoorCamera->sRotationX) * 0.0000152587890625; | |
4122 v34 = (double)stru_5C6E00->Cos(pIndoorCamera->sRotationY) * 0.0000152587890625; | |
4123 v16 = stru_5C6E00->Sin(pIndoorCamera->sRotationY); | |
0 | 4124 LODWORD(v38) = *(int *)v15; |
4125 v33 = (double)v16 * 0.0000152587890625; | |
4126 //UNDEF(v17); | |
4127 v20 = *((float *)v15 - 1) - (double)pIndoorCamera->pos.x; | |
1090 | 4128 //if ( v19 | v18 ) |
4129 if(pIndoorCamera->pos.x == 0) | |
0 | 4130 { |
4131 v27 = v20; | |
4132 LODWORD(v35) = *((int *)v15 + 1); | |
4133 v28 = v38 - (double)pIndoorCamera->pos.y; | |
4134 v25 = v33 * v28 + v34 * v27; | |
4135 v26 = v34 * v28 - v33 * v27; | |
4136 } | |
4137 else | |
4138 { | |
4139 v21 = v20; | |
4140 v22 = v38 - (double)pIndoorCamera->pos.y; | |
4141 v23 = v33 * v22 + v34 * v21; | |
4142 v24 = *((float *)v15 + 1) - (double)pIndoorCamera->pos.z; | |
4143 v25 = v32 * v24 + v40 * v23; | |
4144 v26 = v34 * v22 - v33 * v21; | |
4145 v35 = v40 * v24 - v32 * v23; | |
4146 } | |
4147 *((int *)v15 + 21) = LODWORD(v35); | |
4148 v29 = *((int *)v15 + 2); | |
4149 *((float *)v15 + 19) = v25; | |
4150 *((int *)v15 + 22) = v29; | |
4151 *((float *)v15 + 20) = v26; | |
4152 v15 += 16; | |
4153 --v31; | |
4154 } | |
4155 while ( v31 ); | |
4156 } | |
1390 | 4157 this->uNumVertices = 3; |
0 | 4158 return 1; |
4159 } | |
4160 | |
4161 //----- (00477F63) -------------------------------------------------------- | |
4162 bool stru6_stru1_indoor_sw_billboard::sub_477F63() | |
4163 { | |
4164 signed int v1; // ebx@1 | |
4165 stru6_stru1_indoor_sw_billboard *v2; // esi@1 | |
4166 double v3; // st7@2 | |
4167 int v4; // edx@4 | |
4168 char *v5; // ecx@5 | |
4169 int v6; // edi@5 | |
4170 float v7; // ST08_4@13 | |
4171 signed int v9; // [sp+Ch] [bp-8h]@1 | |
4172 float v10; // [sp+10h] [bp-4h]@2 | |
4173 | |
4174 auto a1 = this; | |
4175 | |
4176 v1 = 0; | |
4177 v2 = a1; | |
4178 v9 = 0; | |
4179 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) | |
4180 { | |
4181 v10 = 16192.0; | |
4182 v3 = (double)pBLVRenderParams->field_40 * 0.000015258789; | |
4183 } | |
4184 else | |
4185 { | |
4186 v10 = (double)pOutdoorCamera->shading_dist_mist; | |
4187 v3 = 8.0; | |
4188 } | |
1390 | 4189 v4 = a1->uNumVertices; |
0 | 4190 if ( v4 <= 0 ) |
1418 | 4191 { |
4192 memcpy(&v2->field_14[40], &v2->field_14[20], 16 * v4); | |
4193 return v2->uNumVertices != 0; | |
4194 } | |
0 | 4195 v5 = (char *)&a1->field_14[20]; |
4196 v6 = v4; | |
4197 do | |
4198 { | |
4199 if ( v3 >= *(float *)v5 || *(float *)v5 >= (double)v10 ) | |
4200 { | |
4201 if ( v3 < *(float *)v5 ) | |
4202 v9 = 1; | |
4203 else | |
4204 v1 = 1; | |
4205 } | |
4206 v5 += 16; | |
4207 --v6; | |
4208 } | |
4209 while ( v6 ); | |
4210 if ( !v1 ) | |
4211 { | |
4212 if ( v9 ) | |
4213 { | |
4214 v2->_477927(v10); | |
1390 | 4215 return v2->uNumVertices != 0; |
0 | 4216 } |
4217 memcpy(&v2->field_14[40], &v2->field_14[20], 16 * v4); | |
1390 | 4218 return v2->uNumVertices != 0; |
0 | 4219 } |
4220 v7 = v3; | |
4221 _4775ED(v7); | |
1390 | 4222 return v2->uNumVertices != 0; |
0 | 4223 } |
4224 | |
4225 //----- (0047802A) -------------------------------------------------------- | |
4226 int stru6_stru1_indoor_sw_billboard::sub_47802A() | |
4227 { | |
4228 double v6; // st7@4 | |
4229 double v12; // st7@16 | |
4230 signed int v16; // [sp+38h] [bp-Ch]@1 | |
4231 int a6; // [sp+3Ch] [bp-8h]@5 | |
4232 int a5; // [sp+40h] [bp-4h]@5 | |
4233 | |
4234 auto a1 = this; | |
4235 | |
4236 v16 = 0; | |
4237 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) | |
4238 { | |
1390 | 4239 for(int i = 0; i < a1->uNumVertices; i++) |
1117
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4240 { |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4241 v6 = (double)pBLVRenderParams->field_40 * 0.000015258789 / a1->field_B4[i*4]; |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4242 if ( pRenderer->pRenderD3D ) |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4243 { |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4244 pGame->pIndoorCameraD3D->Project( |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4245 round(a1->field_B4[i*4]), |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4246 round(a1->field_B4[i*4+1]), |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4247 round(a1->field_B4[i*4+2]), |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4248 &a5, |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4249 &a6); |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4250 a1->field_B4[i*4+16] = (double)a5; |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4251 a1->field_B4[i*4+17] = (double)a6; |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4252 a1->field_B4[i*4+18] = round(a1->field_B4[i*4]); |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4253 } |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4254 else |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4255 { |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4256 a1->field_B4[i*4+16] = (double)pBLVRenderParams->uViewportCenterX - v6 * a1->field_B4[i*4+1]; |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4257 a1->field_B4[i*4+17] = (double)pBLVRenderParams->uViewportCenterY - v6 * a1->field_B4[i*4+2]; |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4258 a1->field_B4[i*4+18] = a1->field_B4[i*4]; |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4259 } |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4260 a1->field_B4[i*4+19] = a1->field_B4[i*4+3]; |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4261 if ( (double)(signed int)pViewport->uViewportTL_X <= a1->field_B4[i*4+16] |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4262 && (double)(signed int)pViewport->uViewportBR_X > a1->field_B4[i*4+16] |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4263 && (double)(signed int)pViewport->uViewportTL_Y <= a1->field_B4[i*4+17] |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4264 && (double)(signed int)pViewport->uViewportBR_Y > a1->field_B4[i*4+17] ) |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4265 v16 = 1; |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4266 } |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4267 } |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4268 else |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4269 { |
1390 | 4270 for(int i = 0; i < a1->uNumVertices; i++) |
1117
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4271 { |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4272 v12 = (double)pOutdoorCamera->int_fov_rad / a1->field_B4[i*4]; |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4273 a1->field_B4[i*4+20] = (double)pViewport->uScreenCenterX - v12 * a1->field_B4[i*4+1]; |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4274 a1->field_B4[i*4+21] = (double)pViewport->uScreenCenterY - v12 * a1->field_B4[i*4+2]; |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4275 *((int *)&a1->field_B4[i*4+22]) = (int)a1->field_B4[i*4]; |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4276 *((int *)&a1->field_B4[i*4+23]) = a1->field_B4[i*4+3]; |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4277 if ( (double)(signed int)pViewport->uViewportTL_X <= a1->field_B4[i*4+20] |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4278 && (double)(signed int)pViewport->uViewportBR_X > a1->field_B4[i*4+20] |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4279 && (double)(signed int)pViewport->uViewportTL_Y <= a1->field_B4[i*4+21] |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4280 && (double)(signed int)pViewport->uViewportBR_Y > a1->field_B4[i*4+21] ) |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4281 v16 = 1; |
0 | 4282 } |
4283 } | |
4284 return v16; | |
4285 } | |
4286 | |
4287 //----- (0047840D) -------------------------------------------------------- | |
4288 char Render::DrawBuildingsD3D() | |
4289 { | |
1395
8d4ec56416ef
Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents:
1391
diff
changeset
|
4290 //IndoorCameraD3D *v0; // eax@3 |
0 | 4291 char result; // al@3 |
79 | 4292 BSPModel *v2; // ebx@4 |
4293 int v3; // eax@6 | |
0 | 4294 ODMFace *pFace; // esi@6 |
79 | 4295 Vec3_int_ *v5; // ecx@8 |
0 | 4296 int v6; // eax@8 |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
4297 struct Polygon *v7; // ebx@8 |
0 | 4298 LightmapBuilder *v8; // eax@8 |
4299 int v9; // ecx@8 | |
4300 char v10; // zf@8 | |
4301 Texture *pFaceTexture; // eax@10 | |
4302 signed int v12; // ecx@10 | |
4303 unsigned int v13; // eax@14 | |
4304 unsigned int v14; // eax@18 | |
4305 unsigned int v15; // eax@22 | |
4306 unsigned int v16; // edi@22 | |
4307 int v17; // eax@24 | |
4308 int v18; // edi@34 | |
79 | 4309 RenderVertexSoft *v19; // eax@35 |
4310 unsigned short *v20; // ecx@35 | |
4311 unsigned short *v20b; // ecx@35 | |
4312 unsigned short *v20c; // ecx@35 | |
0 | 4313 Vec3_int_ *v21; // edx@36 |
4314 int v22; // edx@36 | |
79 | 4315 RenderVertexSoft *v23; // edi@37 |
0 | 4316 int v24; // eax@50 |
4317 int v25; // ecx@55 | |
4318 int v26; // eax@57 | |
4319 int v27; // eax@57 | |
4320 int v28; // eax@58 | |
1395
8d4ec56416ef
Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents:
1391
diff
changeset
|
4321 //int v29; // edx@58 |
8d4ec56416ef
Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents:
1391
diff
changeset
|
4322 //double v30; // st7@59 |
8d4ec56416ef
Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents:
1391
diff
changeset
|
4323 //LightmapBuilder *v31; // edi@63 |
0 | 4324 signed int v32; // eax@73 |
4325 int v33; // eax@78 | |
4326 unsigned int v34; // eax@80 | |
4327 std::string v35; // [sp-18h] [bp-70h]@2 | |
4328 int v36; // [sp-14h] [bp-6Ch]@69 | |
4329 RenderVertexSoft *v37; // [sp-10h] [bp-68h]@69 | |
4330 int v38; // [sp-Ch] [bp-64h]@69 | |
1395
8d4ec56416ef
Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents:
1391
diff
changeset
|
4331 //LightmapBuilder *v39; // [sp-8h] [bp-60h]@2 |
0 | 4332 int v40; // [sp-4h] [bp-5Ch]@2 |
1395
8d4ec56416ef
Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents:
1391
diff
changeset
|
4333 //std::string *v41; // [sp+Ch] [bp-4Ch]@2 |
79 | 4334 int v41b; |
4335 int v42; // [sp+10h] [bp-48h]@6 | |
0 | 4336 LightmapBuilder *pLightmapBuilder; // [sp+14h] [bp-44h]@8 |
4337 float v44; // [sp+18h] [bp-40h]@10 | |
4338 float v45; // [sp+1Ch] [bp-3Ch]@10 | |
4339 ODMFace *v46; // [sp+20h] [bp-38h]@6 | |
1395
8d4ec56416ef
Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents:
1391
diff
changeset
|
4340 //IndoorCameraD3D *v47; // [sp+24h] [bp-34h]@3 |
0 | 4341 unsigned int v48; // [sp+28h] [bp-30h]@8 |
4342 int v49; // [sp+2Ch] [bp-2Ch]@10 | |
4343 int v50; // [sp+30h] [bp-28h]@34 | |
4344 int v51; // [sp+34h] [bp-24h]@35 | |
4345 int v52; // [sp+38h] [bp-20h]@36 | |
4346 int v53; // [sp+3Ch] [bp-1Ch]@8 | |
4347 Vec3_int_ *v54; // [sp+40h] [bp-18h]@6 | |
4348 int a1; // [sp+44h] [bp-14h]@3 | |
79 | 4349 BSPModel *v56; // [sp+48h] [bp-10h]@4 |
0 | 4350 int uNumVertices; // [sp+4Ch] [bp-Ch]@34 |
4351 int unused; // [sp+50h] [bp-8h]@3 | |
4352 int a3; // [sp+57h] [bp-1h]@2 | |
4353 | |
4354 if ( !pRenderer->pRenderD3D ) | |
4355 { | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
4356 MessageBoxW(nullptr, L"D3D version of RenderBuildings called in software!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odbuild.cpp:73", 0); |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
4357 } |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
4358 |
0 | 4359 unused = 0; |
4360 a1 = 0; | |
4361 result = LOBYTE(pOutdoor->pBModels); | |
79 | 4362 v41b = pOutdoor->uNumBModels; |
0 | 4363 if ( (signed int)pOutdoor->uNumBModels > 0 ) |
4364 { | |
79 | 4365 v2 = pOutdoor->pBModels; |
4366 v56 = pOutdoor->pBModels; | |
0 | 4367 while ( 1 ) |
4368 { | |
4369 if ( IsBModelVisible(a1, &unused) ) | |
4370 { | |
79 | 4371 v2->field_40 |= 1u; |
4372 v3 = v2->uNumFaces; | |
4373 pFace = v2->pFaces; | |
0 | 4374 v54 = 0; |
4375 v46 = pFace; | |
4376 v42 = v3; | |
79 | 4377 if ( v3 > 0 ) |
0 | 4378 break; |
4379 } | |
4380 LABEL_86: | |
4381 ++a1; | |
79 | 4382 ++v2;// += 47; |
0 | 4383 result = a1; |
4384 v56 = v2; | |
79 | 4385 if ( a1 >= v41b ) |
0 | 4386 return result; |
4387 } | |
4388 while ( 1 ) | |
4389 { | |
4390 if (pFace->Invisible()) | |
4391 goto LABEL_85; | |
79 | 4392 //v5 = (int)*(v2 - 1); |
4393 v5 = v2->pVertices.pVertices; | |
0 | 4394 v6 = pFace->pVertexIDs[0]; |
4395 v53 = 0; | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
4396 v7 = &array_77EC08[pOutdoorCamera->uNumPolygons]; |
79 | 4397 //v8 = *(LightmapBuilder **)(v5 + 12 * v6 + 8); |
4398 v8 = (LightmapBuilder *)v5[v6].z; | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
4399 v7->flags = 0; |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
4400 v7->field_32 = 0; |
0 | 4401 pLightmapBuilder = v8; |
4402 v9 = pFace->uTextureID; | |
4403 v10 = (BYTE1(pFace->uAttributes) & 0x40) == 0; | |
4404 v48 = pFace->uTextureID; | |
4405 if ( !v10 ) | |
4406 { | |
4407 v48 = pTextureFrameTable->GetFrameTexture(v9, pEventTimer->uTotalGameTimeElapsed); | |
4408 v9 = v48; | |
4409 } | |
945 | 4410 pFaceTexture = pBitmaps_LOD->GetTexture(v9); |
0 | 4411 v7->pTexture = pFaceTexture; |
945 | 4412 v12 = pFaceTexture->uTextureWidth; |
0 | 4413 v49 = v12; |
4414 v49 = pFaceTexture->uTextureHeight; | |
4415 v10 = (pFace->uAttributes & 0x10) == 0; | |
4416 v45 = 1.0 / (double)v12; | |
4417 v44 = 1.0 / (double)v49; | |
4418 if ( !v10 ) | |
4419 *(int *)&v7->flags |= 2u; | |
4420 if ( BYTE2(pFace->uAttributes) & 0x40 ) | |
4421 HIBYTE(v7->flags) |= 4u; | |
4422 v13 = pFace->uAttributes; | |
4423 if ( v13 & 4 ) | |
4424 { | |
4425 HIBYTE(v7->flags) |= 4u; | |
4426 } | |
4427 else | |
4428 { | |
4429 if ( v13 & 0x20 ) | |
4430 HIBYTE(v7->flags) |= 8u; | |
4431 } | |
4432 v14 = pFace->uAttributes; | |
4433 if ( BYTE1(v14) & 8 ) | |
4434 { | |
4435 *(int *)&v7->flags |= 0x2000u; | |
4436 } | |
4437 else | |
4438 { | |
4439 if ( v14 & 0x40 ) | |
4440 HIBYTE(v7->flags) |= 0x10u; | |
4441 } | |
4442 v15 = GetTickCount(); | |
4443 v7->sTextureDeltaU = pFace->sTextureDeltaU; | |
4444 v7->sTextureDeltaV = pFace->sTextureDeltaV; | |
4445 v16 = v15 >> 4; | |
4446 if ( pFace->pFacePlane.vNormal.z && (v40 = pFace->pFacePlane.vNormal.z, abs(v40) >= 59082) ) | |
4447 { | |
4448 v17 = *(int *)&v7->flags; | |
4449 if ( BYTE1(v17) & 4 ) | |
4450 goto LABEL_29; | |
4451 if ( BYTE1(v17) & 8 ) | |
4452 { | |
4453 LABEL_26: | |
4454 v7->sTextureDeltaV -= v16 & v7->pTexture->uHeightMinus1; | |
4455 goto LABEL_30; | |
4456 } | |
4457 } | |
4458 else | |
4459 { | |
4460 v17 = *(int *)&v7->flags; | |
4461 if ( BYTE1(v17) & 4 ) | |
4462 goto LABEL_26; | |
4463 if ( BYTE1(v17) & 8 ) | |
4464 { | |
4465 LABEL_29: | |
4466 v7->sTextureDeltaV += v16 & v7->pTexture->uHeightMinus1; | |
4467 goto LABEL_30; | |
4468 } | |
4469 } | |
4470 LABEL_30: | |
4471 if ( BYTE1(v17) & 0x10 ) | |
4472 { | |
4473 v7->sTextureDeltaU -= v16 & v7->pTexture->uWidthMinus1; | |
4474 } | |
4475 else | |
4476 { | |
4477 if ( BYTE1(v17) & 0x20 ) | |
4478 v7->sTextureDeltaU += v16 & v7->pTexture->uWidthMinus1; | |
4479 } | |
4480 v18 = pFace->uNumVertices; | |
4481 v50 = 0; | |
4482 v49 = 0; | |
4483 uNumVertices = v18; | |
4484 if ( v18 > 0 ) | |
4485 { | |
79 | 4486 //v19 = (char *)&array_73D150[0].vWorldPosition.z; |
4487 //v20 = (char *)pFace->pTextureUIDs; | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
4488 v19 = array_73D150; |
79 | 4489 v20 = pFace->pTextureUIDs; |
4490 v20b = pFace->pVertexIDs; | |
4491 v20c = pFace->pTextureVIDs; | |
0 | 4492 v51 = v18; |
4493 do | |
4494 { | |
79 | 4495 /* v21 = &(*(v56 - 1))[*((short *)v20 - 20)]; |
0 | 4496 *((float *)v19 - 2) = (double)v21->x; |
4497 *((float *)v19 - 1) = (double)v21->y; | |
4498 *(float *)v19 = (double)v21->z; | |
4499 v19 += 48; | |
4500 v52 = v7->sTextureDeltaU + *(short *)v20; | |
4501 *((float *)v19 - 5) = (double)v52 * v45; | |
4502 v22 = v7->sTextureDeltaV + *((short *)v20 + 20); | |
4503 v20 += 2; | |
4504 v10 = v51-- == 1; | |
4505 v52 = v22; | |
79 | 4506 *((float *)v19 - 4) = (double)v22 * v44;*/ |
4507 | |
4508 //v21 = (BSPVertexBuffer *)(*((_DWORD *)v56 - 1) + 12 * *(v20 - 20)); | |
4509 v21 = &v56->pVertices.pVertices[*v20b]; | |
4510 //*((float *)v19 - 2) = (double)v21->x; | |
4511 //*((float *)v19 - 1) = (double)v21->y; | |
4512 v19->vWorldPosition.x = (double)v21->x; | |
4513 v19->vWorldPosition.y = (double)v21->y; | |
4514 v19->vWorldPosition.z = (double)v21->z; | |
4515 ++v19; | |
4516 v52 = v7->sTextureDeltaU + (signed __int16)*v20; | |
4517 //*((float *)v19 - 5) = (double)v52 * v45; | |
4518 (v19-1)->u = (double)v52 * v45; | |
4519 v22 = v7->sTextureDeltaV + (signed __int16)*v20c; | |
4520 ++v20; | |
4521 ++v20b; | |
4522 ++v20c; | |
4523 v10 = v51-- == 1; | |
4524 v52 = v22; | |
4525 //*((float *)v19 - 4) = (double)v22 * v44; | |
4526 (v19-1)->v = (double)v22 * v44; | |
0 | 4527 } |
4528 while ( !v10 ); | |
79 | 4529 //v23 = (char *)&array_73D150[0].vWorldViewPosition; |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
4530 v23 = array_73D150; |
0 | 4531 v51 = uNumVertices; |
4532 *(float *)&pLightmapBuilder = (double)(signed int)pLightmapBuilder; | |
4533 do | |
4534 { | |
79 | 4535 //if ( *(float *)&pLightmapBuilder == *((float *)v23 - 1) ) |
4536 if ( *(float *)&pLightmapBuilder == v23->vWorldPosition.z ) | |
0 | 4537 ++v53; |
79 | 4538 //v47->ViewTransform((RenderVertexSoft *)(v23 - 12), 1u); |
1395
8d4ec56416ef
Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents:
1391
diff
changeset
|
4539 pGame->pIndoorCameraD3D->ViewTransform(v23, 1u); |
79 | 4540 if ( v23->vWorldViewPosition.x < 8.0 || (double)pOutdoorCamera->shading_dist_mist < v23->vWorldViewPosition.x ) |
4541 { | |
4542 if ( v23->vWorldViewPosition.x >= 8.0 ) | |
0 | 4543 v49 = 1; |
4544 else | |
4545 v50 = 1; | |
4546 } | |
4547 else | |
4548 { | |
1395
8d4ec56416ef
Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents:
1391
diff
changeset
|
4549 pGame->pIndoorCameraD3D->Project(v23, 1u, 0); |
79 | 4550 } |
4551 ++v23;// += 48; | |
0 | 4552 --v51; |
4553 } | |
4554 while ( v51 ); | |
4555 v18 = uNumVertices; | |
4556 } | |
4557 if ( v53 == v18 ) | |
4558 LOBYTE(v7->field_32) |= 1u; | |
4559 v24 = pOutdoor->vSunlight.x; | |
4560 v7->pODMFace = pFace; | |
4561 v7->uNumVertices = v18; | |
4562 v7->field_59 = 5; | |
4563 pLightmapBuilder = (LightmapBuilder *)-v24; | |
4564 v51 = pFace->pFacePlane.vNormal.x; | |
4565 v51 = (unsigned __int64)(-v24 * (signed __int64)v51) >> 16; | |
4566 v53 = pFace->pFacePlane.vNormal.y; | |
4567 pLightmapBuilder = (LightmapBuilder *)-pOutdoor->vSunlight.y; | |
4568 v53 = (unsigned __int64)(-pOutdoor->vSunlight.y * (signed __int64)v53) >> 16; | |
4569 v52 = pFace->pFacePlane.vNormal.z; | |
4570 v52 = (unsigned __int64)(-pOutdoor->vSunlight.z * (signed __int64)v52) >> 16; | |
4571 pLightmapBuilder = (LightmapBuilder *)(v51 + v53 + v52); | |
4572 v51 = 20 * (int)pLightmapBuilder; | |
4573 result = 20 - (20 * (signed int)pLightmapBuilder >> 16); | |
638 | 4574 v7->dimming_level = result; |
0 | 4575 if ( result < 0 ) |
638 | 4576 v7->dimming_level = 0; |
4577 if ( v7->dimming_level > 31 ) | |
4578 v7->dimming_level = 31; | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
4579 if ( pOutdoorCamera->uNumPolygons >= 1999 + 5000) |
0 | 4580 return result; |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
4581 ++pOutdoorCamera->uNumPolygons; |
0 | 4582 ++pOutdoorCamera->field_44; |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
4583 if ( ODMFace::IsBackfaceCulled(pFace, array_73D150, v7) ) |
0 | 4584 { |
4585 LOBYTE(v25) = (char)v54; | |
4586 v26 = a1; | |
4587 pFace->bVisible = 1; | |
4588 v7->uBModelFaceID = v25; | |
4589 LOWORD(v25) = (unsigned __int8)v25; | |
4590 v7->uBModelID = v26; | |
4591 v27 = 8 * (v25 | (v26 << 6)); | |
4592 LOBYTE(v27) = v27 | 6; | |
4593 v7->field_50 = v27; | |
1395
8d4ec56416ef
Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents:
1391
diff
changeset
|
4594 |
8d4ec56416ef
Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents:
1391
diff
changeset
|
4595 for (v28 = 0; v28 < v18; ++v28) |
0 | 4596 { |
4597 memcpy(&array_50AC10[v28], &array_73D150[v28], sizeof(array_50AC10[v28])); | |
1395
8d4ec56416ef
Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents:
1391
diff
changeset
|
4598 array_50AC10[v28]._rhw = 1.0 / (array_73D150[v28].vWorldViewPosition.x + 0.0000001); |
8d4ec56416ef
Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents:
1391
diff
changeset
|
4599 |
0 | 4600 pFace = v46; |
4601 } | |
4602 | |
4603 static stru154 static_RenderBuildingsD3D_stru_73C834; | |
4604 /*static bool __init_flag = false; | |
4605 if (!__init_flag) | |
4606 { | |
4607 __init_flag = true; | |
4608 | |
4609 static_RenderBuildingsD3D_byte_73C84C_init_flag |= 1u; | |
4610 stru154::stru154(&static_RenderBuildingsD3D_stru_73C834); | |
4611 atexit(loc_4789D4); | |
4612 }*/ | |
4613 | |
4614 v40 = (int)pFace; | |
1395
8d4ec56416ef
Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents:
1391
diff
changeset
|
4615 pGame->pLightmapBuilder->ApplyLights_OutdoorFace(pFace); |
0 | 4616 pDecalBuilder->ApplyDecals_OutdoorFace(pFace); |
1395
8d4ec56416ef
Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents:
1391
diff
changeset
|
4617 pGame->pLightmapBuilder->std__vector_000004_size = 0; |
8d4ec56416ef
Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents:
1391
diff
changeset
|
4618 |
8d4ec56416ef
Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents:
1391
diff
changeset
|
4619 int v31 = 0; |
0 | 4620 if ( stru_F8AD28.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0 ) |
4621 { | |
1395
8d4ec56416ef
Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents:
1391
diff
changeset
|
4622 v31 = v50 ? 3 : v49 != 0 ? 5 : 0; |
866 | 4623 static_RenderBuildingsD3D_stru_73C834.GetFacePlaneAndClassify(pFace, &v56->pVertices); |
0 | 4624 if ( pDecalBuilder->uNumDecals > 0 ) |
4625 { | |
4626 v40 = -1; | |
4627 v38 = 0; | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
4628 v37 = array_50AC10; |
0 | 4629 v36 = uNumVertices; |
638 | 4630 pDecalBuilder->ApplyDecals(31 - v7->dimming_level, |
0 | 4631 2, |
4632 &static_RenderBuildingsD3D_stru_73C834, | |
4633 uNumVertices, | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
4634 array_50AC10, |
0 | 4635 0, |
4636 (char)v31, | |
4637 -1); | |
4638 } | |
4639 } | |
4640 if ( stru_F8AD28.uNumLightsApplied > 0 ) | |
1395
8d4ec56416ef
Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents:
1391
diff
changeset
|
4641 pGame->pLightmapBuilder->ApplyLights( |
0 | 4642 &stru_F8AD28, |
4643 &static_RenderBuildingsD3D_stru_73C834, | |
4644 uNumVertices, | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
4645 array_50AC10, |
0 | 4646 0, |
4647 (char)v31); | |
4648 if ( v50 ) | |
4649 { | |
4650 v32 = sr_424CD7(uNumVertices); | |
4651 goto LABEL_76; | |
4652 } | |
4653 if ( v49 ) | |
4654 { | |
4655 v32 = sr_424EE0_MakeFanFromTriangle(uNumVertices); | |
4656 LABEL_76: | |
4657 v7->uNumVertices = v32; | |
4658 uNumVertices = v32; | |
4659 OutdoorCamera::Project(v32); | |
4660 } | |
4661 if ( uNumVertices ) | |
4662 { | |
4663 v33 = *(int *)&v7->flags; | |
4664 if ( v33 & 2 ) | |
4665 { | |
4666 if ( BYTE1(v33) & 0x3C ) | |
4667 v34 = pRenderer->pHDWaterBitmapIDs[0]; | |
4668 else | |
265 | 4669 v34 = pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_current_frame]; |
0 | 4670 v40 = (int)pBitmaps_LOD->pHardwareTextures[v34]; |
4671 } | |
4672 else | |
4673 { | |
4674 v40 = (int)pBitmaps_LOD->pHardwareTextures[v48]; | |
4675 } | |
4676 pRenderer->DrawPolygon(uNumVertices, v7, pFace, (IDirect3DTexture2 *)v40); | |
4677 } | |
4678 goto LABEL_85; | |
4679 } | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
4680 --pOutdoorCamera->uNumPolygons; |
0 | 4681 --pOutdoorCamera->field_44; |
4682 LABEL_85: | |
4683 v54 = (Vec3_int_ *)((char *)v54 + 1); | |
4684 v2 = v56; | |
4685 ++pFace; | |
4686 v46 = pFace; | |
4687 if ( (signed int)v54 >= (signed int)v42 ) | |
4688 goto LABEL_86; | |
4689 } | |
4690 } | |
4691 return result; | |
4692 } | |
4693 // 73C84C: using guessed type char static_RenderBuildingsD3D_byte_73C84C_init_flag; | |
4694 | |
4695 | |
4696 //----- (00479089) -------------------------------------------------------- | |
323 | 4697 bool __fastcall IsBModelVisible(unsigned int uModelID, int *reachable) |
0 | 4698 { |
4699 BSPModel *v2; // eax@1 | |
4700 int v3; // edi@1 | |
4701 int v4; // ebx@1 | |
4702 int v5; // ST28_4@1 | |
4703 int v6; // ecx@1 | |
4704 int v7; // ebx@3 | |
4705 int v8; // eax@3 | |
4706 int v9; // eax@3 | |
323 | 4707 //int v10; // ebx@3 |
0 | 4708 signed int v11; // esi@6 |
4709 int v12; // esi@8 | |
4710 bool result; // eax@9 | |
323 | 4711 //unsigned int v14; // [sp+Ch] [bp-20h]@1 |
0 | 4712 int v15; // [sp+Ch] [bp-20h]@5 |
323 | 4713 //int *v16; // [sp+10h] [bp-1Ch]@1 |
0 | 4714 int v17; // [sp+1Ch] [bp-10h]@1 |
4715 int v18; // [sp+20h] [bp-Ch]@1 | |
4716 int v19; // [sp+20h] [bp-Ch]@3 | |
4717 int angle; // [sp+24h] [bp-8h]@1 | |
4718 int v21; // [sp+28h] [bp-4h]@1 | |
323 | 4719 //int v22; // [sp+28h] [bp-4h]@3 |
4720 | |
4721 //v16 = unused; | |
0 | 4722 angle = (signed int)(pOutdoorCamera->uCameraFovInDegrees << 11) / 360 >> 1; |
323 | 4723 //v14 = uModelID; |
0 | 4724 v2 = &pOutdoor->pBModels[uModelID]; |
4725 v3 = v2->vBoundingCenter.x - pIndoorCamera->pos.x; | |
4726 v4 = v2->vBoundingCenter.y - pIndoorCamera->pos.y; | |
323 | 4727 v5 = stru_5C6E00->Cos(pIndoorCamera->sRotationY); |
4728 v21 = stru_5C6E00->Sin(pIndoorCamera->sRotationY); | |
4729 v18 = stru_5C6E00->Cos(pIndoorCamera->sRotationX); | |
4730 stru_5C6E00->Sin(pIndoorCamera->sRotationX); | |
0 | 4731 v6 = v5; |
4732 v17 = v3 * v5 + v4 * v21; | |
4733 if ( pIndoorCamera->sRotationX ) | |
4734 v17 = (unsigned __int64)(v17 * (signed __int64)v18) >> 16; | |
4735 v19 = v4 * v6 - v3 * v21; | |
4736 v7 = abs(v4); | |
4737 v8 = abs(v3); | |
322 | 4738 v9 = int_get_vector_length(v8, v7, 0); |
323 | 4739 //v10 = v14 * 188; |
4740 //v22 = v9; | |
4741 *reachable = false; | |
4742 if ( v9 < pOutdoor->pBModels[uModelID].sBoundingRadius + 256 ) | |
4743 *reachable = true; | |
4744 v15 = stru_5C6E00->Sin(angle); | |
0 | 4745 if ( v19 >= 0 ) |
323 | 4746 v11 = ((unsigned __int64)(v15 * (signed __int64)v17) >> 16) - ((unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)v19) >> 16); |
4747 else | |
4748 v11 = ((unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)v19) >> 16) + ((unsigned __int64)(v15 * (signed __int64)v17) >> 16); | |
0 | 4749 v12 = v11 >> 16; |
323 | 4750 if ( v9 <= pOutdoorCamera->shading_dist_mist + 2048 ) |
0 | 4751 { |
79 | 4752 //if ( abs(v12) > *(int *)((char *)&pOutdoor->pBModels->sBoundingRadius + v10) + 512 ) |
323 | 4753 if ( abs(v12) > pOutdoor->pBModels[uModelID].sBoundingRadius + 512 ) |
0 | 4754 { |
4755 result = v12 < 0; | |
4756 LOBYTE(result) = v12 >= 0; | |
323 | 4757 return result; |
4758 } | |
4759 else | |
4760 return true; | |
4761 } | |
4762 return false; | |
0 | 4763 } |
4764 | |
4765 //----- (00479295) -------------------------------------------------------- | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
4766 int Polygon::_479295() |
0 | 4767 { |
4768 ODMFace *v2; // esi@1 | |
4769 int v3; // ecx@4 | |
4770 int v4; // eax@4 | |
4771 int v5; // edx@4 | |
4772 int v6; // ST14_4@5 | |
4773 int v7; // ST04_4@5 | |
4774 stru149 *v8; // ecx@5 | |
4775 Vec3_int_ thisa; // [sp+Ch] [bp-10h]@8 | |
4776 int v11; // [sp+18h] [bp-4h]@4 | |
4777 | |
4778 v2 = this->pODMFace; | |
4779 if ( !v2->pFacePlane.vNormal.z ) | |
4780 { | |
4781 v3 = v2->pFacePlane.vNormal.x; | |
4782 v4 = -v2->pFacePlane.vNormal.y; | |
4783 v5 = 0; | |
4784 v11 = 65536; | |
1418 | 4785 } |
4786 else if ( (v2->pFacePlane.vNormal.x || v2->pFacePlane.vNormal.y) && abs(v2->pFacePlane.vNormal.z) < 59082 ) | |
0 | 4787 { |
4788 thisa.x = -v2->pFacePlane.vNormal.y; | |
4789 thisa.y = v2->pFacePlane.vNormal.x; | |
4790 thisa.z = 0; | |
4791 thisa.Normalize_float(); | |
4792 v4 = thisa.x; | |
4793 v3 = thisa.y; | |
1418 | 4794 v5 = 0; |
4795 v11 = 65536; | |
4796 } | |
4797 else | |
4798 { | |
4799 v3 = 0; | |
4800 v4 = 65536; | |
4801 v11 = 0; | |
4802 v5 = -65536; | |
4803 } | |
0 | 4804 v6 = v11; |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
4805 sTextureDeltaU = v2->sTextureDeltaU; |
0 | 4806 v7 = v3; |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
4807 v8 = ptr_38; |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
4808 sTextureDeltaV = v2->sTextureDeltaV; |
1544 | 4809 v8->_48616B_frustum_odm(v4, v7, 0, 0, v5, v6); |
0 | 4810 return 1; |
4811 } | |
4812 | |
4813 | |
168 | 4814 unsigned short *LoadTgaTexture(const wchar_t *filename, int *out_width = nullptr, int *out_height = nullptr) |
4815 { | |
4816 #pragma pack(push, 1) | |
4817 struct TGAHeader | |
4818 { | |
4819 unsigned char tgaSkip; | |
4820 unsigned char colourmaptype; // type of colour map 0=none, 1=has palette | |
4821 unsigned char tgaType; // type of image 0=none,1=indexed,2=rgb,3=grey,+8=rle packed | |
4822 | |
4823 short colourmapstart; // first colour map entry in palette | |
4824 short colourmaplength; // number of colours in palette | |
4825 char colourmapbits; // number of bits per palette entry 15,16,24,32 | |
4826 | |
4827 //unsigned char tgaDontCare2[9]; | |
4828 short xstart; // image x origin | |
4829 short ystart; // image y origin | |
4830 | |
4831 unsigned short tgaWidth; | |
4832 unsigned short tgaHeight; | |
4833 unsigned char tgaBPP; | |
4834 | |
4835 char descriptor; // image descriptor bits: 00vhaaaa | |
4836 // h horizontal flip | |
4837 // v vertical flip | |
4838 // a alpha bits | |
4839 }; | |
4840 #pragma pack(pop) | |
4841 | |
4842 if (out_width) | |
4843 *out_width = 0; | |
4844 if (out_height) | |
4845 *out_height = 0; | |
4846 | |
4847 DWORD w; | |
4848 auto file = CreateFileW(filename, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr); | |
4849 if (file == INVALID_HANDLE_VALUE) | |
4850 return nullptr; | |
4851 | |
4852 TGAHeader header; | |
4853 ReadFile(file, &header, sizeof(header), &w, nullptr); | |
4854 SetFilePointer(file, header.tgaSkip, nullptr, FILE_CURRENT); | |
4855 | |
4856 if (header.tgaBPP != 24 || header.tgaType != 2) | |
4857 { | |
4858 CloseHandle(file); | |
4859 return nullptr; | |
4860 } | |
4861 | |
4862 int imgSize = header.tgaWidth * header.tgaHeight * 3; | |
4863 auto pixels = new unsigned char[imgSize]; | |
4864 ReadFile(file, pixels, imgSize, &w, nullptr); | |
4865 CloseHandle(file); | |
4866 | |
4867 if (w != imgSize) | |
4868 { | |
4869 delete [] pixels; | |
4870 return nullptr; | |
4871 } | |
4872 | |
4873 if (out_width) | |
4874 *out_width = header.tgaWidth; | |
4875 if (out_height) | |
4876 *out_height = header.tgaHeight; | |
4877 | |
4878 auto pixels_16bit = new unsigned short[imgSize / 3]; | |
4879 for (int i = 0; i < imgSize / 3; ++i) | |
4880 { | |
4881 pixels_16bit[i] = (pixels[i * 3] / 8 & 0x1F) | | |
4882 ((pixels[i * 3 + 1] / 4 & 0x3F) << 5) | | |
4883 ((pixels[i * 3 + 2] / 8 & 0x1F) << 11); | |
4884 } | |
4885 delete [] pixels; | |
4886 return pixels_16bit; | |
4887 } | |
4888 | |
4889 unsigned short *skybox_xn, *skybox_xp, | |
4890 *skybox_yn, *skybox_yp, | |
4891 *skybox_zn, *skybox_zp; | |
4892 int skybox_width, skybox_height; | |
781 | 4893 |
168 | 4894 IDirect3DTexture2 *skybox_texture; |
4895 IDirectDrawSurface4 *skybox_surface; | |
781 | 4896 |
168 | 4897 bool Skybox_Initialize(const wchar_t *skybox_name) |
4898 { | |
4899 wchar_t xn_filename[1024], xp_filename[1024], | |
4900 yn_filename[1024], yp_filename[1024], | |
4901 zn_filename[1024], zp_filename[1024]; | |
1165
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1160
diff
changeset
|
4902 swprintf(xn_filename, wcslen(L"%s_xn.tga"), L"%s_xn.tga", skybox_name); swprintf(xp_filename, wcslen(L"%s_xp.tga"), L"%s_xp.tga", skybox_name); |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1160
diff
changeset
|
4903 swprintf(yn_filename, wcslen(L"%s_yn.tga"), L"%s_yn.tga", skybox_name); swprintf(yp_filename, wcslen(L"%s_yp.tga"), L"%s_yp.tga", skybox_name); |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1160
diff
changeset
|
4904 swprintf(zn_filename, wcslen(L"%s_zn.tga"), L"%s_zn.tga", skybox_name); swprintf(zp_filename, wcslen(L"%s_zp.tga"), L"%s_zp.tga", skybox_name); |
168 | 4905 |
4906 int xn_width, xn_height; | |
4907 skybox_xn = LoadTgaTexture(xn_filename, &xn_width, &xn_height); | |
4908 if (!skybox_xn) | |
4909 return false; | |
4910 | |
4911 int xp_width, xp_height; | |
4912 skybox_xp = LoadTgaTexture(xp_filename, &xp_width, &xp_height); | |
4913 if (!skybox_xp || xp_width != xn_width || xp_height != xn_height) | |
4914 { | |
4915 delete [] skybox_xn; | |
4916 if (skybox_xp) delete [] skybox_xp; | |
4917 return false; | |
4918 } | |
4919 | |
4920 int yn_width, yn_height; | |
4921 skybox_yn = LoadTgaTexture(yn_filename, &yn_width, &yn_height); | |
4922 if (!skybox_yn || yn_width != xn_width || yn_height != xn_height) | |
4923 { | |
4924 delete [] skybox_xn; | |
4925 if (skybox_xp) delete [] skybox_xp; | |
4926 if (skybox_yn) delete [] skybox_yn; | |
4927 return false; | |
4928 } | |
4929 | |
4930 int yp_width, yp_height; | |
4931 skybox_yp = LoadTgaTexture(yp_filename, &yp_width, &yp_height); | |
4932 if (!skybox_yp || yp_width != xn_width || yp_height != xn_height) | |
4933 { | |
4934 delete [] skybox_xn; | |
4935 if (skybox_xp) delete [] skybox_xp; | |
4936 if (skybox_yn) delete [] skybox_yn; | |
4937 if (skybox_yp) delete [] skybox_yp; | |
4938 return false; | |
4939 } | |
4940 | |
4941 int zn_width, zn_height; | |
4942 skybox_zn = LoadTgaTexture(zn_filename, &zn_width, &zn_height); | |
4943 if (!skybox_zn || zn_width != xn_width || zn_height != xn_height) | |
4944 { | |
4945 delete [] skybox_xn; | |
4946 if (skybox_xp) delete [] skybox_xp; | |
4947 if (skybox_yn) delete [] skybox_yn; | |
4948 if (skybox_yp) delete [] skybox_yp; | |
4949 if (skybox_zn) delete [] skybox_zn; | |
4950 return false; | |
4951 } | |
4952 | |
4953 int zp_width, zp_height; | |
4954 skybox_zp = LoadTgaTexture(zp_filename, &zp_width, &zp_height); | |
4955 if (!skybox_zp || zp_width != xn_width || zp_height != xn_height) | |
4956 { | |
4957 delete [] skybox_xn; | |
4958 if (skybox_xp) delete [] skybox_xp; | |
4959 if (skybox_yn) delete [] skybox_yn; | |
4960 if (skybox_yp) delete [] skybox_yp; | |
4961 if (skybox_zn) delete [] skybox_zn; | |
4962 if (skybox_zp) delete [] skybox_zp; | |
4963 return false; | |
4964 } | |
4965 | |
4966 skybox_width = xn_width; | |
4967 skybox_height = xn_height; | |
4968 | |
4969 | |
4970 if (!pRenderer->pRenderD3D->CreateTexture(skybox_width, skybox_height, &skybox_surface, &skybox_texture, | |
4971 false, false, pRenderer->uMinDeviceTextureDim)) | |
4972 return false; | |
4973 | |
4974 return true; | |
4975 } | |
4976 | |
4977 struct vector | |
4978 { | |
4979 float x, y, z; | |
4980 }; | |
781 | 4981 |
168 | 4982 struct matrix |
4983 { | |
4984 float m[4][4]; | |
4985 }; | |
781 | 4986 |
168 | 4987 void VectorNormalize(vector *v) |
4988 { | |
4989 float invmag = 1.0f / sqrtf(v->x * v->x + v->y * v->y + v->z * v->z); | |
4990 v->x *= invmag; | |
4991 v->y *= invmag; | |
4992 v->z *= invmag; | |
4993 } | |
781 | 4994 |
168 | 4995 void MatrixRotationAxis(matrix *pout, CONST vector *pv, float angle) |
4996 { | |
4997 memset(pout, 0, sizeof(matrix)); | |
4998 pout->m[3][0] = 0; | |
4999 pout->m[3][1] = 0; | |
5000 pout->m[3][2] = 0; | |
5001 pout->m[3][3] = 1; | |
5002 | |
5003 vector v; | |
5004 v.x = pv->x; v.y = pv->y; v.z = pv->z; | |
5005 VectorNormalize(&v); | |
5006 | |
5007 pout->m[0][0] = (1.0f - cos(angle)) * v.x * v.x + cos(angle); | |
5008 pout->m[1][0] = (1.0f - cos(angle)) * v.x * v.y - sin(angle) * v.z; | |
5009 pout->m[2][0] = (1.0f - cos(angle)) * v.x * v.z + sin(angle) * v.y; | |
5010 pout->m[0][1] = (1.0f - cos(angle)) * v.y * v.x + sin(angle) * v.z; | |
5011 pout->m[1][1] = (1.0f - cos(angle)) * v.y * v.y + cos(angle); | |
5012 pout->m[2][1] = (1.0f - cos(angle)) * v.y * v.z - sin(angle) * v.x; | |
5013 pout->m[0][2] = (1.0f - cos(angle)) * v.z * v.x - sin(angle) * v.y; | |
5014 pout->m[1][2] = (1.0f - cos(angle)) * v.z * v.y + sin(angle) * v.x; | |
5015 pout->m[2][2] = (1.0f - cos(angle)) * v.z * v.z + cos(angle); | |
5016 } | |
781 | 5017 |
168 | 5018 void VectorTransform(const matrix *m, const vector *v, vector *out) |
5019 { | |
5020 out->x = m->m[0][0] * v->x + m->m[1][0] * v->y + m->m[2][0] * v->z + m->m[3][0]; | |
5021 out->y = m->m[0][1] * v->x + m->m[1][1] * v->y + m->m[2][1] * v->z + m->m[3][1]; | |
5022 out->z = m->m[0][2] * v->x + m->m[1][2] * v->y + m->m[2][2] * v->z + m->m[3][2]; | |
5023 } | |
5024 | |
5025 bool DrawSkyD3D_Skybox() | |
5026 { | |
5027 static bool initialized = false, | |
5028 initialization_failed = false; | |
5029 if (initialization_failed) | |
5030 return false; | |
5031 | |
5032 static int last_camera_rot_y, | |
5033 last_camera_rot_x; | |
5034 if (!initialized) | |
5035 { | |
5036 if (!Skybox_Initialize(L"data/skybox/stars")) | |
5037 { | |
5038 initialization_failed = true; | |
5039 return false; | |
5040 } | |
5041 initialized = true; | |
5042 | |
5043 last_camera_rot_y = pParty->sRotationY + 1; // force update for the first run | |
5044 last_camera_rot_x = pParty->sRotationX + 1; | |
5045 } | |
5046 | |
5047 /* | |
5048 r(y) = | |
5049 cos y 0 sin y 0 | |
5050 0 1 0 0 | |
5051 -sin y 0 cos y 0 | |
5052 0 0 0 1 | |
5053 | |
5054 x cos y - z sin y | |
5055 y | |
5056 x sin y + z cos y | |
5057 1 | |
5058 | |
5059 | |
5060 | |
5061 r(x) = // should be r(right) actually | |
5062 1 0 0 0 | |
5063 0 cos x -sin x 0 | |
5064 0 sin x cos x 0 | |
5065 0 0 0 1 | |
5066 | |
5067 | |
5068 x | |
5069 y cos x + z sin x | |
5070 -y sin x + z cos x | |
5071 1 | |
5072 | |
5073 */ | |
5074 | |
5075 if (last_camera_rot_y == pParty->sRotationY && | |
5076 last_camera_rot_x == pParty->sRotationX) | |
5077 { | |
5078 draw: | |
5079 struct RenderVertexD3D3 v[6]; | |
5080 | |
692 | 5081 v[0].pos.x = pViewport->uScreen_TL_X; |
5082 v[0].pos.y = pViewport->uScreen_TL_Y; | |
168 | 5083 v[0].pos.z = 0.99989998; |
5084 v[0].rhw = 1; | |
5085 v[0].diffuse = 0xFFFFFFFF; | |
5086 v[0].specular = 0; | |
5087 v[0].texcoord.x = 0; | |
5088 v[0].texcoord.y = 0; | |
5089 | |
692 | 5090 v[1].pos.x = pViewport->uScreen_TL_X + pViewport->uScreenWidth; |
5091 v[1].pos.y = pViewport->uScreen_TL_Y + pViewport->uScreenHeight; | |
168 | 5092 v[1].pos.z = 0.99989998; |
5093 v[1].rhw = 1; | |
5094 v[1].diffuse = 0xFFFFFFFF; | |
5095 v[1].specular = 0; | |
5096 v[1].texcoord.x = (float)pViewport->uScreenWidth / skybox_width; | |
5097 v[1].texcoord.y = (float)pViewport->uScreenHeight / skybox_height; | |
5098 | |
692 | 5099 v[2].pos.x = pViewport->uScreen_TL_X + pViewport->uScreenWidth; |
5100 v[2].pos.y = pViewport->uScreen_TL_Y; | |
168 | 5101 v[2].pos.z = 0.99989998; |
5102 v[2].rhw = 1; | |
5103 v[2].diffuse = 0xFFFFFFFF; | |
5104 v[2].specular = 0; | |
5105 v[2].texcoord.x = (float)pViewport->uScreenWidth / skybox_width; | |
5106 v[2].texcoord.y = 0; | |
5107 | |
5108 memcpy(&v[3], &v[0], sizeof(*v)); | |
5109 | |
692 | 5110 v[4].pos.x = pViewport->uScreen_TL_X; |
5111 v[4].pos.y = pViewport->uScreen_TL_Y + pViewport->uScreenHeight; | |
168 | 5112 v[4].pos.z = 0.99989998; |
5113 v[4].rhw = 1; | |
5114 v[4].diffuse = 0xFFFFFFFF; | |
5115 v[4].specular = 0; | |
5116 v[4].texcoord.x = 0; | |
5117 v[4].texcoord.y = (float)pViewport->uScreenHeight / skybox_height; | |
5118 | |
5119 memcpy(&v[5], &v[1], sizeof(*v)); | |
5120 | |
5121 pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE); | |
5122 pRenderer->pRenderD3D->pDevice->SetTexture(0, skybox_texture); | |
5123 pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLELIST, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, v, 6, D3DDP_DONOTUPDATEEXTENTS | D3DDP_DONOTLIGHT); | |
5124 //pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLELIST, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, v + 1, 3, D3DDP_DONOTUPDATEEXTENTS | D3DDP_DONOTLIGHT); | |
5125 | |
5126 return true; | |
5127 } | |
5128 | |
5129 | |
5130 DDSURFACEDESC2 desc; | |
5131 desc.dwSize = sizeof(desc); | |
5132 if (!pRenderer->LockSurface_DDraw4(skybox_surface, &desc, DDLOCK_WAIT | DDLOCK_WRITEONLY)) | |
5133 return false; | |
5134 | |
5135 last_camera_rot_y = pParty->sRotationY; | |
5136 last_camera_rot_x = pParty->sRotationX; | |
5137 | |
5138 float aspect = (float)pViewport->uScreenWidth / (float)pViewport->uScreenHeight; | |
5139 float fov_x = 3.141592f * (pOutdoorCamera->uCameraFovInDegrees + 0) / 360.0f; | |
5140 float fov_y = fov_x / aspect; | |
5141 | |
5142 float ray_dx = fov_x / (float)pViewport->uScreenWidth, | |
5143 ray_dy = fov_y / (float)pViewport->uScreenHeight; | |
5144 float party_angle_x = 2 * 3.141592653589 * pParty->sRotationX / 2048.0, | |
5145 party_angle_y = 2 * 3.141592653589 * pParty->sRotationY / 2048.0; | |
5146 for (int y = 0; y < pViewport->uScreenHeight; ++y) | |
5147 for (int x = 0; x < pViewport->uScreenWidth; ++x) | |
5148 { | |
5149 float angle_x = party_angle_x - (y - pViewport->uScreenHeight / 2) * ray_dy; | |
5150 float angle_y = party_angle_y - (x - pViewport->uScreenWidth / 2) * ray_dx; | |
5151 | |
5152 float _dir_x_ = 1, | |
5153 _dir_y_ = 0, | |
5154 _dir_z_ = 0; | |
5155 | |
5156 float dir_x_ = _dir_x_ * cosf(angle_y);// - _dir_z_ * sinf(angle_y); // rotation around y | |
5157 //float dir_y_ = _dir_y_; | |
5158 float dir_z_ = _dir_x_ * sinf(angle_y);// + _dir_z_ * cosf(angle_y); | |
5159 | |
5160 //float dir_x = dir_x_; // rotation around x | |
5161 //float dir_y = /*dir_y_ * cosf(angle_x)*/ + dir_z_ * sinf(angle_x); | |
5162 //float dir_z = /*-dir_y_ * sinf(angle_x)*/ + dir_z_ * cosf(angle_x); | |
5163 | |
5164 vector right; // rotate around right actually to avoid space distortion | |
5165 right.x = /*dir_y * 0*/ - dir_z_ * 1; | |
5166 right.y = /*dir_z_ * 0 - dir_x_ * */0; | |
5167 right.z = dir_x_ * 1/* - dir_y_ * 0*/; | |
5168 //VectorNormalize(&right); | |
5169 | |
5170 matrix rightMatrix; | |
5171 MatrixRotationAxis(&rightMatrix, &right, angle_x); | |
5172 | |
5173 vector v1, v2; | |
5174 v1.x = dir_x_; v1.y = 0; v1.z = dir_z_; | |
5175 VectorTransform(&rightMatrix, &v1, &v2); | |
5176 | |
5177 float dir_x = v2.x, | |
5178 dir_y = v2.y, | |
5179 dir_z = v2.z; | |
5180 | |
5181 float abs_dir_x = fabsf(dir_x), | |
5182 abs_dir_y = fabsf(dir_y), | |
5183 abs_dir_z = fabsf(dir_z); | |
5184 | |
5185 unsigned short color = (0x1F << 11) | (0x1F << 5) | (5); //default to orange | |
5186 if (abs_dir_x >= abs_dir_y) | |
5187 { | |
5188 if (abs_dir_x >= abs_dir_z) | |
5189 { | |
5190 if (dir_x >= 0) | |
5191 { | |
5192 float instersect_y = dir_y / (2.0f * dir_x); // plane equation for this side is x + 0.5 = 0 | |
5193 float instersect_z = dir_z / (2.0f * dir_x); | |
5194 | |
5195 float u = 1.0f - (instersect_z + 0.5f), | |
5196 v = 1.0f - (instersect_y + 0.5f); | |
5197 | |
5198 int tx = u * (skybox_width - 1), | |
5199 ty = v * (skybox_height - 1); | |
5200 | |
5201 color = skybox_xp[ty * skybox_width + tx]; | |
5202 //color = ty * 0x1F / skybox_height; | |
5203 } | |
5204 else | |
5205 { | |
5206 float instersect_y = dir_y / (2.0f * dir_x); | |
5207 float instersect_z = dir_z / (2.0f * dir_x); | |
5208 | |
5209 float u = 1.0f - (instersect_z + 0.5f), | |
5210 v = instersect_y + 0.5f; | |
5211 | |
5212 int tx = u * (skybox_width - 1), | |
5213 ty = v * (skybox_height - 1); | |
5214 | |
5215 color = skybox_xn[ty * skybox_width + tx]; | |
5216 //color = tx * 0x1F / skybox_height; | |
5217 } | |
5218 } | |
5219 else if (dir_z >= 0) | |
5220 goto DIR_ZP; | |
5221 else | |
5222 goto DIR_ZN; | |
5223 } | |
5224 else if (abs_dir_y >= abs_dir_z) | |
5225 { | |
5226 if (dir_y >= 0) | |
5227 { | |
5228 float instersect_x = dir_x / (2.0f * dir_y); | |
5229 float instersect_z = dir_z / (2.0f * dir_y); | |
5230 | |
5231 float u = instersect_x + 0.5f, | |
5232 v = instersect_z + 0.5f; | |
5233 | |
5234 int tx = u * (skybox_width - 1), | |
5235 ty = v * (skybox_height - 1); | |
5236 | |
5237 color = skybox_yp[ty * skybox_width + tx]; | |
5238 //color = tx * 0x1F / skybox_height; | |
5239 } | |
5240 /*else should never be seen i guess | |
5241 { | |
5242 __debugbreak(); | |
5243 // -y | |
5244 //Log::Warning(L"(%03u, %03u): -y", x, y); | |
5245 }*/ | |
5246 } | |
5247 else if (dir_z >= 0) | |
5248 { | |
5249 DIR_ZP: | |
5250 // +z | |
5251 float instersect_x = dir_x / (2.0f * dir_z); | |
5252 float instersect_y = dir_y / (2.0f * dir_z); | |
5253 //float intersect_z = 0.5f; | |
5254 | |
5255 float u = instersect_x + 0.5f, | |
5256 v = -instersect_y + 0.5f; | |
5257 | |
5258 int tx = u * (skybox_width - 1), | |
5259 ty = v * (skybox_height - 1); | |
5260 | |
5261 color = skybox_zp[ty * skybox_width + tx]; | |
5262 } | |
5263 else | |
5264 { | |
5265 DIR_ZN: | |
5266 // -z | |
5267 float instersect_x = -dir_x / (2.0f * dir_z); | |
5268 float instersect_y = -dir_y / (2.0f * dir_z); | |
5269 //float intersect_z = -0.5f; | |
5270 | |
5271 float u = 1.0f - instersect_x - 0.5f, | |
5272 v = -instersect_y + 0.5f; | |
5273 | |
5274 int tx = u * (skybox_width - 1), | |
5275 ty = v * (skybox_height - 1); | |
5276 | |
5277 color = skybox_zn[ty * skybox_width + tx]; | |
5278 } | |
5279 | |
5280 //pRenderer->pTargetSurface[(pViewport->uScreenY + y) * pRenderer->uTargetSurfacePitch + pViewport->uScreenX + x] = color; | |
5281 ((unsigned __int16 *)((char *)desc.lpSurface + y * desc.lPitch))[x] = color; | |
5282 } | |
5283 | |
5284 ErrD3D((skybox_surface)->Unlock(0)); | |
5285 goto draw; | |
5286 } | |
5287 | |
0 | 5288 //----- (00479543) -------------------------------------------------------- |
5289 void Render::DrawSkyD3D() | |
5290 { | |
5291 int v0; // esi@2 | |
5292 int v1; // eax@2 | |
5293 int v8; // eax@4 | |
5294 int v9; // eax@4 | |
5295 int v10; // ebx@4 | |
5296 signed __int64 v11; // qax@6 | |
5297 int v13; // edi@6 | |
5298 int v14; // ecx@6 | |
5299 int v16; // eax@12 | |
1427 | 5300 //signed __int64 v17; // qtt@13 |
1344 | 5301 signed int pShading; // ecx@13 |
1427 | 5302 struct Polygon pSkyPolygon; // [sp+14h] [bp-150h]@1 |
0 | 5303 float v28; // [sp+12Ch] [bp-38h]@2 |
5304 int v29; // [sp+130h] [bp-34h]@4 | |
5305 int v30; // [sp+134h] [bp-30h]@1 | |
5306 int v32; // [sp+13Ch] [bp-28h]@6 | |
5307 int v33; // [sp+140h] [bp-24h]@2 | |
67 | 5308 int v34; // [sp+144h] [bp-20h]@1 |
0 | 5309 int v35; // [sp+148h] [bp-1Ch]@4 |
1427 | 5310 int screen_center_x; // [sp+14Ch] [bp-18h]@2 |
0 | 5311 int v37; // [sp+154h] [bp-10h]@8 |
5312 int v38; // [sp+158h] [bp-Ch]@1 | |
5313 int v39; // [sp+15Ch] [bp-8h]@4 | |
1427 | 5314 //int v40; // [sp+160h] [bp-4h]@7 |
168 | 5315 |
5316 extern bool new_sky; | |
5317 if (new_sky) | |
5318 { | |
5319 if (DrawSkyD3D_Skybox()) | |
5320 return; | |
5321 } | |
0 | 5322 |
67 | 5323 v30 = ((double)(pOutdoorCamera->int_fov_rad * pIndoorCamera->pos.z) |
1427 | 5324 / ((double)pOutdoorCamera->int_fov_rad + 8192.0) + pViewport->uScreenCenterY);//184 |
1344 | 5325 v38 = pViewport->uScreenCenterY - pOutdoorCamera->int_fov_rad / |
5326 (pOutdoorCamera->shading_dist_mist * cos(pIndoorCamera->sRotationX * 0.003066406352445483) + 0.0000001000000011686097) * | |
1427 | 5327 (pOutdoorCamera->shading_dist_mist * -sin(pIndoorCamera->sRotationX * 0.003066406352445483) - pIndoorCamera->pos.z);//61 / 184 / 310 |
5328 | |
5329 pSkyPolygon.Create_48607B(&stru_8019C8); | |
1544 | 5330 pSkyPolygon.ptr_38->_48694B_frustum_sky();//maybe creating skydome( ) |
1427 | 5331 pSkyPolygon.uTileBitmapID = pOutdoor->uSky_TextureID;// |
5332 pSkyPolygon.pTexture = (Texture *)(pOutdoor->uSky_TextureID != -1 ? &pBitmaps_LOD->pTextures[pOutdoor->uSky_TextureID] : 0);// | |
67 | 5333 if (pOutdoor->uSky_TextureID == -1) |
5334 return; | |
168 | 5335 |
1427 | 5336 pSkyPolygon.dimming_level = 0;// |
5337 pSkyPolygon.uNumVertices = 4;// | |
5338 | |
5339 //centering()-- ----------------------------------------// | |
5340 pSkyPolygon.v_18.x = -stru_5C6E00->Sin(pIndoorCamera->sRotationX + 16);//-3216, : -28020, : 22078 | |
5341 pSkyPolygon.v_18.y = 0; | |
5342 pSkyPolygon.v_18.z = -stru_5C6E00->Cos(pIndoorCamera->sRotationX + 16);//-65457, : -59244, : -61705 | |
5343 //---------------------------------------------------------------------------// | |
5344 | |
5345 pSkyPolygon.field_24 = 0x2000000; | |
5346 | |
5347 pSkyPolygon.sTextureDeltaU = 224 * pMiscTimer->uTotalGameTimeElapsed;//60928 | |
5348 pSkyPolygon.sTextureDeltaV = 224 * pMiscTimer->uTotalGameTimeElapsed; | |
1344 | 5349 |
5350 //sky position( )---------------------------------------------- | |
1427 | 5351 // X |
5352 // 0._____________________________.3 | |
5353 // |8,8 468,8 | | |
5354 // | | | |
5355 // | | | |
5356 // Y| | | |
5357 // | | | |
5358 // |8,? 468,? | | |
5359 // 1._____________________________.2 | |
5360 // | |
5361 | |
5362 array_50AC10[0].vWorldViewProjX = pViewport->uViewportTL_X;//8 | |
5363 array_50AC10[0].vWorldViewProjY = pViewport->uViewportTL_Y;//8 | |
5364 | |
5365 array_50AC10[1].vWorldViewProjX = pViewport->uViewportTL_X;//8 | |
5366 array_50AC10[1].vWorldViewProjY = v38;//61 / 184 / 310 | |
5367 | |
5368 array_50AC10[2].vWorldViewProjX = pViewport->uViewportBR_X;//468 | |
5369 array_50AC10[2].vWorldViewProjY = v38;//61 / 184 / 310 | |
5370 | |
5371 array_50AC10[3].vWorldViewProjX = pViewport->uViewportBR_X;//468 | |
5372 array_50AC10[3].vWorldViewProjY = pViewport->uViewportTL_Y;//8 | |
1344 | 5373 //-------------------------------------------------------------------------- |
840 | 5374 |
895 | 5375 //pParty->sRotationY / 2048.0f |
1427 | 5376 // move sky( )--------------include()--------------------- |
895 | 5377 float t = (GetTickCount() % 96000) / 96000.0f; |
5378 array_50AC10[0].u = t - pParty->sRotationY / 1024.0f; | |
5379 array_50AC10[0].v = t - pParty->sRotationX / 512.0f; | |
5380 | |
5381 array_50AC10[1].u = t - pParty->sRotationY / 1024.0f; | |
5382 array_50AC10[1].v = 1 + t - pParty->sRotationX / 512.0f; | |
5383 | |
5384 array_50AC10[2].u = 1 + t - pParty->sRotationY / 1024.0f; | |
5385 array_50AC10[2].v = 1 + t - pParty->sRotationX / 512.0f; | |
5386 | |
5387 array_50AC10[3].u = 1 + t - pParty->sRotationY / 1024.0f; | |
5388 array_50AC10[3].v = t - pParty->sRotationX / 512.0f; | |
1427 | 5389 //--------------------------------------------------------------------------// |
1344 | 5390 |
5391 //rotate skydome( )-------------------------------------- | |
1427 | 5392 // . 2 65536 . 0 |
5393 // , 16384(04000) - ... | |
5394 | |
5395 // ------------------------------------------------ | |
5396 // ---------------------------------------------------------- | |
5397 screen_center_x = (pViewport->uViewportBR_X - pViewport->uViewportTL_X) / 2;// X = 230 | |
5398 v33 = 65536 / (signed int)(screen_center_x / tan(0.6457717418670654) + 0.5);//360 : ( ) = 214 | |
5399 //-------------------------------------------------------------------------- | |
5400 | |
5401 for (uint i = 0; i < pSkyPolygon.uNumVertices; ++i) | |
1344 | 5402 { |
5403 v29 = floorf(array_50AC10[i].vWorldViewProjY + 0.5f);//8 | |
1427 | 5404 v39 = (unsigned __int64)(pSkyPolygon.ptr_38->field_14 * v33 * (v30 - v29)) / 65536;//0 |
5405 v8 = v39 + pSkyPolygon.ptr_38->field_C;//0 | |
5406 | |
5407 v39 = (unsigned __int64)(pSkyPolygon.ptr_38->field_20 * v33 * (v30 - v29)) / 65536;//0 | |
5408 screen_center_x = v39 + pSkyPolygon.ptr_38->field_18;//65536 | |
5409 | |
5410 v9 = (unsigned __int64)(pSkyPolygon.v_18.z * v33 * (v30 - v29)) / 65536;//27917 | |
5411 v10 = pSkyPolygon.v_18.x + v9;//24701 | |
5412 v39 = pSkyPolygon.v_18.x + v9;//24701 | |
5413 if ( pSkyPolygon.v_18.x + v9 > 0 ) | |
577 | 5414 { |
5415 v10 = 0; | |
5416 v39 = 0; | |
5417 } | |
840 | 5418 //v11 = (signed __int64)array_50AC10[i].vWorldViewProjX; |
577 | 5419 v38 = v10; |
1344 | 5420 //v12 = array_50AC10[i].vWorldViewProjY - 1.0; |
840 | 5421 v13 = v33 * (pViewport->uScreenCenterX - (signed __int64)array_50AC10[i].vWorldViewProjX); |
1427 | 5422 v34 = -pSkyPolygon.field_24; |
1344 | 5423 v32 = (signed __int64)array_50AC10[i].vWorldViewProjY - 1.0; |
577 | 5424 v14 = v33 * (v30 - v32); |
1344 | 5425 |
577 | 5426 while ( 1 ) |
5427 { | |
1427 | 5428 //v40 = v14; |
577 | 5429 if ( !v10 ) |
5430 { | |
1427 | 5431 v37 = pSkyPolygon.v_18.z; |
5432 v16 = (unsigned __int64)(pSkyPolygon.v_18.z * (signed __int64)v14) >> 16; | |
0 | 5433 --v32; |
5434 v14 += v33; | |
1427 | 5435 v10 = pSkyPolygon.v_18.x + v16; |
5436 v39 = pSkyPolygon.v_18.x + v16; | |
5437 v38 = pSkyPolygon.v_18.x + v16; | |
67 | 5438 break; |
5439 } | |
1427 | 5440 v37 = abs(v34 >> 14);//2048 |
1344 | 5441 if ( abs(v34 >> 14) <= abs(v10) || v32 <= pViewport->uViewportTL_Y ) |
577 | 5442 { |
5443 if ( v39 <= 0 ) | |
5444 break; | |
5445 } | |
1427 | 5446 //v14 = v40; |
5447 v37 = pSkyPolygon.v_18.z; | |
5448 v16 = (unsigned __int64)(pSkyPolygon.v_18.z * v14) >> 16; | |
577 | 5449 --v32; |
5450 v14 += v33; | |
1427 | 5451 v10 = pSkyPolygon.v_18.x + v16; |
5452 v39 = pSkyPolygon.v_18.x + v16; | |
5453 v38 = pSkyPolygon.v_18.x + v16; | |
577 | 5454 break; |
5455 } | |
1344 | 5456 |
1427 | 5457 pShading = fixpoint_div(v34, v38); |
1344 | 5458 if ( pShading < 0 ) |
5459 pShading = pOutdoorCamera->shading_dist_mist; | |
5460 | |
1427 | 5461 v37 += ((unsigned __int64)(pSkyPolygon.ptr_38->field_10 * v13) >> 16); |
5462 screen_center_x += ((unsigned __int64)(pSkyPolygon.ptr_38->field_1C * v13) >> 16); | |
1344 | 5463 v35 = 224 * pMiscTimer->uTotalGameTimeElapsed + fixpoint_sub0(v37, pShading) / 8; |
1427 | 5464 screen_center_x = 224 * pMiscTimer->uTotalGameTimeElapsed + fixpoint_sub0(screen_center_x, pShading) / 8; |
840 | 5465 |
579 | 5466 //array_50AC10[i].vWorldViewPosition.x = pOutdoorCamera->shading_dist_mist; |
1344 | 5467 //array_50AC10[i].vWorldPosition.x = v36 / (pSky.pTexture->uTextureHeight * 65536.0); |
840 | 5468 //array_50AC10[i].vWorldPosition.y = 1.0 / (pOutdoorCamera->shading_dist_mist >> 16); |
1344 | 5469 //array_50AC10[i].vWorldPosition.z = v35 / (pSky.pTexture->uTextureWidth * 65536.0); |
1427 | 5470 //array_50AC10[i]._rhw = 1.0f / (pShading >> 16); |
5471 //array_50AC10[i].u = (double)v35 / (65536.0 * pSkyPolygon.pTexture->uTextureWidth); | |
5472 //array_50AC10[i].v = (double)screen_center_x / (65536.0 * pSkyPolygon.pTexture->uTextureHeight); | |
1344 | 5473 //----------------------------------------------------------------------------------------- |
5474 | |
895 | 5475 array_50AC10[i]._rhw = 1.0f; |
1344 | 5476 } |
5477 //if ( i == _this.uNumVertices - 1 ) | |
5478 //{ | |
1427 | 5479 pRenderer->DrawSkyPolygon(pSkyPolygon.uNumVertices, &pSkyPolygon, pBitmaps_LOD->pHardwareTextures[pSkyPolygon.uTileBitmapID]); |
1344 | 5480 |
5481 array_50AC10[0].vWorldViewProjY = v38; | |
5482 array_50AC10[1].vWorldViewProjY = array_50AC10[1].vWorldViewProjY + 30.0; | |
5483 array_50AC10[2].vWorldViewProjY = array_50AC10[2].vWorldViewProjY + 30.0; | |
5484 array_50AC10[3].vWorldViewProjY = v38; | |
5485 | |
1427 | 5486 pRenderer->DrawSkyPolygon(pSkyPolygon.uNumVertices, &pSkyPolygon, pBitmaps_LOD->pHardwareTextures[pSkyPolygon.uTileBitmapID]); |
1344 | 5487 //} |
0 | 5488 } |
5489 | |
5490 //----- (0047A384) -------------------------------------------------------- | |
5491 void ODM_LoadAndInitialize(const char *pLevelFilename, OutdoorCamera *thisa) | |
5492 { | |
5493 int v2; // ebx@3 | |
5494 unsigned int v3; // eax@3 | |
5495 MapInfo *v4; // edi@4 | |
5496 //int v5; // eax@8 | |
5497 //SpawnPointMM7 *v6; // edx@14 | |
5498 size_t v7; // eax@19 | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
5499 //char *v8; // eax@19 |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
5500 //char *v9; // eax@21 |
0 | 5501 char Source[120]; // [sp+Ch] [bp-84h]@19 |
5502 const char *pFilename; // [sp+84h] [bp-Ch]@1 | |
5503 //unsigned int v12; // [sp+88h] [bp-8h]@12 | |
5504 //int v13; // [sp+8Ch] [bp-4h]@11 | |
5505 | |
5506 pFilename = pLevelFilename; | |
1583 | 5507 //thisa->AllocSoftwareDrawBuffers(); |
0 | 5508 pOutdoorCamera->_485F64(); |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
5509 pWeather->bRenderSnow = false; |
0 | 5510 pRenderer->ClearZBuffer(0, 479); |
5511 thisa = (OutdoorCamera *)1; | |
5512 GetAlertStatus(); | |
5513 if ( qword_A750D8 ) | |
1583 | 5514 qword_A750D8 = 0; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1470
diff
changeset
|
5515 v2 = pMapStats->GetMapInfo(pCurrentMapName); |
0 | 5516 v3 = 0; |
5517 if ( v2 ) | |
5518 { | |
5519 v4 = &pMapStats->pInfos[v2]; | |
5520 v3 = v4->uRespawnIntervalDays; | |
5521 } | |
5522 else | |
5523 { | |
5524 v4 = (MapInfo *)thisa; | |
5525 } | |
767 | 5526 day_attrib &= ~DAY_ATTRIB_FOG; |
0 | 5527 dword_6BE13C_uCurrentlyLoadedLocationID = v2; |
5528 pOutdoor->Initialize( | |
5529 pFilename, | |
5530 (unsigned int)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 0x3C / 0x3C / 0x18 + 1, | |
5531 v3, | |
5532 (int)&thisa); | |
5533 if ( !(BYTE1(dword_6BE364_game_settings_1) & 0x20) ) | |
5534 { | |
5535 InitializeActors(); | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
5536 InitializeSpriteObjects(); |
0 | 5537 } |
5538 BYTE1(dword_6BE364_game_settings_1) &= 0xDFu; | |
5539 //v5 = 0; | |
5540 if ( !v2 ) | |
5541 thisa = 0; | |
5542 if ( thisa == (OutdoorCamera *)1 ) | |
5543 { | |
5544 //v13 = 0; | |
5545 for (uint i = 0; i < pOutdoor->uNumSpawnPoints; ++i) | |
5546 { | |
5547 //v12 = 0; | |
5548 //while ( 1 ) | |
5549 //{ | |
5550 auto spawn = pOutdoor->pSpawnPoints + i; | |
5551 //v6 = &pOutdoor->pSpawnPoints[v12 / 0x18]; | |
5552 if (spawn->uKind == 3 ) | |
5553 SpawnEncounter(v4, spawn, 0, 0, 0); | |
5554 else | |
5555 v4->SpawnRandomTreasure(spawn); | |
5556 //++v13; | |
5557 //v12 += 24; | |
5558 //if ( v13 >= (signed int)pOutdoor->uNumSpawnPoints ) | |
5559 // break; | |
5560 //v5 = 0; | |
5561 //} | |
5562 } | |
5563 RespawnGlobalDecorations(); | |
5564 } | |
5565 pOutdoor->PrepareDecorations(); | |
5566 pOutdoor->_47F223_LooksLikeGenerateMonsterLoot(); | |
5567 pOutdoor->InitalizeActors(v2); | |
5568 pOutdoor->MessWithLUN(); | |
5569 v7 = strlen("levels\\"); | |
5570 strcpy(Source, &pFilename[v7]); | |
5571 strcpy(pOutdoor->pLevelFilename, Source); | |
5572 pWeather->Initialize(); | |
5573 pIndoorCamera->sRotationY = pParty->sRotationY; | |
5574 pIndoorCamera->sRotationX = pParty->sRotationX; | |
5575 pOutdoorCamera->RotationToInts(); | |
5576 pOutdoor->UpdateSunlightVectors(); | |
5577 pOutdoorCamera->int_fov_rad = (signed __int64)pIndoorCamera->flt_1C_fov; | |
5578 pOutdoorCamera->int_fov_rad_inv = (signed __int64)pIndoorCamera->flt_20_inv_1C; | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
5579 |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
5580 for (int i = 0; i < 20000; ++i) |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
5581 { |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
5582 array_77EC08[i].ptr_38 = &stru_8019C8; |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
5583 |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
5584 array_77EC08[i].prolly_head = nullptr; |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
5585 array_77EC08[i].prolly_tail = nullptr; |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
5586 array_77EC08[i].ptr_48 = nullptr; |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
5587 } |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
5588 |
0 | 5589 MM7Initialization(); |
5590 } | |
5591 | |
5592 //----- (0047C370) -------------------------------------------------------- | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
5593 unsigned int GetLevelFogColor() |
0 | 5594 { |
5595 signed __int64 v1; // qax@5 | |
5596 int v2; // eax@6 | |
5597 | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
5598 if (bUnderwater) |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
5599 return 0xFF258F5C; |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
5600 |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
5601 if (day_attrib & DAY_ATTRIB_FOG) |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
5602 { |
767 | 5603 if ( pWeather->bNight ) // night-time fog |
750 | 5604 { |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
5605 __debugbreak(); // decompilation can be inaccurate, please send savegame to Nomad |
750 | 5606 v2 = -(pWeather->bNight != 1); |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
5607 return (v2 & 0xE0E0E1) - 0xE0E0E1; |
0 | 5608 } |
5609 else | |
5610 { | |
5611 v1 = (signed __int64)((1.0 - pOutdoor->fFogDensity) * 200.0 + pOutdoor->fFogDensity * 31.0); | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
5612 return v1 | (((unsigned int)v1 | (((unsigned int)v1 | 0xFFFFFF00) << 8)) << 8); |
0 | 5613 } |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
5614 } |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
5615 |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
5616 return 0; |
0 | 5617 } |
5618 | |
5619 //----- (0047C3D7) -------------------------------------------------------- | |
5620 int __fastcall sub_47C3D7_get_fog_related_stuff(int a1, int a2, float a3) | |
5621 { | |
5622 int v3; // ecx@1 | |
5623 double v5; // st7@10 | |
5624 signed int v7; // ecx@11 | |
5625 double v8; // st6@12 | |
5626 double v9; // st7@15 | |
5627 double v10; // st6@16 | |
5628 float v11; // ST14_4@17 | |
5629 double v12; // ST08_8@17 | |
5630 | |
750 | 5631 v3 = pWeather->bNight; |
0 | 5632 if ( bUnderwater == 1 ) |
5633 v3 = 0; | |
767 | 5634 if ( pParty->armageddon_timer || !(day_attrib & DAY_ATTRIB_FOG) && !bUnderwater ) |
349 | 5635 return 0xFF000000; |
0 | 5636 if ( v3 ) |
5637 { | |
5638 v5 = (double)day_fogrange_1; | |
5639 if ( a3 < v5 ) | |
1418 | 5640 { |
5641 v7 = 0; | |
5642 if ( a3 == 0.0 ) | |
5643 { | |
5644 v7 = 216; | |
5645 } | |
5646 goto LABEL_21; | |
5647 } | |
5648 else | |
5649 { | |
5650 v8 = (double)day_fogrange_2; | |
5651 if ( a3 > v8 ) | |
5652 { | |
5653 v7 = 216; | |
5654 if ( a3 == 0.0 ) | |
5655 { | |
5656 v7 = 216; | |
5657 } | |
5658 goto LABEL_21; | |
5659 } | |
5660 v7 = (signed __int64)((a3 - v5) / (v8 - v5) * 216.0); | |
5661 } | |
0 | 5662 } |
5663 else | |
5664 { | |
5665 v9 = (double)day_fogrange_1; | |
5666 if ( a3 < v9 ) | |
5667 { | |
5668 v7 = 0; | |
1418 | 5669 if ( a3 == 0.0 ) |
5670 { | |
5671 v7 = 216; | |
5672 } | |
5673 goto LABEL_21; | |
0 | 5674 } |
1418 | 5675 else |
5676 { | |
5677 v10 = (double)day_fogrange_2; | |
5678 if ( a3 > v10 ) | |
5679 { | |
5680 v7 = 216; | |
5681 if ( a3 == 0.0 ) | |
5682 { | |
5683 v7 = 216; | |
5684 } | |
5685 goto LABEL_21; | |
5686 } | |
5687 else | |
5688 { | |
5689 v11 = (a3 - v9) * 216.0 / (v10 - v9); | |
5690 v12 = v11 + 6.7553994e15; | |
5691 v7 = LODWORD(v12); | |
5692 } | |
5693 } | |
5694 } | |
5695 if ( v7 > 216 ) | |
5696 { | |
5697 v7 = 216; | |
5698 } | |
5699 else | |
5700 { | |
5701 if ( a3 == 0.0 ) | |
5702 { | |
5703 v7 = 216; | |
5704 } | |
5705 } | |
0 | 5706 LABEL_21: |
5707 if ( a2 ) | |
5708 v7 = 248; | |
5709 return (-1 - v7) << 24; | |
5710 } | |
349 | 5711 |
0 | 5712 //----- (0047C4FC) -------------------------------------------------------- |
1459 | 5713 int __fastcall GetActorTintColor(int max_dimm, int min_dimm, float distance, int a4, RenderBillboard *a5) |
349 | 5714 { |
5715 //int v5; // esi@1 | |
0 | 5716 signed int v6; // edx@1 |
349 | 5717 //signed int result; // eax@2 |
0 | 5718 int v8; // eax@3 |
5719 double v9; // st7@12 | |
750 | 5720 //double v10; // ST0C_8@18 |
0 | 5721 int v11; // ecx@28 |
349 | 5722 //signed int v12; // edi@28 |
5723 //double v13; // ST0C_8@33 | |
5724 //double v14; // ST0C_8@34 | |
0 | 5725 double v15; // st7@44 |
349 | 5726 //double v16; // ST0C_8@44 |
5727 //double v17; // ST0C_8@44 | |
0 | 5728 int v18; // ST14_4@44 |
349 | 5729 //double v19; // ST0C_8@44 |
0 | 5730 signed int v20; // [sp+10h] [bp-4h]@10 |
5731 float a3a; // [sp+1Ch] [bp+8h]@33 | |
638 | 5732 //float a3b; // [sp+1Ch] [bp+8h]@34 |
0 | 5733 float a3c; // [sp+1Ch] [bp+8h]@44 |
349 | 5734 //float a3d; // [sp+1Ch] [bp+8h]@44 |
750 | 5735 //float a4b; // [sp+20h] [bp+Ch]@18 |
638 | 5736 //int a4a; // [sp+20h] [bp+Ch]@33 |
349 | 5737 //float a4c; // [sp+20h] [bp+Ch]@44 |
5738 //float a4d; // [sp+20h] [bp+Ch]@44 | |
0 | 5739 int a5a; // [sp+24h] [bp+10h]@44 |
5740 | |
349 | 5741 //v5 = a2; |
0 | 5742 v6 = 0; |
349 | 5743 |
5744 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
638 | 5745 return 8 * (31 - max_dimm) | ((8 * (31 - max_dimm) | ((31 - max_dimm) << 11)) << 8); |
5746 | |
349 | 5747 if (pParty->armageddon_timer) |
5748 return 0xFFFF0000; | |
5749 | |
750 | 5750 v8 = pWeather->bNight; |
638 | 5751 if (bUnderwater) |
0 | 5752 v8 = 0; |
5753 if ( v8 ) | |
5754 { | |
5755 v20 = 1; | |
349 | 5756 if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uExpireTime > 0 ) |
5757 v20 = pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uPower; | |
0 | 5758 v9 = (double)v20 * 1024.0; |
5759 if ( a4 ) | |
5760 goto LABEL_19; | |
638 | 5761 if ( distance <= v9 ) |
5762 { | |
5763 if ( distance > 0.0 ) | |
5764 { | |
750 | 5765 //a4b = distance * 216.0 / v9; |
5766 //v10 = a4b + 6.7553994e15; | |
5767 //v6 = LODWORD(v10); | |
5768 v6 = floorf(0.5f + distance * 216.0 / v9); | |
5769 if (v6 > 216 ) | |
0 | 5770 goto LABEL_19; |
5771 } | |
5772 } | |
5773 else | |
5774 { | |
5775 v6 = 216; | |
5776 } | |
638 | 5777 if ( distance != 0.0 ) |
0 | 5778 { |
5779 LABEL_20: | |
5780 if ( a5 ) | |
5781 v6 = 8 * _43F55F_get_billboard_light_level(a5, v6 >> 3); | |
5782 if ( v6 > 216 ) | |
5783 v6 = 216; | |
5784 return (255 - v6) | ((255 - v6) << 16) | ((255 - v6) << 8); | |
5785 } | |
5786 LABEL_19: | |
5787 v6 = 216; | |
5788 goto LABEL_20; | |
5789 } | |
349 | 5790 |
5791 | |
5792 | |
638 | 5793 if (fabsf(distance) < 1.0e-6f) |
349 | 5794 return 0xFFF8F8F8; |
5795 | |
638 | 5796 // dim in measured in 8-steps |
5797 v11 = 8 * (max_dimm - min_dimm); | |
349 | 5798 //v12 = v11; |
0 | 5799 if ( v11 >= 0 ) |
5800 { | |
5801 if ( v11 > 216 ) | |
349 | 5802 v11 = 216; |
5803 } | |
5804 else | |
5805 v11 = 0; | |
5806 | |
638 | 5807 float fog_density_mult = 216.0f; |
5808 if (a4) | |
5809 fog_density_mult += distance / (double)pOutdoorCamera->shading_dist_shade * 32.0; | |
5810 | |
5811 v6 = v11 + floorf(pOutdoor->fFogDensity * fog_density_mult + 0.5f); | |
5812 /*if ( a4 ) | |
5813 { | |
5814 //a3b = pOutdoor->fFogDensity * 216.0; | |
349 | 5815 //v14 = a3b + 6.7553994e15; |
638 | 5816 //a4a = floorf(a3b + 0.5f);//LODWORD(v14); |
5817 } | |
5818 else | |
5819 { | |
5820 //a3a = (distance / (double)pOutdoorCamera->shading_dist_shade * 32.0 + 216.0) * pOutdoor->fFogDensity; | |
349 | 5821 //v13 = a3a + 6.7553994e15; |
638 | 5822 //a4a = floorf(a3a + 0.5f);//LODWORD(v13); |
5823 } | |
5824 v6 = a4a + v11;*/ | |
0 | 5825 if ( a5 ) |
5826 v6 = 8 * _43F55F_get_billboard_light_level(a5, v6 >> 3); | |
5827 if ( v6 > 216 ) | |
5828 v6 = 216; | |
349 | 5829 if ( v6 < v11 ) |
5830 v6 = v11; | |
638 | 5831 if ( v6 > 8 * pOutdoor->max_terrain_dimming_level ) |
5832 v6 = 8 * pOutdoor->max_terrain_dimming_level; | |
0 | 5833 if ( !bUnderwater ) |
5834 return (255 - v6) | ((255 - v6) << 16) | ((255 - v6) << 8); | |
349 | 5835 else |
5836 { | |
0 | 5837 v15 = (double)(255 - v6) * 0.0039215689; |
5838 a3c = v15; | |
349 | 5839 //a4c = v15 * 16.0; |
5840 //v16 = a4c + 6.7553994e15; | |
5841 a5a = floorf(v15 * 16.0 + 0.5f);//LODWORD(v16); | |
5842 //a4d = a3c * 194.0; | |
5843 //v17 = a4d + 6.7553994e15; | |
5844 v18 = floorf(a3c * 194.0 + 0.5f);//LODWORD(v17); | |
5845 //a3d = a3c * 153.0; | |
5846 //v19 = a3d + 6.7553994e15; | |
5847 return (int)floorf(a3c * 153.0 + 0.5f)/*LODWORD(v19)*/ | ((v18 | (a5a << 8)) << 8); | |
5848 } | |
0 | 5849 } |
5850 // 6BE3C4: using guessed type char bUnderwater; | |
5851 | |
5852 //----- (0047F44B) -------------------------------------------------------- | |
1412 | 5853 unsigned int WorldPosToGridCellX(int sWorldPosX) |
67 | 5854 { |
1412 | 5855 return (sWorldPosX >> 9) + 64; // sar is in original exe, resulting -880 / 512 = -1 |
5856 // and -880 sar 9 = -2 | |
0 | 5857 } |
5858 | |
5859 //----- (0047F458) -------------------------------------------------------- | |
1412 | 5860 unsigned int WorldPosToGridCellZ(int sWorldPosZ) |
67 | 5861 { |
1412 | 5862 return 64 - (sWorldPosZ >> 9); // sar is in original exe, resulting -880 / 512 = -1 |
5863 // and -880 sar 9 = -2 | |
0 | 5864 } |
5865 | |
5866 //----- (0047F469) -------------------------------------------------------- | |
1459 | 5867 int GridCellToWorldPosX(int a1) |
0 | 5868 { |
5869 return (a1 - 64) << 9; | |
5870 } | |
5871 | |
5872 //----- (0047F476) -------------------------------------------------------- | |
1459 | 5873 int GridCellToWorldPosZ(int a1) |
0 | 5874 { |
5875 return (64 - a1) << 9; | |
5876 } | |
5877 | |
5878 | |
5879 //----- (004811A3) -------------------------------------------------------- | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
5880 void Polygon::DrawBorderTiles() |
1338 | 5881 { |
5882 //__debugbreak(); | |
5883 | |
5884 pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, false); | |
0 | 5885 pRenderer->DrawTerrainPolygon(uNumVertices, this, |
1338 | 5886 pBitmaps_LOD->pHardwareTextures[pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_current_frame]], false, true); |
5887 | |
5888 pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, true); | |
5889 //pRenderer->DrawTerrainPolygon(uNumVertices, this, pBitmaps_LOD->pHardwareTextures[uTileBitmapID], true, true); | |
0 | 5890 } |
5891 | |
5892 | |
5893 //----- (00481ED9) -------------------------------------------------------- | |
1458 | 5894 void sub_481ED9_MessWithOutdoorCamera() |
0 | 5895 { |
1544 | 5896 stru_8019C8._48616B_frustum_odm(65536, 0, 0, 0, 65536, 0); |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
5897 pOutdoorCamera->uNumPolygons = 0; |
0 | 5898 pOutdoorCamera->uNumEdges = 0; |
5899 pOutdoorCamera->uNumSpans = 0; | |
5900 pOutdoorCamera->uNumSurfs = 0; | |
5901 pOutdoorCamera->uNumBillboards = 0; | |
5902 pOutdoorCamera->field_44 = 0; | |
5903 } | |
5904 | |
5905 //----- (004823F4) -------------------------------------------------------- | |
138 | 5906 bool IsTerrainSlopeTooHigh(int pos_x, int pos_z) |
5907 { | |
5908 //unsigned int v2; // ebx@1 | |
5909 //unsigned int v3; // edi@1 | |
5910 //int v4; // eax@1 | |
5911 //int v6; // esi@5 | |
5912 //int v7; // ecx@6 | |
5913 //int v8; // edx@6 | |
5914 //int v9; // eax@6 | |
5915 //int v10; // esi@10 | |
5916 //int v11; // [sp+14h] [bp-8h]@1 | |
5917 //int v12; // [sp+18h] [bp-4h]@1 | |
5918 | |
5919 //v12 = a1; | |
5920 //v11 = a2; | |
5921 auto grid_x = WorldPosToGridCellX(pos_x); | |
5922 auto grid_z = WorldPosToGridCellZ(pos_z) - 1; | |
5923 | |
5924 auto party_grid_x1 = GridCellToWorldPosX(grid_x); | |
5925 //dword_76D56C_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(grid_x + 1); | |
5926 //dword_76D570_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(grid_x + 1); | |
5927 //dword_76D574_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(grid_x); | |
5928 auto party_grid_z1 = GridCellToWorldPosZ(grid_z); | |
5929 //dword_76D55C_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(grid_z); | |
5930 //dword_76D560_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(grid_z + 1); | |
5931 //dword_76D564_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(grid_z + 1); | |
5932 auto party_x1z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z); | |
5933 auto party_x2z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z); | |
5934 auto party_x2z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z + 1); | |
5935 auto party_x1z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z + 1); | |
5936 //dword_76D554_terrain_cell_world_pos_around_party_y = v4; | |
5937 if (party_x1z1_y == party_x2z1_y && | |
5938 party_x2z1_y == party_x2z2_y && | |
5939 party_x2z2_y == party_x1z2_y ) | |
5940 return false; | |
5941 | |
5942 auto dx = abs(pos_x - party_grid_x1), | |
5943 dz = abs(party_grid_z1 - pos_z); | |
5944 | |
5945 int y1, y2, y3; | |
5946 if (dz >= dx) | |
5947 { | |
5948 y1 = party_x1z2_y; // lower-left triangle | |
5949 y2 = party_x2z2_y; // y3 | \ | |
5950 y3 = party_x1z1_y; // | \ | |
5951 /* | \ | |
5952 |______ \ | |
5953 y1 y2 */ | |
5954 } | |
5955 else | |
5956 { | |
5957 y1 = party_x2z1_y; // upper-right | |
5958 y2 = party_x1z1_y; // y2_______ y1 | |
5959 y3 = party_x2z2_y; // \ | | |
5960 /* \ | | |
5961 \ | | |
5962 y3 */ | |
5963 } | |
5964 | |
5965 int y_min = min(y1, min(y2, y3)), | |
5966 y_max = max(y1, max(y2, y3)); | |
1545 | 5967 return (y_max - y_min) > 512; |
138 | 5968 |
5969 /*if ( y1 >= y2 ) | |
5970 { | |
5971 y_min = y2; | |
5972 if ( y2 < y3 ) | |
0 | 5973 goto LABEL_13; |
5974 LABEL_12: | |
138 | 5975 y_min = y3; |
0 | 5976 goto LABEL_13; |
5977 } | |
138 | 5978 else if ( y1 >= y3 ) |
0 | 5979 goto LABEL_12; |
138 | 5980 else |
5981 y_min = y1; | |
5982 | |
0 | 5983 LABEL_13: |
138 | 5984 if ( y1 <= y2 ) |
5985 { | |
5986 if ( y2 > y3 ) | |
5987 y3 = y2; | |
5988 } | |
5989 else | |
5990 { | |
5991 if ( y1 > y3 ) | |
5992 y3 = y1; | |
5993 } | |
5994 return y3 - v10 > 512;*/ | |
0 | 5995 } |
5996 | |
5997 //----- (0048257A) -------------------------------------------------------- | |
812 | 5998 int __fastcall GetTerrainHeightsAroundParty2(int a1, int a2, int *pIsOnWater, int bFloatAboveWater) |
5999 { | |
6000 //unsigned int v4; // ebx@1 | |
6001 //unsigned int v5; // edi@1 | |
0 | 6002 int result; // eax@9 |
812 | 6003 //int v7; // ebx@10 |
0 | 6004 int v8; // ebx@11 |
6005 int v9; // eax@11 | |
6006 int v10; // ecx@11 | |
812 | 6007 //int v11; // [sp+Ch] [bp-Ch]@1 |
6008 //int v12; // [sp+10h] [bp-8h]@1 | |
0 | 6009 int v13; // [sp+10h] [bp-8h]@11 |
6010 signed int v14; // [sp+14h] [bp-4h]@3 | |
6011 int v15; // [sp+24h] [bp+Ch]@11 | |
6012 | |
812 | 6013 //v11 = a1; |
6014 //v12 = a2; | |
6015 auto grid_x = WorldPosToGridCellX(a1); | |
6016 auto grid_z = WorldPosToGridCellZ(a2) - 1; | |
6017 | |
6018 auto grid_x1 = GridCellToWorldPosX(grid_x), | |
6019 grid_x2 = GridCellToWorldPosX(grid_x + 1); | |
6020 auto grid_z1 = GridCellToWorldPosZ(grid_z), | |
6021 grid_z2 = GridCellToWorldPosZ(grid_z + 1); | |
6022 | |
6023 auto y_x1z1 = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z), | |
6024 y_x2z1 = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z), | |
6025 y_x2z2 = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z + 1), | |
6026 y_x1z2 = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z + 1); | |
6027 //v4 = WorldPosToGridCellX(a1); | |
6028 //v5 = WorldPosToGridCellZ(v12) - 1; | |
6029 //dword_76D538_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v4); | |
6030 //dword_76D53C_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v4 + 1); | |
6031 //dword_76D540_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v4 + 1); | |
6032 //dword_76D544_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v4); | |
6033 //dword_76D528_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v5); | |
6034 //dword_76D52C_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v5); | |
6035 //dword_76D530_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v5 + 1); | |
6036 //dword_76D534_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v5 + 1); | |
6037 //dword_76D518_terrain_cell_world_pos_around_party_y = pOutdoor->DoGetHeightOnTerrain(v4, v5); | |
6038 //dword_76D51C_terrain_cell_world_pos_around_party_y = pOutdoor->DoGetHeightOnTerrain(v4 + 1, v5); | |
6039 //dword_76D520_terrain_cell_world_pos_around_party_y = pOutdoor->DoGetHeightOnTerrain(v4 + 1, v5 + 1); | |
6040 //dword_76D524_terrain_cell_world_pos_around_party_y = pOutdoor->DoGetHeightOnTerrain(v4, v5 + 1); | |
791 | 6041 *pIsOnWater = false; |
812 | 6042 if ( pOutdoor->ActuallyGetSomeOtherTileInfo(grid_x, grid_z) & 2 ) |
791 | 6043 *pIsOnWater = true; |
0 | 6044 v14 = 0; |
812 | 6045 if ( !bFloatAboveWater && *pIsOnWater ) |
0 | 6046 v14 = -60; |
812 | 6047 if ( y_x1z1 != y_x2z1 || |
6048 y_x2z1 != y_x2z2 || | |
6049 y_x2z2 != y_x1z2 ) | |
6050 { | |
6051 if ( abs(grid_z1 - a2) >= abs(a1 - grid_x1) ) | |
6052 { | |
6053 v8 = y_x1z2; | |
6054 v9 = y_x2z2; | |
6055 v10 = y_x1z1; | |
6056 v15 = a1 - grid_x1; | |
6057 v13 = a2 - grid_z2; | |
0 | 6058 } |
6059 else | |
6060 { | |
812 | 6061 v8 = y_x2z1; |
6062 v9 = y_x1z1; | |
6063 v10 = y_x2z2; | |
6064 v15 = grid_x2 - a1; | |
6065 v13 = grid_z1 - a2; | |
6066 } | |
871 | 6067 return v14 + v8 + fixpoint_sub0(v13, (v10 - v8) * 128) + fixpoint_sub0(v15, (v9 - v8) * 128); |
812 | 6068 } |
6069 else | |
6070 return y_x1z1; | |
0 | 6071 } |
6072 | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
6073 |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
6074 |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
6075 |
0 | 6076 |
6077 //----- (00485F53) -------------------------------------------------------- | |
1458 | 6078 void sr_485F53(Vec2_int_ *v) |
0 | 6079 { |
6080 ++v->y; | |
6081 if ( v->y > 1000 ) | |
6082 v->y = 0; | |
6083 } | |
6084 | |
6085 //----- (0048607B) -------------------------------------------------------- | |
1427 | 6086 void Polygon::Create_48607B(stru149 *a2) |
0 | 6087 { |
6088 this->pTexture = 0; | |
6089 this->ptr_38 = a2; | |
6090 } | |
6091 | |
6092 //----- (00486089) -------------------------------------------------------- | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
6093 void Polygon::_normalize_v_18() |
0 | 6094 { |
6095 double v2; // st7@1 | |
6096 double v3; // st6@1 | |
6097 double v5; // st5@1 | |
6098 | |
1025 | 6099 //v1 = this; |
0 | 6100 v2 = (double)this->v_18.x; |
6101 v3 = (double)this->v_18.y; | |
6102 v5 = (double)this->v_18.z; | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
6103 float len = sqrt(v5 * v5 + v3 * v3 + v2 * v2); |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
6104 if (fabsf(len) < 1e-6f) |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
6105 { |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
6106 v_18.x = 0; |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
6107 v_18.y = 0; |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
6108 v_18.z = 65536; |
0 | 6109 } |
6110 else | |
6111 { | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
6112 v_18.x = round(v2 / len * 65536.0); |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
6113 v_18.y = round(v3 / len * 65536.0); |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
6114 v_18.y = round(v5 / len * 65536.0); |
0 | 6115 } |
6116 } | |
6117 | |
6118 //----- (0048616B) -------------------------------------------------------- | |
1544 | 6119 void stru149::_48616B_frustum_odm(int a2, int a3, int a4, int a5, int a6, int a7) |
0 | 6120 { |
6121 int v7; // ebx@1 | |
1544 | 6122 //int v8; // esi@1 |
0 | 6123 int v9; // edi@1 |
1544 | 6124 //int v10; // eax@1 |
0 | 6125 int v11; // edx@1 |
1544 | 6126 //int v12; // esi@2 |
6127 //int v13; // eax@2 | |
6128 //int v14; // ST10_4@3 | |
6129 //int v15; // esi@3 | |
6130 //int v16; // eax@5 | |
0 | 6131 int v17; // ST0C_4@6 |
1544 | 6132 //int v18; // eax@8 |
0 | 6133 int v19; // ST0C_4@9 |
1544 | 6134 //int v20; // eax@10 |
6135 //int v21; // edx@10 | |
6136 //int v22; // eax@10 | |
6137 //int result; // eax@10 | |
0 | 6138 int v24; // [sp+14h] [bp-14h]@1 |
6139 int v25; // [sp+18h] [bp-10h]@1 | |
1544 | 6140 //int v26; // [sp+1Ch] [bp-Ch]@1 |
0 | 6141 int v27; // [sp+24h] [bp-4h]@1 |
1544 | 6142 //int v28; // [sp+30h] [bp+8h]@10 |
6143 //int v29; // [sp+3Ch] [bp+14h]@10 | |
0 | 6144 |
6145 v25 = pOutdoorCamera->camera_rotation_x_int_cosine; | |
6146 v7 = pOutdoorCamera->camera_rotation_y_int_sine; | |
6147 v27 = pOutdoorCamera->camera_rotation_x_int_sine; | |
1544 | 6148 //v8 = -pIndoorCamera->pos.y; |
0 | 6149 v9 = pOutdoorCamera->camera_rotation_y_int_cosine; |
1544 | 6150 //v26 = -pIndoorCamera->pos.z; |
6151 v11 = pOutdoorCamera->camera_rotation_y_int_cosine * -pIndoorCamera->pos.x + pOutdoorCamera->camera_rotation_y_int_sine * -pIndoorCamera->pos.y; | |
6152 v24 = pOutdoorCamera->camera_rotation_y_int_cosine * -pIndoorCamera->pos.y - pOutdoorCamera->camera_rotation_y_int_sine * -pIndoorCamera->pos.x; | |
0 | 6153 if ( pIndoorCamera->sRotationX ) |
6154 { | |
1544 | 6155 this->field_0_party_dir_x = fixpoint_sub0(v11, pOutdoorCamera->camera_rotation_x_int_cosine) + |
6156 fixpoint_sub0((-pIndoorCamera->pos.z) << 16, pOutdoorCamera->camera_rotation_x_int_sine); | |
6157 this->field_4_party_dir_y = v24; | |
6158 this->field_8_party_dir_z = fixpoint_sub0((-pIndoorCamera->pos.z) << 16, v25) - fixpoint_sub0(v11, v27); | |
0 | 6159 } |
6160 else | |
6161 { | |
755 | 6162 this->field_0_party_dir_x = v11; |
1544 | 6163 this->field_4_party_dir_y = v24; |
6164 this->field_8_party_dir_z = (-pIndoorCamera->pos.z) << 16; | |
6165 } | |
6166 | |
6167 if (pIndoorCamera->sRotationX) | |
6168 { | |
6169 v17 = fixpoint_sub0(a2, v9) + fixpoint_sub0(a3, v7); | |
6170 | |
6171 this->field_C = fixpoint_sub0(v17, v25) + fixpoint_sub0(a4, v27); | |
6172 this->field_10 = fixpoint_sub0(a3, v9) - fixpoint_sub0(a2, v7); | |
6173 this->field_14 = fixpoint_sub0(a4, v25) - fixpoint_sub0(v17, v27); | |
0 | 6174 } |
6175 else | |
6176 { | |
1544 | 6177 this->field_C = fixpoint_sub0(a2, v9) + fixpoint_sub0(a3, v7); |
6178 this->field_10 = fixpoint_sub0(a3, v9) - fixpoint_sub0(a2, v7); | |
6179 this->field_14 = a4; | |
6180 } | |
6181 | |
6182 if (pIndoorCamera->sRotationX) | |
6183 { | |
6184 v19 = fixpoint_sub0(a5, v9) + fixpoint_sub0(a6, v7); | |
6185 | |
6186 this->field_18 = fixpoint_sub0(v19, v25) + fixpoint_sub0(a7, v27); | |
6187 this->field_1C = fixpoint_sub0(a6, v9) - fixpoint_sub0(a5, v7); | |
6188 this->field_20 = fixpoint_sub0(a7, v25) - fixpoint_sub0(v19, v27); | |
0 | 6189 } |
6190 else | |
6191 { | |
1544 | 6192 this->field_18 = fixpoint_sub0(a5, v9) + fixpoint_sub0(a6, v7); |
6193 this->field_1C = fixpoint_sub0(a6, v9) - fixpoint_sub0(a5, v7); | |
6194 this->field_20 = a7; | |
6195 } | |
6196 | |
0 | 6197 this->field_18 = -this->field_18; |
6198 this->field_1C = -this->field_1C; | |
6199 this->field_20 = -this->field_20; | |
1544 | 6200 |
6201 this->field_24 = fixpoint_dot(this->field_C, this->field_0_party_dir_x, | |
6202 this->field_10, this->field_4_party_dir_y, | |
6203 this->field_14, this->field_8_party_dir_z); | |
6204 this->field_28 = fixpoint_dot(this->field_18, this->field_0_party_dir_x, | |
6205 this->field_1C, this->field_4_party_dir_y, | |
6206 this->field_20, this->field_8_party_dir_z); | |
0 | 6207 } |
6208 | |
6209 //----- (0048694B) -------------------------------------------------------- | |
1544 | 6210 void stru149::_48694B_frustum_sky() |
0 | 6211 { |
6212 this->field_18 = -this->field_18; | |
6213 this->field_1C = -this->field_1C; | |
6214 this->field_20 = -this->field_20; | |
1544 | 6215 |
6216 this->field_24 = fixpoint_dot(this->field_C, this->field_0_party_dir_x, | |
6217 this->field_10, this->field_4_party_dir_y, | |
6218 this->field_14, this->field_8_party_dir_z); | |
6219 this->field_28 = fixpoint_dot(this->field_18, this->field_0_party_dir_x, | |
6220 this->field_1C, this->field_4_party_dir_y, | |
6221 this->field_20, this->field_8_party_dir_z); | |
0 | 6222 } |
6223 | |
6224 //----- (0044100D) -------------------------------------------------------- | |
994 | 6225 bool sub_44100D() |
0 | 6226 { |
569 | 6227 return pCurrentScreen == SCREEN_NPC_DIALOGUE || pCurrentScreen == SCREEN_CHARACTERS || |
6228 pCurrentScreen > SCREEN_LOADGAME && pCurrentScreen <= SCREEN_E || | |
6229 pCurrentScreen > SCREEN_VIDEO && pCurrentScreen <= SCREEN_INPUT_BLV || pCurrentScreen == SCREEN_CASTING; | |
0 | 6230 } |
6231 // 4E28F8: using guessed type int pCurrentScreen; | |
6232 | |
6233 //----- (00441A4E) -------------------------------------------------------- | |
910 | 6234 __int16 __fastcall sub_441A4E(int a1)//for blessing |
0 | 6235 { |
6236 __int16 result; // ax@1 | |
6237 int v2; // ebx@1 | |
6238 char *v3; // esi@1 | |
6239 int v4; // edi@4 | |
1110 | 6240 bool v5; // ecx@4 |
1523
53265d238d94
interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents:
1504
diff
changeset
|
6241 SpriteFrame *pFrame; // eax@6 |
53265d238d94
interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents:
1504
diff
changeset
|
6242 //SpriteFrame *v7; // edi@6 |
0 | 6243 int v8; // eax@6 |
6244 unsigned __int16 v9; // ax@6 | |
6245 RenderBillboardTransform_local0 v10; // [sp+Ch] [bp-5Ch]@1 | |
6246 int v11; // [sp+5Ch] [bp-Ch]@6 | |
6247 int v12; // [sp+60h] [bp-8h]@1 | |
6248 int v13; // [sp+64h] [bp-4h]@6 | |
6249 | |
6250 v10.uParentBillboardID = -1; | |
6251 v10.pTarget = pRenderer->pTargetSurface; | |
6252 v10.pTargetZ = pRenderer->pActiveZBuffer; | |
6253 v10.uTargetPitch = pRenderer->field_10; | |
6254 result = 0; | |
6255 v2 = a1; | |
6256 v10.uViewportX = 0; | |
6257 v10.uViewportY = 0; | |
6258 v10.uViewportZ = 639; | |
6259 v10.uViewportW = 479; | |
6260 v12 = 0; | |
921 | 6261 //v3 = (char *)&pOtherOverlayList->pOverlays[0].field_C; |
6262 //do | |
6263 for ( uint i = 0; i < 50; ++i ) | |
6264 { | |
6265 if ( pOtherOverlayList->pOverlays[i].field_6 > 0 ) | |
6266 { | |
6267 result = pOtherOverlayList->pOverlays[i].field_0; | |
6268 if ( pOtherOverlayList->pOverlays[i].field_0 >= 300 ) | |
6269 { | |
6270 //v4 = result; | |
6271 v5 = pOtherOverlayList->pOverlays[i].field_0 == v2 + 320 | |
1110 | 6272 || pOtherOverlayList->pOverlays[i].field_0 == v2 + 330 |
6273 || pOtherOverlayList->pOverlays[i].field_0 == v2 + 340 | |
6274 || pOtherOverlayList->pOverlays[i].field_0 == v2 + 350; | |
921 | 6275 pOtherOverlayList->pOverlays[i].field_0 = v2 + 310; |
1110 | 6276 if ( pOtherOverlayList->pOverlays[i].field_0 == v2 + 310 || v5 ) |
921 | 6277 { |
6278 if ( !pOtherOverlayList->pOverlays[i].field_0 ) | |
6279 { | |
1523
53265d238d94
interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents:
1504
diff
changeset
|
6280 pFrame = pSpriteFrameTable->GetFrame(pOverlayList->pOverlays[pOtherOverlayList->pOverlays[i].field_2].uSpriteFramesetID, |
921 | 6281 pOtherOverlayList->pOverlays[i].field_4); |
1523
53265d238d94
interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents:
1504
diff
changeset
|
6282 //v7 = v6; |
921 | 6283 v11 = pOtherOverlayList->pOverlays[i].field_E; |
1523
53265d238d94
interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents:
1504
diff
changeset
|
6284 //v13 = pFrame->scale; |
53265d238d94
interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents:
1504
diff
changeset
|
6285 v13 = (unsigned __int64)(v11 * (signed __int64)pFrame->scale) >> 16; |
921 | 6286 v10.uScreenSpaceX = pOtherOverlayList->pOverlays[i].field_8; |
6287 v10.uScreenSpaceY = pOtherOverlayList->pOverlays[i].field_A; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
142
diff
changeset
|
6288 v10._screenspace_x_scaler_packedfloat = v13; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
142
diff
changeset
|
6289 v10._screenspace_y_scaler_packedfloat = v13; |
1523
53265d238d94
interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents:
1504
diff
changeset
|
6290 v10.pPalette = PaletteManager::Get_Dark_or_Red_LUT(pFrame->uPaletteIndex, 0, 1); |
921 | 6291 v8 = pOtherOverlayList->pOverlays[i].field_2; |
0 | 6292 v10.sZValue = 0; |
6293 v10.uFlags = 0; | |
6294 v9 = pOverlayList->pOverlays[v8].uOverlayType; | |
6295 if ( !v9 || v9 == 2 ) | |
1523
53265d238d94
interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents:
1504
diff
changeset
|
6296 v10.uScreenSpaceY += pSprites_LOD->pSpriteHeaders[pFrame->pHwSpriteIDs[0]].uHeight >> 1; |
53265d238d94
interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents:
1504
diff
changeset
|
6297 result = pSprites_LOD->pSpriteHeaders[pFrame->pHwSpriteIDs[0]]._4AD2D1(&v10, 0); |
0 | 6298 ++v12; |
6299 if ( v12 == 5 ) | |
6300 break; | |
6301 } | |
6302 } | |
6303 } | |
6304 } | |
921 | 6305 //v3 += 20; |
6306 } | |
6307 //while ( (signed int)v3 < (signed int)&pOverlayList->pOverlays ); | |
0 | 6308 return result; |
6309 } | |
6310 | |
6311 //----- (00443801) -------------------------------------------------------- | |
237 | 6312 void Initialize2DA() |
6313 { | |
6314 | |
6315 int i; | |
6316 char* test_string; | |
6317 unsigned char c; | |
6318 bool break_loop; | |
6319 unsigned int temp_str_len; | |
6320 char* tmp_pos; | |
6321 int decode_step; | |
6322 | |
6323 if ( p2DEventsTXT_Raw ) | |
1583 | 6324 free(p2DEventsTXT_Raw); |
237 | 6325 p2DEventsTXT_Raw = NULL; |
6326 p2DEventsTXT_Raw = (char *)pEvents_LOD->LoadRaw("2dEvents.txt", 0); | |
6327 strtok(p2DEventsTXT_Raw, "\r"); | |
6328 strtok(NULL, "\r"); | |
6329 | |
6330 for (i=0;i<525;++i) | |
6331 { | |
6332 test_string = strtok(NULL, "\r") + 1; | |
6333 break_loop = false; | |
6334 decode_step=0; | |
6335 do | |
6336 { | |
6337 c = *(unsigned char*)test_string; | |
6338 temp_str_len = 0; | |
6339 while((c!='\t')&&(c>0)) | |
6340 { | |
6341 ++temp_str_len; | |
6342 c=test_string[temp_str_len]; | |
6343 } | |
6344 tmp_pos=test_string+temp_str_len; | |
6345 if (*tmp_pos == 0) | |
6346 break_loop = true; | |
6347 *tmp_pos = 0; | |
6348 if (temp_str_len) | |
6349 { | |
6350 switch (decode_step) | |
6351 { | |
6352 case 2: | |
6353 { | |
6354 if ( !_strnicmp(test_string, "wea", 3) ) | |
6355 { | |
1411 | 6356 p2DEvents[i].uType = BuildingType_WeaponShop; |
237 | 6357 break; |
6358 } | |
6359 if ( !_strnicmp(test_string, "arm", 3) ) | |
6360 { | |
1411 | 6361 p2DEvents[i].uType = BuildingType_ArmorShop; |
237 | 6362 break; |
6363 } | |
6364 if ( !_strnicmp(test_string, "mag", 3) ) | |
6365 { | |
1411 | 6366 p2DEvents[i].uType = BuildingType_MagicShop; |
237 | 6367 break; |
6368 } | |
6369 if ( !_strnicmp(test_string, "alc", 3) ) | |
6370 { | |
1411 | 6371 p2DEvents[i].uType = BuildingType_AlchemistShop; |
237 | 6372 break; |
6373 } | |
6374 if ( !_strnicmp(test_string, "sta", 3) ) | |
6375 { | |
1411 | 6376 p2DEvents[i].uType = BuildingType_Stables; |
237 | 6377 break; |
6378 } | |
6379 if ( !_strnicmp(test_string, "boa", 3) ) | |
6380 { | |
1411 | 6381 p2DEvents[i].uType = BuildingType_Boats; |
237 | 6382 break; |
6383 } | |
6384 if ( !_strnicmp(test_string, "tem", 3) ) | |
6385 { | |
1411 | 6386 p2DEvents[i].uType = BuildingType_Temple; |
237 | 6387 break; |
6388 } | |
6389 if ( !_strnicmp(test_string, "tra", 3) ) | |
6390 { | |
1411 | 6391 p2DEvents[i].uType = BuildingType_Training; |
237 | 6392 break; |
6393 } | |
6394 if ( !_strnicmp(test_string, "tow", 3) ) | |
6395 { | |
1411 | 6396 p2DEvents[i].uType = BuildingType_TownHall; |
237 | 6397 break; |
6398 } | |
6399 | |
6400 if ( !_strnicmp(test_string, "tav", 3) ) | |
6401 { | |
1411 | 6402 p2DEvents[i].uType = BuildingType_Tavern; |
237 | 6403 break; |
6404 } | |
6405 if ( !_strnicmp(test_string, "ban", 3) ) | |
6406 { | |
1411 | 6407 p2DEvents[i].uType = BuildingType_Bank; |
237 | 6408 break; |
6409 } | |
6410 if ( !_strnicmp(test_string, "fir", 3) ) | |
6411 { | |
1411 | 6412 p2DEvents[i].uType = BuildingType_FireGuild; |
237 | 6413 break; |
6414 } | |
6415 if ( !_strnicmp(test_string, "air", 3) ) | |
6416 { | |
1411 | 6417 p2DEvents[i].uType = BuildingType_AirGuild; |
237 | 6418 break; |
6419 } | |
6420 if ( !_strnicmp(test_string, "wat", 3) ) | |
6421 { | |
1411 | 6422 p2DEvents[i].uType = BuildingType_WaterGuild; |
237 | 6423 break; |
6424 } | |
6425 if ( !_strnicmp(test_string, "ear", 3) ) | |
6426 { | |
1411 | 6427 p2DEvents[i].uType = BuildingType_EarthGuild; |
237 | 6428 break; |
6429 } | |
6430 if ( !_strnicmp(test_string, "spi", 3) ) | |
6431 { | |
1411 | 6432 p2DEvents[i].uType = BuildingType_SpiritGuild; |
237 | 6433 break; |
6434 } | |
6435 if ( !_strnicmp(test_string, "min", 3) ) | |
6436 { | |
1411 | 6437 p2DEvents[i].uType = BuildingType_MindGuild; |
237 | 6438 break; |
6439 } | |
6440 if ( !_strnicmp(test_string, "bod", 3) ) | |
6441 { | |
1411 | 6442 p2DEvents[i].uType = BuildingType_BodyGuild; |
237 | 6443 break; |
6444 } | |
6445 if ( !_strnicmp(test_string, "lig", 3) ) | |
6446 { | |
1411 | 6447 p2DEvents[i].uType = BuildingType_LightGuild; |
237 | 6448 break; |
6449 } | |
6450 if ( !_strnicmp(test_string, "dar", 3) ) | |
6451 { | |
1411 | 6452 p2DEvents[i].uType = BuildingType_DarkGuild; |
237 | 6453 break; |
6454 } | |
6455 if ( !_strnicmp(test_string, "ele", 3) ) | |
6456 { | |
1411 | 6457 p2DEvents[i].uType = BuildingType_14; |
237 | 6458 break; |
6459 } | |
6460 if ( !_strnicmp(test_string, "sel", 3) ) | |
6461 { | |
1411 | 6462 p2DEvents[i].uType = BuildingType_15; |
237 | 6463 break; |
6464 } | |
6465 if ( !_strnicmp(test_string, "mir", 3) ) | |
6466 { | |
1411 | 6467 p2DEvents[i].uType = BuildingType_16; |
237 | 6468 break; |
6469 } | |
6470 if ( !_strnicmp(test_string, "mer", 3) ) | |
6471 { | |
1411 | 6472 p2DEvents[i].uType = BuildingType_TownHall; |
237 | 6473 break; |
6474 } | |
1411 | 6475 p2DEvents[i].uType = BuildingType_18; |
237 | 6476 } |
6477 break; | |
6478 | |
6479 case 4: | |
6480 p2DEvents[i].uAnimationID = atoi(test_string); | |
6481 break; | |
6482 case 5: | |
6483 p2DEvents[i].pName = RemoveQuotes(test_string); | |
6484 break; | |
6485 case 6: | |
6486 p2DEvents[i].pProprieterName = RemoveQuotes(test_string); | |
6487 break; | |
6488 case 7: | |
6489 p2DEvents[i].pProprieterTitle = RemoveQuotes(test_string); | |
6490 break; | |
6491 case 8: | |
6492 p2DEvents[i].field_14 = atoi(test_string); | |
6493 break; | |
6494 case 9: | |
6495 p2DEvents[i]._state = atoi(test_string); | |
6496 break; | |
6497 case 10: | |
6498 p2DEvents[i]._rep = atoi(test_string); | |
6499 break; | |
6500 case 11: | |
6501 p2DEvents[i]._per = atoi(test_string); | |
6502 break; | |
6503 case 12: | |
6504 p2DEvents[i].fPriceMultiplier = atof(test_string); | |
6505 break; | |
6506 case 13: | |
6507 p2DEvents[i].flt_24 = atof(test_string); | |
6508 break; | |
6509 case 15: | |
6510 p2DEvents[i].field_1C = atoi(test_string); | |
6511 break; | |
6512 case 18: | |
6513 p2DEvents[i].uOpenTime = atoi(test_string); | |
6514 break; | |
6515 case 19: | |
6516 p2DEvents[i].uCloseTime = atoi(test_string); | |
6517 break; | |
6518 case 20: | |
6519 p2DEvents[i].uExitPicID = atoi(test_string); | |
6520 break; | |
6521 case 21: | |
6522 p2DEvents[i].uExitMapID = atoi(test_string); | |
6523 break; | |
6524 case 22: | |
6525 p2DEvents[i]._quest_related = atoi(test_string); | |
6526 break; | |
6527 case 23: | |
6528 p2DEvents[i].pEnterText = RemoveQuotes(test_string); | |
6529 break; | |
6530 } | |
6531 } | |
6532 ++decode_step; | |
6533 test_string=tmp_pos+1; | |
6534 } while ((decode_step<24)&&!break_loop); | |
6535 } | |
6536 | |
0 | 6537 } |
6538 | |
6539 //----- (00443E31) -------------------------------------------------------- | |
601 | 6540 void LoadLevel_InitializeLevelStr() |
6541 { | |
329 | 6542 |
6543 char Args[100]; | |
6544 int string_num; | |
6545 int max_string_length; | |
6546 int current_string_length; | |
6547 int prev_string_offset; | |
6548 | |
6549 if (sizeof(pLevelStrOffsets) != 2000) | |
0 | 6550 Log::Warning(L"pLevelStrOffsets: deserialization warning"); |
1202 | 6551 memset(pLevelStrOffsets.data(), 0, 2000); |
0 | 6552 |
329 | 6553 max_string_length = 0; |
6554 string_num = 1; | |
6555 prev_string_offset = 0; | |
336 | 6556 pLevelStrOffsets[0]=0; |
0 | 6557 for (uint i = 0; i < uLevelStrFileSize; ++i) |
6558 { | |
6559 if ( !pLevelStr[i] ) | |
6560 { | |
329 | 6561 pLevelStrOffsets[string_num] = i + 1; |
6562 ++string_num; | |
6563 if ( i - prev_string_offset > max_string_length ) | |
6564 max_string_length = i - prev_string_offset; | |
6565 prev_string_offset = i; | |
6566 } | |
6567 } | |
6568 | |
6569 uLevelStrNumStrings = string_num - 1; | |
6570 if ( max_string_length > 800 ) | |
1545 | 6571 Error("MAX_EVENT_TEXT_LENGTH needs to be increased to %lu", max_string_length+1); |
329 | 6572 |
6573 if ( uLevelStrNumStrings > 0 ) | |
6574 { | |
336 | 6575 for(uint i = 0; i <uLevelStrNumStrings ; ++i) |
329 | 6576 { |
6577 if ( RemoveQuotes(&pLevelStr[pLevelStrOffsets[i]]) != &pLevelStr[pLevelStrOffsets[i]] ) | |
6578 ++pLevelStrOffsets[i]; | |
6579 } | |
0 | 6580 } |
6581 } | |
6582 | |
6583 //----- (00443F95) -------------------------------------------------------- | |
1458 | 6584 void OnMapLeave() |
0 | 6585 { |
336 | 6586 _evt_raw *test_event; |
6587 if ( uLevelEVT_NumEvents > 0 ) | |
6588 { | |
6589 for (uint i = 0; i < uLevelEVT_NumEvents; ++i) | |
6590 { | |
6591 test_event=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[i].uEventOffsetInEVT]; | |
1052 | 6592 if ( test_event->_e_type == EVENT_OnMapLeave ) |
6593 { | |
6594 EventProcessor(pLevelEVT_Index[i].uEventID, 0, 1, pLevelEVT_Index[i].event_sequence_num); | |
336 | 6595 } |
6596 } | |
0 | 6597 } |
6598 } | |
6599 | |
6600 //----- (00443FDC) -------------------------------------------------------- | |
6601 void OnMapLoad() | |
781 | 6602 { |
363 | 6603 stru176 *v3; // esi@7 |
6604 __int16 v4; // cx@9 | |
6605 __int16 v5; // di@9 | |
6606 int v6; // eax@9 | |
6607 signed __int64 v8; // qax@26 | |
6608 unsigned int v9; // ecx@26 | |
6609 signed __int64 v10; // qax@26 | |
6610 signed __int64 v11; // qax@26 | |
6611 int v12; // ST50_4@26 | |
6612 signed __int64 v13; // qax@26 | |
6613 signed __int64 v14; // qax@26 | |
6614 int v15; // ST58_4@26 | |
6615 signed __int64 v16; // qax@26 | |
6616 int hours; // ebx@26 | |
6617 unsigned __int64 v18; // [sp+Ch] [bp-44h]@12 | |
6618 signed __int64 seconds; // [sp+14h] [bp-3Ch]@26 | |
6619 unsigned __int64 v20; // [sp+1Ch] [bp-34h]@7 | |
6620 int minutes; // [sp+2Ch] [bp-24h]@26 | |
6621 int years; // [sp+34h] [bp-1Ch]@26 | |
6622 int weeks; // [sp+38h] [bp-18h]@26 | |
6623 int v26; // [sp+3Ch] [bp-14h]@15 | |
6624 int days; // [sp+3Ch] [bp-14h]@26 | |
6625 int months; // [sp+40h] [bp-10h]@26 | |
6626 __int16 v29; // [sp+46h] [bp-Ah]@9 | |
6627 __int16 v30; // [sp+48h] [bp-8h]@9 | |
6628 __int16 v31; // [sp+4Ah] [bp-6h]@9 | |
6629 __int16 v32; // [sp+4Ch] [bp-4h]@9 | |
6630 __int16 v33; // [sp+4Eh] [bp-2h]@9 | |
6631 | |
6632 for (uint i = 0; i < uLevelEVT_NumEvents; ++i) | |
781 | 6633 { |
363 | 6634 auto pEvent = pLevelEVT_Index[i]; |
6635 | |
1202 | 6636 auto _evt = (_evt_raw *)(&pLevelEVT[pEvent.uEventOffsetInEVT]); |
363 | 6637 |
6638 if (_evt->_e_type == EVENT_PlaySound) | |
781 | 6639 { |
601 | 6640 pSoundList->LoadSound(EVT_DWORD(_evt->v5), 0); |
781 | 6641 } |
363 | 6642 else if (_evt->_e_type == EVENT_OnMapReload) |
781 | 6643 { |
1052 | 6644 EventProcessor(pEvent.uEventID, 0, 0, pEvent.event_sequence_num); |
781 | 6645 } |
1052 | 6646 else if (_evt->_e_type == EVENT_OnTimer || _evt->_e_type == EVENT_Initialize) |
781 | 6647 { |
363 | 6648 v3 = &array_5B5928_timers[dword_5B65C8_timers_count]; |
810 | 6649 v20 = pOutdoor->loc_time.uLastVisitDay; |
363 | 6650 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) |
6651 v20 = pIndoor->stru1.uLastVisitDay; | |
6652 | |
6653 v3->timer_evt_type = _evt->_e_type; | |
6654 v3->timer_evt_ID = pEvent.uEventID; | |
6655 v3->timer_evt_seq_num = pEvent.event_sequence_num; | |
6656 | |
6657 v3->field_10 = _evt->v5; | |
6658 v3->field_12 = _evt->v6; | |
6659 v3->field_14 = _evt->v7; | |
6660 v3->field_16 = _evt->v8; | |
6661 v3->field_18 = _evt->v9; | |
6662 v3->field_1A = _evt->v10; | |
6663 | |
6664 | |
6665 v6 = ((unsigned short)_evt->v12 << 8) + _evt->v11; | |
6666 | |
789 | 6667 v3->time_left_to_fire = ((unsigned short)_evt->v12 << 8) + _evt->v11; |
6668 v3->fire_interval = ((unsigned short)_evt->v12 << 8) + _evt->v11; | |
1052 | 6669 if (v3->timer_evt_type == EVENT_Initialize && !(short)v6 ) |
781 | 6670 { |
363 | 6671 if ( v20 ) |
6672 v18 = pParty->uTimePlayed - v20; | |
6673 else | |
6674 v18 = 0i64; | |
6675 v26 = (signed int)(signed __int64)((double)(signed __int64)v18 * 0.234375) / 60 / 60 / 24; | |
6676 | |
6677 if ( v26 / 7 / 4 / 12 ) | |
781 | 6678 { |
363 | 6679 if ( v3->field_10 ) |
781 | 6680 { |
363 | 6681 ++dword_5B65C8_timers_count; |
789 | 6682 v3->next_fire_time = 0; |
363 | 6683 continue; |
6684 } | |
781 | 6685 } |
363 | 6686 if (v26 / 7 / 4 != 0 && v3->field_12 != 0 || |
6687 v26 / 7 != 0 && v3->field_14 != 0 || | |
6688 v26 != 0 || !v20) | |
781 | 6689 { |
363 | 6690 ++dword_5B65C8_timers_count; |
789 | 6691 v3->next_fire_time = 0; |
363 | 6692 continue; |
6693 } | |
781 | 6694 } |
363 | 6695 else |
781 | 6696 { |
363 | 6697 v8 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375); |
6698 v9 = v8; | |
6699 v10 = (signed int)v8 / 60; | |
6700 minutes = v10 % 60; | |
6701 v11 = (signed int)(v10 / 60); | |
6702 v12 = v11 % 24; | |
6703 v13 = (signed int)(v11 / 24); | |
6704 days = v13 % 7; | |
6705 v14 = (signed int)(v13 / 7); | |
6706 v15 = v14 % 4; | |
6707 v16 = (signed int)(v14 / 4); | |
6708 years = v16 / 12; | |
6709 | |
6710 auto _1 = (unsigned __int64)((double)pParty->uTimePlayed * 0.234375) >> 32; | |
6711 auto _2 = ((__int64)v9 << 32) | _1; | |
6712 | |
6713 seconds = _2 % 60; | |
6714 //v19 = (signed __int64)__PAIR__((unsigned __int64)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) >> 32, | |
6715 // v9) | |
6716 // % 60; | |
6717 | |
6718 hours = v12; | |
6719 weeks = v15; | |
6720 months = v16 % 12; | |
6721 if ( v3->field_10 ) | |
781 | 6722 { |
363 | 6723 ++years; |
781 | 6724 } |
363 | 6725 else |
781 | 6726 { |
363 | 6727 if ( v3->field_12 ) |
781 | 6728 { |
6729 ++months; | |
6730 } | |
6731 else | |
6732 { | |
6733 if ( v3->field_14 ) | |
363 | 6734 { |
781 | 6735 ++weeks; |
363 | 6736 } |
781 | 6737 else |
363 | 6738 { |
6739 ++days; | |
6740 minutes = v3->field_18; | |
6741 hours = v3->field_16; | |
6742 seconds = v3->field_1A; | |
6743 } | |
6744 } | |
781 | 6745 } |
789 | 6746 v3->next_fire_time = (signed __int64)((double)((seconds |
363 | 6747 + 60 * minutes |
6748 + 3600 * hours | |
6749 + 0x93A80 * weeks | |
6750 + 0x15180 * days | |
6751 + 0x24EA00 * (months + 12i64 * years)) << 7) | |
6752 * 0.033333335); | |
6753 | |
6754 ++dword_5B65C8_timers_count; | |
6755 } | |
6756 } | |
6757 } | |
781 | 6758 } |
0 | 6759 |
6760 //----- (00444360) -------------------------------------------------------- | |
1411 | 6761 void Level_LoadEvtAndStr(const char *pLevelName) |
0 | 6762 { |
6763 char pContainerName[120]; // [sp+8h] [bp-98h]@1 | |
6764 | |
6765 sprintf(pContainerName, "%s.evt", pLevelName); | |
1541 | 6766 uLevelEVT_Size = LoadEventsToBuffer(pContainerName, pLevelEVT.data(), 9216); |
0 | 6767 |
6768 sprintf(pContainerName, "%s.str", pLevelName); | |
1541 | 6769 uLevelStrFileSize = LoadEventsToBuffer(pContainerName, pLevelStr.data(), 9216); |
0 | 6770 if (uLevelStrFileSize) |
6771 LoadLevel_InitializeLevelStr(); | |
6772 } | |
6773 | |
6774 //----- (00444564) -------------------------------------------------------- | |
1458 | 6775 const char * sub_444564() |
0 | 6776 { |
6777 double v0; // st7@3 | |
6778 int v1; // ebx@3 | |
6779 int v2; // edi@3 | |
6780 int v3; // eax@3 | |
6781 int v5; // edi@6 | |
6782 int v6; // eax@6 | |
6783 int v7; // eax@6 | |
6784 unsigned __int8 v9; // zf@7 | |
6785 unsigned __int8 v10; // sf@7 | |
6786 ODMFace *v11; // eax@9 | |
6787 __int16 v12; // cx@9 | |
6788 const char *v13; // eax@11 | |
6789 const char *v14; // edi@11 | |
6790 const char *result; // eax@15 | |
6791 unsigned int v16; // [sp+0h] [bp-20h]@3 | |
6792 const char *v17; // [sp+4h] [bp-1Ch]@3 | |
6793 unsigned int pY; // [sp+8h] [bp-18h]@3 | |
6794 float v19; // [sp+Ch] [bp-14h]@1 | |
695 | 6795 int v20; |
0 | 6796 int v21; // [sp+14h] [bp-Ch]@1 |
6797 unsigned int v22; // [sp+18h] [bp-8h]@8 | |
6798 int pX; // [sp+1Ch] [bp-4h]@3 | |
6799 | |
693 | 6800 v20 = viewparams->sViewCenterX; |
6801 v21 = viewparams->sViewCenterY; | |
0 | 6802 v19 = (double)viewparams->field_2C * 0.000015258789; |
6803 if ( viewparams->field_2C == 384 ) | |
6804 { | |
711 | 6805 v20 = viewparams->indoor_center_x; |
6806 v21 = viewparams->indoor_center_y; | |
0 | 6807 } |
6808 v17 = 0; | |
6809 v16 = pOutdoor->uNumBModels; | |
6810 pMouse->GetClickPos((unsigned int *)&pX, &pY); | |
6811 v0 = 1.0 / v19; | |
6812 v1 = (signed __int64)((double)(pX - 229) * v0 + (double)v20); | |
6813 LODWORD(v19) = (signed __int64)((double)v21 - (double)(signed int)(pY - 181) * v0); | |
6814 v2 = abs(v1 + 22528) / 512; | |
6815 v3 = abs((signed)LODWORD(v19) - 22528); | |
695 | 6816 result = 0; |
0 | 6817 if ( pOutdoor->_47F04C(v2, v3 / 512) |
6818 && uCurrentlyLoadedLevelType == LEVEL_Outdoor | |
695 | 6819 && (signed int)v16 > 0 ) |
6820 { | |
6821 for(int i = 0; i < pOutdoor->uNumBModels && !v17; i++) | |
6822 { | |
6823 pX = pOutdoor->pBModels[i].vBoundingCenter.x - v1; | |
6824 pY = pOutdoor->pBModels[i].vBoundingCenter.y - LODWORD(v19); | |
0 | 6825 v5 = abs((signed)pY); |
6826 v6 = abs((signed)pX); | |
322 | 6827 v7 = int_get_vector_length(v6, v5, 0); |
695 | 6828 if ( v7 < pOutdoor->pBModels[i].sBoundingRadius ) |
6829 { | |
6830 if ( pOutdoor->pBModels[i].uNumFaces > 0 ) | |
6831 { | |
6832 for(int j = 0; j < pOutdoor->pBModels[i].uNumFaces; j++) | |
6833 { | |
6834 v11 = &pOutdoor->pBModels[i].pFaces[j];//&v8[v4]->pFaces[v22 / 0x134]; | |
0 | 6835 v12 = v11->sCogTriggeredID; |
6836 if ( v12 ) | |
6837 { | |
1546 | 6838 if ( !(v11->uAttributes & 0x100000) ) |
0 | 6839 { |
428 | 6840 v13 = GetEventHintString(v12); |
0 | 6841 v14 = v13; |
6842 if ( v13 ) | |
6843 { | |
1104 | 6844 if ( _stricmp(v13, "") ) |
0 | 6845 v17 = v14; |
6846 } | |
6847 } | |
6848 } | |
695 | 6849 } |
0 | 6850 } |
6851 result = v17; | |
695 | 6852 } |
6853 } | |
0 | 6854 } |
6855 return result; | |
6856 } | |
6857 | |
6858 //----- (00444D80) -------------------------------------------------------- | |
1411 | 6859 int GetTravelTime() |
0 | 6860 { |
6861 signed int v0; // esi@1 | |
6862 | |
6863 v0 = uDefaultTravelTime_ByFoot; | |
652 | 6864 if ( CheckHiredNPCSpeciality(Guide) ) |
0 | 6865 --v0; |
652 | 6866 if ( CheckHiredNPCSpeciality(Tracker) ) |
0 | 6867 v0 -= 2; |
652 | 6868 if ( CheckHiredNPCSpeciality(Pathfinder) ) |
0 | 6869 v0 -= 3; |
652 | 6870 if ( CheckHiredNPCSpeciality(Explorer) ) |
0 | 6871 --v0; |
6872 if ( v0 < 1 ) | |
6873 v0 = 1; | |
6874 return v0; | |
6875 } | |
6876 // 6BD07C: using guessed type int uDefaultTravelTime_ByFoot; | |
6877 | |
6878 //----- (004451A8) -------------------------------------------------------- | |
6879 void __fastcall sub_4451A8_press_any_key(int a1, int a2, int a4) | |
6880 { | |
6881 int v3; // esi@1 | |
6882 int v4; // edi@1 | |
6883 | |
6884 v3 = a2; | |
6885 v4 = a1; | |
6886 if ( !pGUIWindow2 ) | |
6887 { | |
6888 if ( pParty->uFlags & 2 ) | |
6889 pGame->Draw(); | |
1052 | 6890 pAudioPlayer->StopChannels(-1, -1); |
0 | 6891 pMiscTimer->Pause(); |
6892 pEventTimer->Pause(); | |
6893 dword_5C3418 = v4; | |
6894 dword_5C341C = v3; | |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
515
diff
changeset
|
6895 _591094_decoration = activeLevelDecoration; |
948 | 6896 pGUIWindow2 = GUIWindow::Create(0, 0, 640, 480, WINDOW_GreetingNPC, a4, 0); |
6897 pGUIWindow2->CreateButton( 61, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0); | |
6898 pGUIWindow2->CreateButton(177, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0); | |
6899 pGUIWindow2->CreateButton(292, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0); | |
6900 pGUIWindow2->CreateButton(407, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0); | |
0 | 6901 } |
6902 } | |
6903 | |
6904 //----- (004452BB) -------------------------------------------------------- | |
1546 | 6905 void sub_4452BB() |
0 | 6906 { |
6907 pGUIWindow2->Release(); | |
6908 pGUIWindow2 = 0; | |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
515
diff
changeset
|
6909 activeLevelDecoration = _591094_decoration; |
1052 | 6910 EventProcessor(dword_5C3418, 0, 1, dword_5C341C); |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
515
diff
changeset
|
6911 activeLevelDecoration = NULL; |
0 | 6912 pEventTimer->Resume(); |
6913 } | |
6914 | |
6915 //----- (004465DF) -------------------------------------------------------- | |
6916 int sub_4465DF_check_season(int a1) | |
6917 { | |
6918 unsigned int v1; // eax@1 | |
6919 unsigned int v2; // edx@1 | |
6920 int v3; // ecx@2 | |
6921 int v4; // ecx@3 | |
6922 char v6; // zf@9 | |
6923 | |
6924 v1 = pParty->uCurrentMonth + 1; | |
6925 v2 = pParty->uDaysPlayed + 1; | |
6926 if ( a1 ) | |
6927 { | |
6928 v3 = a1 - 1; | |
6929 if ( v3 ) | |
6930 { | |
6931 v4 = v3 - 1; | |
6932 if ( v4 ) | |
6933 { | |
6934 if ( v4 != 1 ) | |
6935 return 0; | |
6936 if ( v1 != 12 ) | |
6937 { | |
6938 if ( (signed int)v1 >= 1 && (signed int)v1 <= 2 ) | |
6939 return 1; | |
6940 v6 = v1 == 3; | |
6941 LABEL_24: | |
6942 if ( !v6 || (signed int)v2 >= 21 ) | |
6943 return 0; | |
6944 return 1; | |
6945 } | |
6946 } | |
6947 else | |
6948 { | |
6949 if ( v1 != 9 ) | |
6950 { | |
6951 if ( (signed int)v1 >= 10 && (signed int)v1 <= 11 ) | |
6952 return 1; | |
6953 v6 = v1 == 12; | |
6954 goto LABEL_24; | |
6955 } | |
6956 } | |
6957 } | |
6958 else | |
6959 { | |
6960 if ( v1 != 6 ) | |
6961 { | |
6962 if ( (signed int)v1 >= 7 && (signed int)v1 <= 8 ) | |
6963 return 1; | |
6964 v6 = v1 == 9; | |
6965 goto LABEL_24; | |
6966 } | |
6967 } | |
6968 } | |
6969 else | |
6970 { | |
6971 if ( v1 != 3 ) | |
6972 { | |
6973 if ( (signed int)v1 >= 4 && (signed int)v1 <= 5 ) | |
6974 return 1; | |
6975 v6 = v1 == 6; | |
6976 goto LABEL_24; | |
6977 } | |
6978 } | |
6979 if ( (signed int)v2 >= 21 ) | |
6980 return 1; | |
6981 return 0; | |
6982 } | |
6983 | |
6984 //----- (0044861E) -------------------------------------------------------- | |
6985 void __fastcall sub_44861E_set_texture(unsigned int uFaceCog, const char *pFilename) | |
6986 { | |
6987 unsigned int v2; // eax@2 | |
6988 unsigned __int16 v3; // di@2 | |
6989 signed int v4; // esi@5 | |
6990 BLVFace *v5; // eax@7 | |
6991 unsigned int *v6; // eax@8 | |
6992 char *v7; // eax@9 | |
6993 int v8; // edi@16 | |
6994 char *v9; // esi@16 | |
6995 ODMFace *v10; // eax@17 | |
6996 unsigned int *v11; // eax@19 | |
6997 unsigned __int16 v12; // [sp+Ch] [bp-18h]@2 | |
6998 const char *Str2; // [sp+10h] [bp-14h]@1 | |
6999 unsigned int v14; // [sp+14h] [bp-10h]@1 | |
7000 signed int v15; // [sp+18h] [bp-Ch]@14 | |
7001 int v16; // [sp+1Ch] [bp-8h]@15 | |
7002 signed int v17; // [sp+20h] [bp-4h]@4 | |
7003 signed int v18; // [sp+20h] [bp-4h]@16 | |
7004 | |
7005 Str2 = pFilename; | |
7006 v14 = uFaceCog; | |
7007 if ( uFaceCog ) | |
7008 { | |
7009 v2 = pBitmaps_LOD->LoadTexture(pFilename); | |
7010 v3 = v2; | |
7011 v12 = v2; | |
7012 if ( v2 != -1 ? (int)&pBitmaps_LOD->pTextures[v2] : 0 ) | |
7013 { | |
7014 pBitmaps_LOD->pTextures[v2].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[v2].palette_id1); | |
7015 | |
7016 if ( uCurrentlyLoadedLevelType == 1 ) | |
7017 { | |
7018 v17 = 1; | |
7019 if ( (signed int)pIndoor->uNumFaceExtras > 1 ) | |
7020 { | |
7021 v4 = 1; | |
7022 do | |
7023 { | |
7024 if ( pIndoor->pFaceExtras[v4].sCogNumber == v14 ) | |
7025 { | |
7026 v5 = &pIndoor->pFaces[pIndoor->pFaceExtras[v4].field_C]; | |
7027 if ( BYTE1(v5->uAttributes) & 0x40 ) | |
7028 { | |
7029 pIndoor->pFaces[pIndoor->pFaceExtras[v4].field_C].uBitmapID = pTextureFrameTable->FindTextureByName( | |
7030 Str2); | |
7031 v6 = (unsigned int *)&pIndoor->pFaces[pIndoor->pFaceExtras[v4].field_C].uBitmapID; | |
7032 if ( *(_WORD *)v6 ) | |
7033 { | |
7034 pTextureFrameTable->LoadAnimationSequenceAndPalettes(*(_WORD *)v6); | |
7035 } | |
7036 else | |
7037 { | |
7038 *(_WORD *)v6 = v3; | |
7039 v7 = (char *)&pIndoor->pFaces[pIndoor->pFaceExtras[v4].field_C].uAttributes; | |
7040 v7[1] &= 0xBFu; | |
7041 } | |
7042 } | |
7043 else | |
7044 { | |
7045 v5->uBitmapID = v3; | |
7046 } | |
7047 } | |
7048 ++v17; | |
7049 ++v4; | |
7050 } | |
7051 while ( v17 < (signed int)pIndoor->uNumFaceExtras ); | |
7052 } | |
7053 pParty->uFlags |= 2u; | |
7054 } | |
7055 else | |
7056 { | |
7057 v15 = 0; | |
7058 if ( (signed int)pOutdoor->uNumBModels > 0 ) | |
7059 { | |
7060 v16 = 0; | |
7061 do | |
7062 { | |
7063 v8 = 0; | |
7064 v9 = (char *)&pOutdoor->pBModels[v16].pVertices; | |
7065 v18 = 0; | |
7066 if ( (signed int)pOutdoor->pBModels[v16].uNumFaces > 0 ) | |
7067 { | |
7068 do | |
7069 { | |
7070 v10 = (ODMFace *)(v8 + *((_DWORD *)v9 + 4)); | |
7071 if ( v10->sCogNumber == v14 ) | |
7072 { | |
7073 if ( BYTE1(v10->uAttributes) & 0x40 ) | |
7074 { | |
7075 *(_WORD *)(*((_DWORD *)v9 + 4) + v8 + 272) = pTextureFrameTable->FindTextureByName( | |
7076 Str2); | |
7077 v11 = (unsigned int *)(*((_DWORD *)v9 + 4) + v8 + 272); | |
7078 if ( *(_WORD *)v11 ) | |
7079 { | |
7080 pTextureFrameTable->LoadAnimationSequenceAndPalettes(*(_WORD *)v11); | |
7081 } | |
7082 else | |
7083 { | |
7084 *(_WORD *)v11 = v12; | |
7085 *(_BYTE *)(*((_DWORD *)v9 + 4) + v8 + 29) &= 0xBFu; | |
7086 } | |
7087 } | |
7088 else | |
7089 { | |
7090 v10->uTextureID = v12; | |
7091 } | |
7092 } | |
7093 ++v18; | |
7094 v8 += 308; | |
7095 } | |
7096 while ( v18 < *((_DWORD *)v9 + 2) ); | |
7097 } | |
7098 ++v15; | |
7099 ++v16; | |
7100 } | |
7101 while ( v15 < (signed int)pOutdoor->uNumBModels ); | |
7102 } | |
7103 } | |
7104 pParty->uFlags |= 2u; | |
7105 } | |
7106 } | |
7107 } | |
7108 | |
7109 //----- (0044882F) -------------------------------------------------------- | |
1515 | 7110 void __fastcall SetDecorationSprite(uint16_t uCog, bool bHide, const char *pFileName) |
0 | 7111 { |
1515 | 7112 for (size_t i = 0; i < uNumLevelDecorations; i++) |
7113 { | |
7114 if (pLevelDecorations[i].uCog == uCog) | |
0 | 7115 { |
1515 | 7116 if (pFileName && strcmp(pFileName, "0")) |
0 | 7117 { |
1515 | 7118 pLevelDecorations[i].uDecorationDescID = pDecorationList->GetDecorIdByName(pFileName); |
7119 pDecorationList->InitializeDecorationSprite(pLevelDecorations[i].uDecorationDescID); | |
0 | 7120 } |
1515 | 7121 |
7122 if (bHide) | |
7123 pLevelDecorations[i].uFlags &= ~LEVEL_DECORATION_INVISIBLE; | |
7124 else | |
7125 pLevelDecorations[i].uFlags |= LEVEL_DECORATION_INVISIBLE; | |
7126 | |
7127 pParty->uFlags |= 2u; | |
0 | 7128 } |
7129 } | |
7130 } | |
7131 | |
7132 //----- (0044892E) -------------------------------------------------------- | |
7133 void __fastcall sub_44892E_set_faces_bit(int sCogNumber, int bit, int on) | |
7134 { | |
7135 signed int v3; // esi@2 | |
7136 signed int v4; // ecx@4 | |
7137 char *v5; // eax@6 | |
7138 int v6; // edi@13 | |
7139 char *v7; // esi@13 | |
7140 signed int v8; // ecx@13 | |
7141 ODMFace *v9; // eax@14 | |
7142 int v10; // [sp+0h] [bp-Ch]@1 | |
7143 signed int v11; // [sp+4h] [bp-8h]@11 | |
7144 int v12; // [sp+8h] [bp-4h]@12 | |
7145 | |
7146 v10 = sCogNumber; | |
7147 if ( sCogNumber ) | |
7148 { | |
7149 v3 = 1; | |
7150 if ( uCurrentlyLoadedLevelType == 1 ) | |
7151 { | |
7152 if ( (signed int)pIndoor->uNumFaceExtras > 1 ) | |
7153 { | |
7154 v4 = 1; | |
7155 do | |
7156 { | |
7157 if ( pIndoor->pFaceExtras[v4].sCogNumber == v10 ) | |
7158 { | |
7159 v5 = (char *)&pIndoor->pFaces[pIndoor->pFaceExtras[v4].field_C].uAttributes; | |
7160 if ( on ) | |
7161 *(_DWORD *)v5 |= bit; | |
7162 else | |
7163 *(_DWORD *)v5 &= ~bit; | |
7164 } | |
7165 ++v3; | |
7166 ++v4; | |
7167 } | |
7168 while ( v3 < (signed int)pIndoor->uNumFaceExtras ); | |
7169 } | |
7170 pParty->uFlags |= 2u; | |
7171 } | |
7172 else | |
7173 { | |
7174 v11 = 0; | |
7175 if ( (signed int)pOutdoor->uNumBModels > 0 ) | |
7176 { | |
7177 v12 = 0; | |
7178 do | |
7179 { | |
7180 v6 = 0; | |
7181 v7 = (char *)&pOutdoor->pBModels[v12].pVertices; | |
7182 v8 = 0; | |
7183 if ( (signed int)pOutdoor->pBModels[v12].uNumFaces > 0 ) | |
7184 { | |
7185 do | |
7186 { | |
7187 v9 = (ODMFace *)(v6 + *((_DWORD *)v7 + 4)); | |
7188 if ( v9->sCogNumber == v10 ) | |
7189 { | |
7190 if ( on ) | |
7191 v9->uAttributes |= bit; | |
7192 else | |
7193 v9->uAttributes &= ~bit; | |
7194 } | |
7195 ++v8; | |
7196 v6 += 308; | |
7197 } | |
7198 while ( v8 < *((_DWORD *)v7 + 2) ); | |
7199 } | |
7200 ++v11; | |
7201 ++v12; | |
7202 } | |
7203 while ( v11 < (signed int)pOutdoor->uNumBModels ); | |
7204 } | |
7205 } | |
7206 pParty->uFlags |= 2u; | |
7207 } | |
7208 } | |
7209 | |
7210 //----- (00448A98) -------------------------------------------------------- | |
7211 void __fastcall ToggleActorGroupFlag(unsigned int uGroupID, unsigned int uFlag, unsigned int bToggle) | |
7212 { | |
7213 unsigned int v3; // ebx@1 | |
7214 unsigned int v4; // ebp@1 | |
7215 signed int v5; // edi@1 | |
82 | 7216 Actor *v6; // esi@4 |
0 | 7217 size_t v7; // ecx@10 |
82 | 7218 Actor *v8; // eax@11 |
0 | 7219 unsigned __int16 v9; // dx@14 |
7220 | |
7221 v4 = uGroupID; | |
7222 v5 = Standing; | |
7223 v3 = uFlag; | |
7224 if ( uGroupID ) | |
7225 { | |
7226 if ( bToggle ) | |
7227 { | |
7228 if ( (signed int)uNumActors > Standing ) | |
7229 { | |
1202 | 7230 v6 = pActors.data();//[0].uAttributes; |
0 | 7231 do |
7232 { | |
82 | 7233 if ( v6->uGroup == v4 ) |
7234 { | |
7235 v6->uAttributes |= v3; | |
0 | 7236 if ( v3 == 0x10000 ) |
7237 { | |
82 | 7238 v6->uAIState = Disabled; |
7239 v6->UpdateAnimation(); | |
0 | 7240 } |
7241 } | |
7242 ++v5; | |
82 | 7243 ++v6; |
0 | 7244 } |
7245 while ( v5 < (signed int)uNumActors ); | |
7246 } | |
7247 } | |
7248 else | |
7249 { | |
7250 v7 = uNumActors; | |
7251 if ( (signed int)uNumActors > Standing ) | |
7252 { | |
1202 | 7253 v8 = pActors.data();//[0].uAIState; |
0 | 7254 do |
7255 { | |
82 | 7256 if ( v8->uGroup == v4 ) |
0 | 7257 { |
7258 if ( v3 == 0x10000 ) | |
7259 { | |
82 | 7260 v9 = v8->uAIState; |
7261 if ( v8->uAIState != Dead ) | |
0 | 7262 { |
7263 if ( v9 != 4 && v9 != 11 ) | |
82 | 7264 v8->uAIState = Standing; |
7265 } | |
7266 } | |
7267 LODWORD(v8->uAttributes) &= ~v3; | |
7268 } | |
7269 ++v8; | |
0 | 7270 --v7; |
7271 } | |
7272 while ( v7 ); | |
7273 } | |
7274 } | |
7275 } | |
7276 } | |
7277 | |
7278 //----- (00448B45) -------------------------------------------------------- | |
1458 | 7279 void GameUI_StatusBar_UpdateTimedString(unsigned int bForceHide) |
0 | 7280 { |
783 | 7281 if ( bForceHide || GameUI_Footer_TimeLeft && GetTickCount() >= GameUI_Footer_TimeLeft ) |
7282 GameUI_Footer_TimeLeft = 0; | |
0 | 7283 } |
7284 | |
7285 //----- (00448B67) -------------------------------------------------------- | |
790 | 7286 void OnTimer(int __unused) |
7287 { | |
789 | 7288 if (pEventTimer->bPaused) |
7289 return; | |
7290 | |
790 | 7291 if (__unused) |
7292 _5773C0_unused = 0; | |
789 | 7293 |
790 | 7294 auto v13 = (signed __int64)(pParty->uTimePlayed - _5773B8_event_timer) / 128; |
789 | 7295 if (!v13) |
7296 return; | |
7297 | |
7298 //uint _v2v3 = pParty->uTimePlayed; | |
7299 //v3 = HIDWORD(pParty->uTimePlayed); | |
7300 //v2 = LODWORD(pParty->uTimePlayed); | |
7301 | |
7302 _5773B8_event_timer = pParty->uTimePlayed; | |
7303 | |
7304 for (uint i = 0; i < dword_5B65C8_timers_count; ++i) | |
7305 { | |
7306 //v4 = (char *)&array_5B5928_timers[0].field_C; | |
7307 auto timer = array_5B5928_timers + i; | |
7308 //while ( 1 ) | |
7309 //{ | |
7310 //v5 = *(short *)v4; | |
7311 if (timer->time_left_to_fire) | |
7312 { | |
7313 if (v13 < timer->time_left_to_fire) | |
7314 timer->time_left_to_fire -= v13; | |
7315 else | |
7316 { | |
7317 timer->time_left_to_fire = timer->fire_interval; | |
1052 | 7318 EventProcessor(timer->timer_evt_ID, 0, 1, timer->timer_evt_seq_num); |
789 | 7319 } |
7320 } | |
7321 else | |
7322 { | |
7323 if (timer->next_fire_time < pParty->uTimePlayed) | |
7324 { | |
7325 uint next_trigger_time = 1 * 60 * 60 * 24; // 1 day | |
7326 if (timer->field_10) | |
7327 next_trigger_time = 336 * 60 * 60 * 24; // 1 year | |
7328 else if (timer->field_12) | |
7329 next_trigger_time = 28 * 60 * 60 * 24; // 1 month | |
7330 else if (timer->field_14) | |
7331 next_trigger_time = 7 * 60 * 60 * 24; // 1 week | |
7332 | |
7333 timer->next_fire_time += (next_trigger_time * 128) / 3.0f; | |
1052 | 7334 if (timer->next_fire_time < pParty->uTimePlayed) // make sure in wont fire several times in a row if big time interval has lapsed |
789 | 7335 timer->next_fire_time = pParty->uTimePlayed; |
7336 | |
1052 | 7337 EventProcessor(timer->timer_evt_ID, 0, 1, timer->timer_evt_seq_num); |
0 | 7338 } |
7339 } | |
7340 } | |
7341 } | |
7342 | |
7343 //----- (00481D77) -------------------------------------------------------- | |
7344 void _outdoor_project(RenderVertexSoft *v) | |
7345 { | |
7346 double v1; // st7@1 | |
7347 double v2; // st7@1 | |
7348 | |
7349 v1 = 1.0 / (v->vWorldViewPosition.x + 0.0000001); | |
168 | 7350 v->_rhw = v1; |
0 | 7351 v2 = v1 * (double)pOutdoorCamera->int_fov_rad; |
7352 v->vWorldViewProjX = (double)pViewport->uScreenCenterX - v2 * v->vWorldViewPosition.y; | |
7353 v->vWorldViewProjY = (double)pViewport->uScreenCenterY - v2 * v->vWorldViewPosition.z; | |
7354 } | |
7355 | |
7356 //----- (00448CF4) -------------------------------------------------------- | |
7357 void __fastcall sub_448CF4_spawn_monsters(__int16 typeindex, __int16 level, int count, int x, int y, int z, int group, unsigned int uUniqueName) | |
7358 { | |
7359 __int16 v8; // di@1 | |
7360 __int16 v9; // si@1 | |
7361 unsigned int v10; // eax@1 | |
7362 size_t v11; // ebx@2 | |
7363 signed int v12; // esi@2 | |
35 | 7364 Actor *pActor;//Actor_uYawAngle_cr *v13; // ebx@3 |
0 | 7365 AIDirection a3; // [sp+Ch] [bp-50h]@2 |
7366 AIDirection v15; // [sp+28h] [bp-34h]@2 | |
7367 //SpawnPointMM7 v16; // [sp+44h] [bp-18h]@1 | |
7368 | |
7369 v8 = typeindex; | |
7370 v9 = level; | |
7371 | |
7372 SpawnPointMM7 v16; // [sp+44h] [bp-18h]@1 | |
7373 //SpawnPointMM7::SpawnPointMM7(&v16); | |
7374 | |
7375 v16.vPosition.x = x; | |
7376 v16.vPosition.y = y; | |
7377 v16.vPosition.z = z; | |
7378 v16.uGroup = group; | |
7379 v16.uRadius = 32; | |
7380 v16.uKind = 3; | |
7381 v16.uIndex = v8 + 2 * v9 + v9; | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1470
diff
changeset
|
7382 v10 = pMapStats->GetMapInfo(pCurrentMapName); |
0 | 7383 if ( v10 ) |
7384 { | |
7385 v11 = uNumActors; | |
1546 | 7386 SpawnEncounter(&pMapStats->pInfos[v10], &v16, 0, count, 0); |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7387 memcpy(&v15, Actor::GetDirectionInfo(PID(OBJECT_Actor, v11), 4u, &a3, 1), sizeof(v15)); |
0 | 7388 v12 = v11; |
7389 if ( (signed int)v11 < (signed int)uNumActors ) | |
7390 { | |
35 | 7391 for ( pActor = &pActors[v11]; v12 < (signed int)uNumActors; ++pActor ) |
7392 { | |
7393 pActor->PrepareSprites(0); | |
0 | 7394 ++v12; |
35 | 7395 pActor->uYawAngle = v15.uYawAngle; |
7396 pActor->dword_000334_unique_name = uUniqueName; | |
7397 } | |
0 | 7398 } |
7399 } | |
7400 } | |
7401 | |
7402 | |
7403 //----- (0044987B) -------------------------------------------------------- | |
783 | 7404 void sub_44987B(const char *pMapName, MapStartPoint start_point) |
0 | 7405 { |
7406 const char *v2; // edi@1 | |
7407 | |
7408 v2 = pMapName; | |
7409 pAudioPlayer->StopChannels(-1, -1); | |
434 | 7410 pGameLoadingUI_ProgressBar->Initialize(GUIProgressBar::TYPE_None); |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1470
diff
changeset
|
7411 if ( _stricmp(pCurrentMapName, v2) ) |
0 | 7412 SaveGame(1, 0); |
783 | 7413 |
978 | 7414 uGameState = GAME_STATE_2; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1470
diff
changeset
|
7415 strcpy(pCurrentMapName, v2); |
783 | 7416 uLevel_StartingPointType = start_point; |
0 | 7417 } |
7418 // 6BE35C: using guessed type int uLevel_StartingPointType; | |
7419 | |
7420 //----- (004498D5) -------------------------------------------------------- | |
783 | 7421 void TeleportToStartingPoint(MapStartPoint point) |
7422 { | |
7423 //unsigned int v1; // ecx@2 | |
7424 //int v2; // ecx@3 | |
7425 //int v3; // ecx@4 | |
0 | 7426 unsigned __int16 v4; // ax@11 |
7427 signed int v5; // ecx@12 | |
7428 LevelDecoration *v6; // edx@13 | |
7429 signed int v7; // ecx@17 | |
7430 int v8; // eax@17 | |
7431 int v9; // ecx@17 | |
7432 const char *v10; // [sp-4h] [bp-84h]@6 | |
7433 char pName[128]; // [sp+8h] [bp-78h]@11 | |
7434 | |
783 | 7435 switch (point) |
7436 { | |
7437 case MapStartPoint_Party: v10 = "Party Start"; break; | |
7438 case MapStartPoint_North: v10 = "North Start"; break; | |
7439 case MapStartPoint_South: v10 = "South Start"; break; | |
7440 case MapStartPoint_East: v10 = "East Start"; break; | |
7441 case MapStartPoint_West: v10 = "West Start"; break; | |
1546 | 7442 default: |
7443 Error("Invalid enum value: %u", point); | |
783 | 7444 } |
7445 | |
0 | 7446 strcpy(pName, v10); |
7447 v4 = pDecorationList->GetDecorIdByName(pName); | |
7448 if ( v4 ) | |
7449 { | |
7450 v5 = 0; | |
7451 if ( (signed int)uNumLevelDecorations > 0 ) | |
7452 { | |
1202 | 7453 v6 = pLevelDecorations.data(); |
0 | 7454 while ( v6->uDecorationDescID != (signed __int16)v4 ) |
7455 { | |
7456 ++v5; | |
7457 ++v6; | |
7458 if ( v5 >= (signed int)uNumLevelDecorations ) | |
7459 goto LABEL_20; | |
7460 } | |
7461 v7 = v5; | |
7462 pParty->vPosition.x = pLevelDecorations[v7].vPosition.x; | |
7463 pParty->vPosition.y = pLevelDecorations[v7].vPosition.y; | |
7464 pParty->vPosition.z = pLevelDecorations[v7].vPosition.z; | |
7465 pParty->uFallStartY = pParty->vPosition.z; | |
7466 v8 = (signed int)(stru_5C6E00->uIntegerHalfPi * pLevelDecorations[v7].field_1A) / 90; | |
7467 v9 = pLevelDecorations[v7].field_10_y_rot; | |
7468 pParty->sRotationY = v8; | |
7469 if ( v9 ) | |
7470 pParty->sRotationY = v9; | |
7471 pParty->sRotationX = 0; | |
7472 pParty->uFallSpeed = 0; | |
7473 } | |
7474 LABEL_20: | |
7475 if ( dword_5B65C0 ) | |
7476 { | |
7477 if ( _5B65A8_npcdata_uflags_or_other ) | |
7478 pParty->vPosition.x = _5B65A8_npcdata_uflags_or_other; | |
7479 if ( _5B65AC_npcdata_fame_or_other ) | |
7480 pParty->vPosition.y = _5B65AC_npcdata_fame_or_other; | |
7481 if ( _5B65B0_npcdata_rep_or_other ) | |
7482 { | |
7483 pParty->vPosition.z = _5B65B0_npcdata_rep_or_other; | |
7484 pParty->uFallStartY = _5B65B0_npcdata_rep_or_other; | |
7485 } | |
1516
f3cd08b89476
Fix assertion error when exiting Harmondale's castle. Possibly original bug.
yoctozepto
parents:
1515
diff
changeset
|
7486 if ( _5B65B4_npcdata_loword_house_or_other != -1 ) |
0 | 7487 pParty->sRotationY = _5B65B4_npcdata_loword_house_or_other; |
7488 if ( _5B65B8_npcdata_hiword_house_or_other ) | |
7489 pParty->sRotationX = _5B65B8_npcdata_hiword_house_or_other; | |
7490 if ( dword_5B65BC ) | |
7491 pParty->uFallSpeed = dword_5B65BC; | |
7492 } | |
7493 _5B65B4_npcdata_loword_house_or_other = -1; | |
7494 dword_5B65C0 = 0; | |
7495 dword_5B65BC = 0; | |
7496 _5B65B8_npcdata_hiword_house_or_other = 0; | |
7497 _5B65B0_npcdata_rep_or_other = 0; | |
7498 _5B65AC_npcdata_fame_or_other = 0; | |
7499 _5B65A8_npcdata_uflags_or_other = 0; | |
7500 } | |
7501 } | |
1035 | 7502 |
7503 | |
0 | 7504 |
7505 //----- (00449A49) -------------------------------------------------------- | |
7506 __int16 __fastcall sub_449A49_door_switch_animation(unsigned int uDoorID, int a2) | |
7507 { | |
7508 int v2; // eax@1 | |
7509 int v3; // ebx@1 | |
7510 signed int v4; // esi@2 | |
7511 int v5; // edx@2 | |
7512 BLVDoor *v6; // ecx@8 | |
7513 unsigned int v7; // edx@18 | |
7514 signed int v8; // esi@19 | |
7515 int v9; // eax@19 | |
1545 | 7516 //char Args; // [sp+Ch] [bp-78h]@6 |
0 | 7517 |
7518 LOWORD(v2) = LOWORD(pIndoor->pDoors); | |
7519 v3 = a2; | |
7520 if ( !pIndoor->pDoors ) | |
7521 return v2; | |
7522 v4 = 0; | |
7523 v5 = (int)&pIndoor->pDoors->uDoorID; | |
7524 do | |
7525 { | |
7526 if ( *(int *)v5 == uDoorID ) | |
7527 break; | |
7528 ++v4; | |
7529 v5 += 80; | |
7530 } | |
7531 while ( v4 < 200 ); | |
7532 if ( v4 >= 200 ) | |
7533 { | |
1545 | 7534 Error("Unable to find Door ID: %i!", uDoorID); |
0 | 7535 } |
7536 v6 = &pIndoor->pDoors[v4]; | |
7537 if ( v3 == 2 ) | |
7538 { | |
7539 LOWORD(v2) = v6->uState; | |
7540 if ( (short)v2 == 3 || (short)v2 == 1 ) | |
7541 return v2; | |
7542 if ( (short)v2 ) | |
7543 goto LABEL_14; | |
7544 } | |
7545 else | |
7546 { | |
7547 if ( !v3 ) | |
7548 { | |
7549 LABEL_14: | |
7550 LOWORD(v2) = v6->uState; | |
7551 if ( (short)v2 && (short)v2 != 3 ) | |
7552 { | |
7553 v6->uState = BLVDoor::Closing; | |
7554 if ( (short)v2 == 2 ) | |
7555 { | |
7556 LABEL_17: | |
7557 v6->uTimeSinceTriggered = 0; | |
7558 return v2; | |
7559 } | |
7560 v7 = v6->uTimeSinceTriggered; | |
7561 v2 = 15360; | |
7562 if ( v7 != 15360 ) | |
7563 { | |
7564 v8 = v6->uOpenSpeed; | |
7565 v9 = v6->uCloseSpeed; | |
7566 LABEL_26: | |
7567 v2 = (v6->uMoveLength << 7) / v8 - ((signed int)(v7 * v9) / 128 << 7) / v8; | |
7568 goto LABEL_27; | |
7569 } | |
7570 goto LABEL_27; | |
7571 } | |
7572 return v2; | |
7573 } | |
7574 if ( v3 != 1 ) | |
7575 return v2; | |
7576 } | |
7577 LOWORD(v2) = v6->uState; | |
7578 if ( (short)v2 != 2 && (short)v2 != 1 ) | |
7579 { | |
7580 v6->uState = BLVDoor::Opening; | |
7581 if ( !(short)v2 ) | |
7582 goto LABEL_17; | |
7583 v7 = v6->uTimeSinceTriggered; | |
7584 v2 = 15360; | |
7585 if ( v7 != 15360 ) | |
7586 { | |
7587 v8 = v6->uCloseSpeed; | |
7588 v9 = v6->uOpenSpeed; | |
7589 goto LABEL_26; | |
7590 } | |
7591 LABEL_27: | |
7592 v6->uTimeSinceTriggered = v2; | |
7593 } | |
7594 return v2; | |
7595 } | |
7596 | |
7597 //----- (00449B57) -------------------------------------------------------- | |
521 | 7598 bool _449B57_test_bit( unsigned __int8 *a1, __int16 a2 ) |
1035 | 7599 { |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1112
diff
changeset
|
7600 return (a1[(a2 - 1) >> 3] & (0x80u >> (a2 - 1) % 8)) != 0; |
0 | 7601 } |
7602 | |
7603 //----- (00449B7E) -------------------------------------------------------- | |
501 | 7604 void _449B7E_toggle_bit(unsigned char *pArray, __int16 a2, unsigned __int16 bToggle) |
0 | 7605 { |
7606 signed int v3; // esi@1 | |
501 | 7607 unsigned char set_bit; // edx@1 |
0 | 7608 |
7609 v3 = a2 - 1; | |
501 | 7610 set_bit = 0x80 >> v3 % 8; |
0 | 7611 if ( bToggle ) |
501 | 7612 pArray[v3 / 8] |= set_bit; |
7613 else | |
7614 pArray[v3 / 8] &= ~set_bit; | |
0 | 7615 } |
7616 | |
7617 //----- (0044C175) -------------------------------------------------------- | |
1160 | 7618 void ShowStatusBarString( const char *pString, unsigned int uNumSeconds ) |
1546 | 7619 { |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
7620 strcpy(GameUI_Footer_TimedString.data(), pString); |
1546 | 7621 GameUI_Footer_TimeLeft = 1000 * uNumSeconds + GetTickCount(); |
7622 | |
7623 for (int i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()); | |
0 | 7624 i > 450; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
7625 i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()) ) |
1470 | 7626 GameUI_Footer_TimedString[strlen(GameUI_Footer_TimedString.data()) - 1] = 0; |
0 | 7627 } |
7628 | |
7629 //----- (0044C1D0) -------------------------------------------------------- | |
1035 | 7630 void ShowNothingHereStatus() |
0 | 7631 { |
783 | 7632 if ( !GameUI_Footer_TimeLeft ) |
1546 | 7633 ShowStatusBarString(pGlobalTXT_LocalizationStrings[521], 2);// Nothing here |
0 | 7634 } |
7635 | |
7636 //----- (0044C28B) -------------------------------------------------------- | |
1459 | 7637 int const_2() |
0 | 7638 { |
7639 return 2; | |
7640 } | |
7641 | |
7642 //----- (0044C28F) -------------------------------------------------------- | |
1459 | 7643 bool TeleportToNWCDungeon() |
0 | 7644 { |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1470
diff
changeset
|
7645 if (!_stricmp("nwc.blv", pCurrentMapName)) |
1459 | 7646 return false; |
7647 | |
7648 _5B65A8_npcdata_uflags_or_other = 0; | |
7649 _5B65AC_npcdata_fame_or_other = 0; | |
7650 _5B65B0_npcdata_rep_or_other = 0; | |
7651 _5B65B4_npcdata_loword_house_or_other = 0; | |
7652 _5B65B8_npcdata_hiword_house_or_other = 0; | |
7653 dword_5B65BC = 0; | |
7654 dword_5B65C0 = 0; | |
7655 | |
7656 pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen; | |
7657 sub_44987B("nwc.blv", MapStartPoint_Party); | |
7658 pCurrentScreen = SCREEN_GAME; | |
7659 return true; | |
0 | 7660 } |
7661 | |
7662 //----- (00401000) -------------------------------------------------------- | |
1458 | 7663 void mm7__vector_constructor(void *a1, int objSize, int numObjs, int ( *constructor)(int)) |
0 | 7664 { |
7665 void *v4; // esi@2 | |
7666 int v5; // edi@2 | |
7667 | |
7668 if ( numObjs - 1 >= 0 ) | |
7669 { | |
7670 v4 = a1; | |
7671 v5 = numObjs; | |
7672 do | |
7673 { | |
7674 constructor((int)v4); | |
7675 v4 = (char *)v4 + objSize; | |
7676 --v5; | |
7677 } | |
7678 while ( v5 ); | |
7679 } | |
7680 } | |
7681 | |
7682 //----- (0040261D) -------------------------------------------------------- | |
1546 | 7683 void stru298::Add(__int16 uID, __int16 a3, __int16 x, __int16 y, __int16 z, char a7, char a8) |
0 | 7684 { |
1546 | 7685 if (count < 100) |
7686 { | |
7687 pIDs[count] = uID; | |
7688 pXs[count] = x; | |
7689 pYs[count] = y; | |
7690 pZs[count] = z; | |
7691 field_324[count] = a3; | |
7692 field_3EC[count] = a8; | |
7693 field_450[count++] = a7; | |
7694 } | |
0 | 7695 } |
7696 | |
7697 //----- (00402CAE) -------------------------------------------------------- | |
323 | 7698 int stru193_math::Cos(int angle) |
0 | 7699 { |
7700 int v2; // eax@1 | |
7701 | |
7702 //a2: (angle - uIntegerHalfPi) for sin(angle) | |
7703 // (angle) for cos(angle) | |
7704 | |
7705 v2 = uDoublePiMask & angle; | |
7706 | |
7707 if ( v2 > uIntegerPi ) | |
7708 v2 = uIntegerDoublePi - v2; | |
7709 if ( v2 >= uIntegerHalfPi ) | |
7710 return -pCosTable[uIntegerPi - v2]; | |
7711 else | |
7712 return pCosTable[v2]; | |
7713 } | |
7714 |