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