Mercurial > mm7
annotate mm7_3.cpp @ 1397:eb02a65e5c82
Quick Spell fixed.
Removed CShow, ThreadWard structures.
author | Nomad |
---|---|
date | Fri, 19 Jul 2013 09:42:03 +0200 |
parents | 8d4ec56416ef |
children | 3161094869e0 |
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 |
119 | 5 #include <assert.h> |
6 | |
1323 | 7 #include "Weather.h" |
1262 | 8 #include "Texture.h" |
9 #include "mm7_data.h" | |
1016 | 10 #include "Sprites.h" |
11 #include "BSPModel.h" | |
12 #include "OutdoorCamera.h" | |
13 #include "LightmapBuilder.h" | |
14 #include "DecalBuilder.h" | |
15 #include "ParticleEngine.h" | |
16 #include "Mouse.h" | |
17 #include "Keyboard.h" | |
18 #include "stru6.h" | |
1263 | 19 #include "FactionTable.h" |
0 | 20 #include "MapInfo.h" |
21 #include "Game.h" | |
22 #include "GUIWindow.h" | |
23 #include "GUIFont.h" | |
24 #include "GUIProgressBar.h" | |
25 #include "Party.h" | |
26 #include "AudioPlayer.h" | |
27 #include "Outdoor.h" | |
1277 | 28 #include "Outdoor_stuff.h" |
0 | 29 #include "IndoorCamera.h" |
30 #include "Overlays.h" | |
31 #include "LOD.h" | |
32 #include "Actor.h" | |
33 #include "Allocator.h" | |
34 #include "Events.h" | |
35 #include "Viewport.h" | |
36 #include "Math.h" | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
37 #include "SpriteObject.h" |
0 | 38 #include "ObjectList.h" |
39 #include "PaletteManager.h" | |
40 #include "DecorationList.h" | |
41 #include "stru123.h" | |
42 #include "Time.h" | |
43 #include "IconFrameTable.h" | |
44 #include "TurnEngine.h" | |
45 #include "stru220.h" | |
46 #include "Events2D.h" | |
47 #include "stru176.h" | |
48 #include "stru298.h" | |
189 | 49 #include "texts.h" |
0 | 50 #include "Log.h" |
1262 | 51 #include "Lights.h" |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
52 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
53 #include "MM7.h" |
0 | 54 |
55 //----- (0046E44E) -------------------------------------------------------- | |
56 int __thiscall _46E44E_collide_against_faces_and_portals(unsigned int b1) | |
57 { | |
717 | 58 BLVSector *pSector; // edi@1 |
0 | 59 signed int v2; // ebx@1 |
717 | 60 BLVFace *pFace; // esi@2 |
61 __int16 pNextSector; // si@10 | |
62 int pArrayNum; // ecx@12 | |
0 | 63 unsigned __int8 v6; // sf@12 |
64 unsigned __int8 v7; // of@12 | |
65 int result; // eax@14 | |
717 | 66 //BLVSector *v9; // ebx@15 |
0 | 67 int v10; // ecx@15 |
717 | 68 int pFloor; // eax@16 |
69 //BLVFace *v12; // ebp@16 | |
0 | 70 int v13; // eax@24 |
71 int v14; // esi@24 | |
72 int v15; // eax@24 | |
73 int v16; // edx@25 | |
74 int v17; // eax@29 | |
75 unsigned int v18; // eax@33 | |
76 int v19; // eax@35 | |
77 int v20; // edx@35 | |
78 int v21; // eax@35 | |
79 int v22; // ecx@36 | |
80 int v23; // eax@40 | |
81 unsigned int v24; // eax@44 | |
82 int a3; // [sp+10h] [bp-48h]@28 | |
83 int v26; // [sp+14h] [bp-44h]@15 | |
84 int i; // [sp+18h] [bp-40h]@1 | |
85 int a10; // [sp+1Ch] [bp-3Ch]@1 | |
86 int v29; // [sp+20h] [bp-38h]@14 | |
87 int v30; // [sp+24h] [bp-34h]@35 | |
88 int v31; // [sp+28h] [bp-30h]@24 | |
89 int v32; // [sp+2Ch] [bp-2Ch]@15 | |
717 | 90 int pSectorsArray[10]; // [sp+30h] [bp-28h]@1 |
91 | |
92 pSector = &pIndoor->pSectors[stru_721530.uSectorID]; | |
0 | 93 v2 = 0; |
94 a10 = b1; | |
717 | 95 pSectorsArray[0] = stru_721530.uSectorID; |
96 for ( i = 1; v2 < pSector->uNumPortals; ++v2 ) | |
97 { | |
98 pFace = &pIndoor->pFaces[pSector->pPortals[v2]]; | |
99 if ( stru_721530.sMaxX <= pFace->pBounding.x2 | |
100 && stru_721530.sMinX >= pFace->pBounding.x1 | |
101 && stru_721530.sMaxY <= pFace->pBounding.y2 | |
102 && stru_721530.sMinY >= pFace->pBounding.y1 | |
103 && stru_721530.sMaxZ <= pFace->pBounding.z2 | |
104 && stru_721530.sMinZ >= pFace->pBounding.z1 | |
105 && abs((pFace->pFacePlane_old.dist | |
106 + stru_721530.normal.x * pFace->pFacePlane_old.vNormal.x | |
107 + stru_721530.normal.y * pFace->pFacePlane_old.vNormal.y | |
108 + stru_721530.normal.z * pFace->pFacePlane_old.vNormal.z) >> 16) <= stru_721530.field_6C + 16 ) | |
109 { | |
110 pNextSector = pFace->uSectorID == stru_721530.uSectorID ? pFace->uBackSectorID : pFace->uSectorID;//FrontSectorID | |
111 pArrayNum = i++; | |
112 v7 = i < 10; | |
0 | 113 v6 = i - 10 < 0; |
717 | 114 pSectorsArray[pArrayNum] = pNextSector; |
0 | 115 if ( !(v6 ^ v7) ) |
116 break; | |
117 } | |
118 } | |
119 result = 0; | |
120 v29 = 0; | |
121 if ( i > 0 ) | |
122 { | |
123 while ( 1 ) | |
124 { | |
717 | 125 pSector = &pIndoor->pSectors[pSectorsArray[result]]; |
0 | 126 v10 = 0; |
717 | 127 v32 = pSector->uNumFloors + pSector->uNumWalls + pSector->uNumCeilings; |
0 | 128 v26 = 0; |
129 if ( v32 > 0 ) | |
130 break; | |
131 LABEL_46: | |
132 result = v29++ + 1; | |
133 if ( v29 >= i ) | |
134 return result; | |
135 } | |
136 while ( 1 ) | |
137 { | |
717 | 138 pFloor = pSector->pFloors[v10]; |
139 pFace = &pIndoor->pFaces[pFloor]; | |
140 if ( pFace->Portal() | |
141 || stru_721530.sMaxX > pFace->pBounding.x2 | |
142 || stru_721530.sMinX < pFace->pBounding.x1 | |
143 || stru_721530.sMaxY > pFace->pBounding.y2 | |
144 || stru_721530.sMinY < pFace->pBounding.y1 | |
145 || stru_721530.sMaxZ > pFace->pBounding.z2 | |
146 || stru_721530.sMinZ < pFace->pBounding.z1 | |
147 || pFloor == stru_721530.field_84 ) | |
0 | 148 goto LABEL_45; |
717 | 149 v13 = pFace->pFacePlane_old.vNormal.y; |
150 v14 = pFace->pFacePlane_old.dist; | |
0 | 151 v31 = v13; |
717 | 152 v15 = (stru_721530.normal.x * pFace->pFacePlane_old.vNormal.x + v14 + stru_721530.normal.y * v13 |
153 + stru_721530.normal.z * pFace->pFacePlane_old.vNormal.z) >> 16; | |
0 | 154 if ( v15 > 0 ) |
155 { | |
717 | 156 v16 = (stru_721530.normal2.y * v31 + pFace->pFacePlane_old.dist + stru_721530.normal2.z * pFace->pFacePlane_old.vNormal.z |
157 + stru_721530.normal2.x * pFace->pFacePlane_old.vNormal.x) >> 16; | |
0 | 158 if ( v15 <= stru_721530.prolly_normal_d || v16 <= stru_721530.prolly_normal_d ) |
159 { | |
160 if ( v16 <= v15 ) | |
161 { | |
162 a3 = stru_721530.field_6C; | |
717 | 163 if ( sub_47531C(stru_721530.prolly_normal_d, &a3, stru_721530.normal.x, stru_721530.normal.y, stru_721530.normal.z, |
164 stru_721530.field_58.x, stru_721530.field_58.y, stru_721530.field_58.z, pFace, a10) ) | |
0 | 165 { |
166 v17 = a3; | |
167 } | |
168 else | |
169 { | |
170 a3 = stru_721530.field_6C + stru_721530.prolly_normal_d; | |
717 | 171 if ( !sub_475D85(&stru_721530.normal, &stru_721530.field_58, &a3, pFace) ) |
0 | 172 goto LABEL_34; |
173 v17 = a3 - stru_721530.prolly_normal_d; | |
174 a3 -= stru_721530.prolly_normal_d; | |
175 } | |
176 if ( v17 < stru_721530.field_7C ) | |
177 { | |
178 stru_721530.field_7C = v17; | |
717 | 179 v18 = 8 * pSector->pFloors[v26]; |
0 | 180 LOBYTE(v18) = v18 | 6; |
181 stru_721530.uFaceID = v18; | |
182 } | |
183 } | |
184 } | |
185 } | |
186 LABEL_34: | |
187 if ( !(stru_721530.field_0 & 1) | |
717 | 188 || (v19 = pFace->pFacePlane_old.vNormal.x, |
189 v20 = pFace->pFacePlane_old.vNormal.y, | |
0 | 190 v30 = v19, |
717 | 191 v21 = (stru_721530.field_34.x * v19 + pFace->pFacePlane_old.dist + stru_721530.field_34.y * v20 |
192 + stru_721530.field_34.z * pFace->pFacePlane_old.vNormal.z) >> 16, | |
0 | 193 v21 <= 0) |
717 | 194 || (v22 = (stru_721530.field_4C * v30 + pFace->pFacePlane_old.dist + stru_721530.field_50 * v20 |
195 + stru_721530.field_54 * pFace->pFacePlane_old.vNormal.z) >> 16, | |
0 | 196 v21 > stru_721530.prolly_normal_d) |
197 && v22 > stru_721530.prolly_normal_d | |
198 || v22 > v21 ) | |
199 goto LABEL_45; | |
200 a3 = stru_721530.field_6C; | |
717 | 201 if ( sub_47531C(stru_721530.field_8, &a3, stru_721530.field_34.x, stru_721530.field_34.y, stru_721530.field_34.z, |
202 stru_721530.field_58.x, stru_721530.field_58.y, stru_721530.field_58.z, pFace, a10) ) | |
0 | 203 { |
204 v23 = a3; | |
205 goto LABEL_43; | |
206 } | |
207 a3 = stru_721530.field_6C + stru_721530.field_8; | |
717 | 208 if ( sub_475D85(&stru_721530.field_34, &stru_721530.field_58, &a3, pFace) ) |
0 | 209 { |
210 v23 = a3 - stru_721530.prolly_normal_d; | |
211 a3 -= stru_721530.prolly_normal_d; | |
212 LABEL_43: | |
213 if ( v23 < stru_721530.field_7C ) | |
214 { | |
215 stru_721530.field_7C = v23; | |
717 | 216 v24 = 8 * pSector->pFloors[v26]; |
0 | 217 LOBYTE(v24) = v24 | 6; |
218 stru_721530.uFaceID = v24; | |
219 } | |
220 } | |
221 LABEL_45: | |
222 v10 = v26++ + 1; | |
223 if ( v26 >= v32 ) | |
224 goto LABEL_46; | |
225 } | |
226 } | |
227 return result; | |
228 } | |
229 // 46E44E: using guessed type int var_28[10]; | |
230 | |
231 //----- (0046E889) -------------------------------------------------------- | |
232 int __fastcall _46E889_collide_against_bmodels(unsigned int ecx0) | |
233 { | |
234 int result; // eax@1 | |
235 BSPModel *v2; // ecx@3 | |
236 int v3; // ebx@9 | |
237 ODMFace *v4; // eax@11 | |
238 int v5; // edi@17 | |
239 int v6; // esi@17 | |
240 unsigned int v7; // ecx@17 | |
241 int v8; // eax@19 | |
242 int v9; // ecx@20 | |
243 int v10; // eax@24 | |
244 int v11; // ST18_4@25 | |
245 int v12; // ST1C_4@25 | |
246 int v13; // ST0C_4@25 | |
247 unsigned int v14; // eax@28 | |
248 int v15; // eax@30 | |
249 int v16; // ecx@31 | |
250 unsigned int v17; // eax@36 | |
251 int v18; // ST18_4@41 | |
252 int v19; // ST1C_4@41 | |
253 int v20; // ST0C_4@41 | |
254 int v21; // eax@42 | |
255 unsigned int v22; // eax@43 | |
256 //BLVFace f; // [sp+Ch] [bp-7Ch]@1 | |
257 int v24; // [sp+6Ch] [bp-1Ch]@9 | |
258 int a11; // [sp+70h] [bp-18h]@1 | |
259 unsigned int v26; // [sp+74h] [bp-14h]@2 | |
260 unsigned int v27; // [sp+78h] [bp-10h]@10 | |
261 BSPModel *v28; // [sp+7Ch] [bp-Ch]@3 | |
262 int a10; // [sp+80h] [bp-8h]@1 | |
263 int a2; // [sp+84h] [bp-4h]@23 | |
264 | |
265 a11 = ecx0; | |
266 | |
267 BLVFace f; // [sp+Ch] [bp-7Ch]@1 | |
268 //BLVFace::BLVFace(&f); | |
269 | |
270 result = 0; | |
271 a10 = 0; | |
272 if ( (signed int)pOutdoor->uNumBModels > 0 ) | |
273 { | |
274 v26 = 0; | |
275 while ( 1 ) | |
276 { | |
277 v2 = &pOutdoor->pBModels[v26 / 0xBC]; | |
278 v28 = &pOutdoor->pBModels[v26 / 0xBC]; | |
279 if ( stru_721530.sMaxX <= pOutdoor->pBModels[v26 / 0xBC].sMaxX ) | |
280 { | |
281 if ( stru_721530.sMinX >= v2->sMinX ) | |
282 { | |
283 if ( stru_721530.sMaxY <= v2->sMaxY ) | |
284 { | |
285 if ( stru_721530.sMinY >= v2->sMinY ) | |
286 { | |
287 if ( stru_721530.sMaxZ <= v2->sMaxZ ) | |
288 { | |
289 if ( stru_721530.sMinZ >= v2->sMinZ ) | |
290 { | |
291 v3 = 0; | |
292 v24 = v2->uNumFaces; | |
293 if ( v24 > 0 ) | |
294 break; | |
295 } | |
296 } | |
297 } | |
298 } | |
299 } | |
300 } | |
301 LABEL_39: | |
302 ++a10; | |
303 v26 += 188; | |
304 result = a10; | |
305 if ( a10 >= (signed int)pOutdoor->uNumBModels ) | |
306 return result; | |
307 } | |
308 v27 = 0; | |
309 while ( 1 ) | |
310 { | |
311 v4 = &v2->pFaces[v27 / 0x134]; | |
312 if ( stru_721530.sMaxX > v4->pBoundingBox.x2 | |
313 || stru_721530.sMinX < v4->pBoundingBox.x1 | |
314 || stru_721530.sMaxY > v4->pBoundingBox.y2 | |
315 || stru_721530.sMinY < v4->pBoundingBox.y1 | |
316 || stru_721530.sMaxZ > v4->pBoundingBox.z2 | |
317 || stru_721530.sMinZ < v4->pBoundingBox.z1 ) | |
318 goto LABEL_38; | |
319 f.pFacePlane_old.vNormal.x = v4->pFacePlane.vNormal.x; | |
320 f.pFacePlane_old.vNormal.y = v4->pFacePlane.vNormal.y; | |
321 v5 = v4->pFacePlane.vNormal.z; | |
322 f.pFacePlane_old.vNormal.z = v4->pFacePlane.vNormal.z; | |
323 v6 = v4->pFacePlane.dist; | |
324 f.pFacePlane_old.dist = v4->pFacePlane.dist; | |
325 v7 = v4->uAttributes; | |
326 f.uAttributes = v7; | |
327 f.pBounding.x1 = v4->pBoundingBox.x1; | |
328 f.pBounding.y1 = v4->pBoundingBox.y1; | |
329 f.pBounding.z1 = v4->pBoundingBox.z1; | |
330 f.pBounding.x2 = v4->pBoundingBox.x2; | |
331 f.pBounding.y2 = v4->pBoundingBox.y2; | |
332 f.pBounding.z2 = v4->pBoundingBox.z2; | |
333 f.zCalc1 = v4->zCalc1; | |
334 f.zCalc2 = v4->zCalc2; | |
335 f.zCalc3 = v4->zCalc3; | |
336 f.pXInterceptDisplacements = v4->pXInterceptDisplacements; | |
337 f.pYInterceptDisplacements = v4->pYInterceptDisplacements; | |
338 f.pZInterceptDisplacements = v4->pZInterceptDisplacements; | |
339 f.uPolygonType = (PolygonType)v4->uPolygonType; | |
340 f.uNumVertices = v4->uNumVertices; | |
341 f.uBitmapID = v4->uTextureID; | |
342 f.pVertexIDs = v4->pVertexIDs; | |
343 if ( !(v7 & 0x20000000) ) | |
344 { | |
345 if ( !(v7 & 1) ) | |
346 break; | |
347 } | |
348 LABEL_37: | |
349 v2 = v28; | |
350 LABEL_38: | |
351 v27 += 308; | |
352 ++v3; | |
353 if ( v3 >= v24 ) | |
354 goto LABEL_39; | |
355 } | |
356 v8 = (v5 * stru_721530.normal.z | |
357 + v6 | |
358 + f.pFacePlane_old.vNormal.y * stru_721530.normal.y | |
359 + f.pFacePlane_old.vNormal.x * stru_721530.normal.x) >> 16; | |
360 if ( v8 > 0 ) | |
361 { | |
362 v9 = (v5 * stru_721530.normal2.z | |
363 + v6 | |
364 + f.pFacePlane_old.vNormal.y * stru_721530.normal2.y | |
365 + f.pFacePlane_old.vNormal.x * stru_721530.normal2.x) >> 16; | |
366 if ( v8 <= stru_721530.prolly_normal_d || v9 <= stru_721530.prolly_normal_d ) | |
367 { | |
368 if ( v9 <= v8 ) | |
369 { | |
370 a2 = stru_721530.field_6C; | |
371 if ( sub_4754BF( | |
372 stru_721530.prolly_normal_d, | |
373 &a2, | |
374 stru_721530.normal.x, | |
375 stru_721530.normal.y, | |
376 stru_721530.normal.z, | |
377 stru_721530.field_58.x, | |
378 stru_721530.field_58.y, | |
379 stru_721530.field_58.z, | |
380 &f, | |
381 a10, | |
382 a11) ) | |
383 { | |
384 v10 = a2; | |
385 } | |
386 else | |
387 { | |
388 v11 = stru_721530.field_58.y; | |
389 v12 = stru_721530.field_58.z; | |
390 v13 = stru_721530.normal.y; | |
391 a2 = stru_721530.prolly_normal_d + stru_721530.field_6C; | |
392 if ( !sub_475F30( | |
393 &a2, | |
394 &f, | |
395 stru_721530.normal.x, | |
396 v13, | |
397 stru_721530.normal.z, | |
398 stru_721530.field_58.x, | |
399 v11, | |
400 v12, | |
401 a10) ) | |
402 goto LABEL_29; | |
403 v10 = a2 - stru_721530.prolly_normal_d; | |
404 a2 -= stru_721530.prolly_normal_d; | |
405 } | |
406 if ( v10 < stru_721530.field_7C ) | |
407 { | |
408 stru_721530.field_7C = v10; | |
409 v14 = 8 * (v3 | (a10 << 6)); | |
410 LOBYTE(v14) = v14 | 6; | |
411 stru_721530.uFaceID = v14; | |
412 } | |
413 } | |
414 } | |
415 } | |
416 LABEL_29: | |
417 if ( stru_721530.field_0 & 1 ) | |
418 { | |
419 v15 = (f.pFacePlane_old.vNormal.z * stru_721530.field_34.z | |
420 + f.pFacePlane_old.dist | |
421 + f.pFacePlane_old.vNormal.y * stru_721530.field_34.y | |
422 + f.pFacePlane_old.vNormal.x * stru_721530.field_34.x) >> 16; | |
423 if ( v15 > 0 ) | |
424 { | |
425 v16 = (f.pFacePlane_old.vNormal.z * stru_721530.field_54 | |
426 + f.pFacePlane_old.dist | |
427 + f.pFacePlane_old.vNormal.y * stru_721530.field_50 | |
428 + f.pFacePlane_old.vNormal.x * stru_721530.field_4C) >> 16; | |
429 if ( v15 <= stru_721530.prolly_normal_d || v16 <= stru_721530.prolly_normal_d ) | |
430 { | |
431 if ( v16 <= v15 ) | |
432 { | |
433 a2 = stru_721530.field_6C; | |
434 if ( sub_4754BF( | |
435 stru_721530.field_8, | |
436 &a2, | |
437 stru_721530.field_34.x, | |
438 stru_721530.field_34.y, | |
439 stru_721530.field_34.z, | |
440 stru_721530.field_58.x, | |
441 stru_721530.field_58.y, | |
442 stru_721530.field_58.z, | |
443 &f, | |
444 a10, | |
445 a11) ) | |
446 { | |
447 if ( a2 < stru_721530.field_7C ) | |
448 { | |
449 stru_721530.field_7C = a2; | |
450 v17 = 8 * (v3 | (a10 << 6)); | |
451 LOBYTE(v17) = v17 | 6; | |
452 stru_721530.uFaceID = v17; | |
453 } | |
454 } | |
455 else | |
456 { | |
457 v18 = stru_721530.field_58.y; | |
458 v19 = stru_721530.field_58.z; | |
459 v20 = stru_721530.field_34.y; | |
460 a2 = stru_721530.field_6C + stru_721530.field_8; | |
461 if ( sub_475F30( | |
462 &a2, | |
463 &f, | |
464 stru_721530.field_34.x, | |
465 v20, | |
466 stru_721530.field_34.z, | |
467 stru_721530.field_58.x, | |
468 v18, | |
469 v19, | |
470 a10) ) | |
471 { | |
472 v2 = v28; | |
473 v21 = a2 - stru_721530.prolly_normal_d; | |
474 a2 -= stru_721530.prolly_normal_d; | |
475 if ( a2 < stru_721530.field_7C ) | |
476 { | |
477 stru_721530.field_7C = v21; | |
478 v22 = 8 * (v3 | (a10 << 6)); | |
479 LOBYTE(v22) = v22 | 6; | |
480 stru_721530.uFaceID = v22; | |
481 } | |
482 goto LABEL_38; | |
483 } | |
484 } | |
485 } | |
486 } | |
487 } | |
488 } | |
489 goto LABEL_37; | |
490 } | |
491 return result; | |
492 } | |
493 | |
494 //----- (0046ED1B) -------------------------------------------------------- | |
783 | 495 int collide_against_floor(int x, int y, int z, unsigned int *pSectorID, unsigned int *pFaceID) |
0 | 496 { |
497 uint uFaceID = -1; | |
723 | 498 int floor_level = BLV_GetFloorLevel(x, y, z, *pSectorID, &uFaceID); |
0 | 499 |
500 if (floor_level != -30000 && floor_level <= z + 50) | |
501 { | |
502 *pFaceID = uFaceID; | |
503 return floor_level; | |
504 } | |
505 | |
506 uint uSectorID = pIndoor->GetSector(x, y, z); | |
507 *pSectorID = uSectorID; | |
508 | |
723 | 509 floor_level = BLV_GetFloorLevel(x, y, z, uSectorID, &uFaceID); |
0 | 510 if (uSectorID && floor_level != -30000) |
511 *pFaceID = uFaceID; | |
512 else return -30000; | |
513 return floor_level; | |
514 } | |
515 | |
516 //----- (0046ED8A) -------------------------------------------------------- | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
517 void __fastcall _46ED8A_collide_against_sprite_objects(unsigned int _this) |
0 | 518 { |
519 int v1; // ebx@2 | |
520 ObjectDesc *v2; // edx@4 | |
521 int v3; // esi@5 | |
522 int v4; // ecx@5 | |
523 int v5; // eax@7 | |
524 int v6; // edi@9 | |
525 int v7; // edx@9 | |
526 int v8; // edi@11 | |
527 int v9; // ebx@11 | |
528 int v10; // ecx@12 | |
529 int v11; // esi@13 | |
530 signed int v12; // [sp+0h] [bp-14h]@1 | |
531 int v13; // [sp+4h] [bp-10h]@9 | |
532 char *v14; // [sp+8h] [bp-Ch]@2 | |
533 unsigned int v15; // [sp+10h] [bp-4h]@1 | |
534 | |
535 v15 = 0; | |
536 v12 = _this; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
537 if ( (signed int)uNumSpriteObjects > 0 ) |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
538 { |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
539 v1 = (int)&pSpriteObjects[0].uObjectDescID; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
540 v14 = (char *)&pSpriteObjects[0].uObjectDescID; |
0 | 541 do |
542 { | |
543 if ( *(short *)v1 ) | |
544 { | |
545 v2 = &pObjectList->pObjects[*(short *)v1]; | |
546 if ( !(v2->uFlags & 2) ) | |
547 { | |
548 v3 = v2->uRadius; | |
549 v4 = *(int *)(v1 + 2); | |
550 if ( stru_721530.sMaxX <= v4 + v3 ) | |
551 { | |
552 if ( stru_721530.sMinX >= v4 - v3 ) | |
553 { | |
554 v5 = *(int *)(v1 + 6); | |
555 if ( stru_721530.sMaxY <= v5 + v3 ) | |
556 { | |
557 if ( stru_721530.sMinY >= v5 - v3 ) | |
558 { | |
559 v6 = v2->uHeight; | |
560 v7 = *(int *)(v1 + 10); | |
561 v13 = v6; | |
562 if ( stru_721530.sMaxZ <= v7 + v6 ) | |
563 { | |
564 if ( stru_721530.sMinZ >= v7 ) | |
565 { | |
566 v8 = v4 - stru_721530.normal.x; | |
567 v9 = v5 - stru_721530.normal.y; | |
568 if ( abs(((v4 - stru_721530.normal.x) * stru_721530.field_58.y | |
569 - (v5 - stru_721530.normal.y) * stru_721530.field_58.x) >> 16) <= v3 | |
570 + stru_721530.prolly_normal_d ) | |
571 { | |
572 v10 = (v8 * stru_721530.field_58.x + v9 * stru_721530.field_58.y) >> 16; | |
573 if ( v10 > 0 ) | |
574 { | |
575 v11 = stru_721530.normal.z | |
576 + ((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v10) >> 16); | |
577 if ( v11 >= *(int *)(v14 + 10) - stru_721530.prolly_normal_d ) | |
578 { | |
579 if ( v11 <= v13 + stru_721530.prolly_normal_d + *(int *)(v14 + 10) ) | |
580 { | |
581 if ( v10 < stru_721530.field_7C ) | |
582 sub_46DEF2(v12, v15); | |
583 } | |
584 } | |
585 } | |
586 } | |
587 } | |
588 } | |
589 } | |
590 } | |
591 } | |
592 } | |
593 } | |
594 } | |
595 ++v15; | |
596 v1 = (int)(v14 + 112); | |
597 v14 += 112; | |
598 } | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
599 while ( (signed int)v15 < (signed int)uNumSpriteObjects ); |
0 | 600 } |
601 } | |
602 | |
603 //----- (0046EF01) -------------------------------------------------------- | |
604 int __thiscall _46EF01_collision_chech_player(int a1) | |
605 { | |
606 int v1; // edx@1 | |
607 int result; // eax@1 | |
608 int v3; // ebx@7 | |
609 int v4; // esi@7 | |
610 int v5; // edi@8 | |
611 int v6; // ecx@9 | |
612 int v7; // edi@12 | |
613 int v8; // [sp+Ch] [bp-10h]@1 | |
614 unsigned int v9; // [sp+10h] [bp-Ch]@1 | |
615 int v10; // [sp+14h] [bp-8h]@7 | |
616 int v11; // [sp+18h] [bp-4h]@7 | |
617 | |
618 v8 = a1; | |
619 v1 = 2 * pParty->field_14; | |
620 result = pParty->vPosition.x; | |
621 v9 = pParty->uPartyHeight; | |
622 if ( stru_721530.sMaxX <= pParty->vPosition.x + 2 * pParty->field_14 ) | |
623 { | |
624 if ( stru_721530.sMinX >= pParty->vPosition.x - v1 ) | |
625 { | |
626 if ( stru_721530.sMaxY <= pParty->vPosition.y + v1 ) | |
627 { | |
628 if ( stru_721530.sMinY >= pParty->vPosition.y - v1 ) | |
629 { | |
630 if ( stru_721530.sMaxZ <= (signed int)(pParty->vPosition.z + pParty->uPartyHeight) ) | |
631 { | |
632 if ( stru_721530.sMinZ >= pParty->vPosition.z ) | |
633 { | |
634 v3 = stru_721530.prolly_normal_d + v1; | |
635 v11 = pParty->vPosition.x - stru_721530.normal.x; | |
636 v4 = ((pParty->vPosition.x - stru_721530.normal.x) * stru_721530.field_58.y | |
637 - (pParty->vPosition.y - stru_721530.normal.y) * stru_721530.field_58.x) >> 16; | |
638 v10 = pParty->vPosition.y - stru_721530.normal.y; | |
639 result = abs(((pParty->vPosition.x - stru_721530.normal.x) * stru_721530.field_58.y | |
640 - (pParty->vPosition.y - stru_721530.normal.y) * stru_721530.field_58.x) >> 16); | |
641 if ( result <= v3 ) | |
642 { | |
643 result = v10 * stru_721530.field_58.y; | |
644 v5 = (v10 * stru_721530.field_58.y + v11 * stru_721530.field_58.x) >> 16; | |
645 if ( v5 > 0 ) | |
646 { | |
647 v6 = ((unsigned __int64)(stru_721530.field_58.z * (signed __int64)v5) >> 16) + stru_721530.normal.z; | |
648 result = pParty->vPosition.z; | |
649 if ( v6 >= pParty->vPosition.z ) | |
650 { | |
651 result = v9 + pParty->vPosition.z; | |
652 if ( v6 <= (signed int)(v9 + pParty->vPosition.z) || v8 ) | |
653 { | |
295 | 654 result = integer_sqrt(v3 * v3 - v4 * v4); |
0 | 655 v7 = v5 - result; |
656 if ( v7 < 0 ) | |
657 v7 = 0; | |
658 if ( v7 < stru_721530.field_7C ) | |
659 { | |
660 stru_721530.field_7C = v7; | |
661 stru_721530.uFaceID = 4; | |
662 } | |
663 } | |
664 } | |
665 } | |
666 } | |
667 } | |
668 } | |
669 } | |
670 } | |
671 } | |
672 } | |
673 return result; | |
674 } | |
675 | |
676 //----- (0046F04E) -------------------------------------------------------- | |
677 signed int __cdecl _46F04E_collide_against_portals() | |
678 { | |
679 BLVSector *v0; // ecx@1 | |
680 unsigned int v1; // eax@1 | |
681 int v2; // eax@2 | |
682 BLVFace *v3; // eax@3 | |
683 int v4; // ecx@9 | |
684 int v5; // edx@9 | |
685 signed int result; // eax@21 | |
686 BLVFace *v7; // eax@22 | |
687 signed int v8; // [sp+0h] [bp-14h]@1 | |
688 BLVSector *v9; // [sp+4h] [bp-10h]@1 | |
689 unsigned int v10; // [sp+8h] [bp-Ch]@1 | |
690 int a3; // [sp+Ch] [bp-8h]@13 | |
691 int v12; // [sp+10h] [bp-4h]@15 | |
692 | |
693 v8 = 0; | |
694 v0 = &pIndoor->pSectors[stru_721530.uSectorID]; | |
695 v1 = 0xFFFFFFu; | |
696 v10 = 0xFFFFFFu; | |
697 v9 = v0; | |
698 if ( v0->uNumPortals > 0 ) | |
699 { | |
700 do | |
701 { | |
702 v2 = v0->pPortals[v8]; | |
703 if ( v2 != stru_721530.field_80 ) | |
704 { | |
705 v3 = &pIndoor->pFaces[v2]; | |
706 if ( stru_721530.sMaxX <= v3->pBounding.x2 ) | |
707 { | |
708 if ( stru_721530.sMinX >= v3->pBounding.x1 | |
709 && stru_721530.sMaxY <= v3->pBounding.y2 | |
710 && stru_721530.sMinY >= v3->pBounding.y1 | |
711 && stru_721530.sMaxZ <= v3->pBounding.z2 | |
712 && stru_721530.sMinZ >= v3->pBounding.z1 ) | |
713 { | |
714 v4 = (stru_721530.normal.x * v3->pFacePlane_old.vNormal.x | |
715 + v3->pFacePlane_old.dist | |
716 + stru_721530.normal.y * v3->pFacePlane_old.vNormal.y | |
717 + stru_721530.normal.z * v3->pFacePlane_old.vNormal.z) >> 16; | |
718 v5 = (stru_721530.normal2.z * v3->pFacePlane_old.vNormal.z | |
719 + v3->pFacePlane_old.dist | |
720 + stru_721530.normal2.x * v3->pFacePlane_old.vNormal.x | |
721 + stru_721530.normal2.y * v3->pFacePlane_old.vNormal.y) >> 16; | |
722 if ( (v4 < stru_721530.prolly_normal_d || v5 < stru_721530.prolly_normal_d) | |
723 && (v4 > -stru_721530.prolly_normal_d || v5 > -stru_721530.prolly_normal_d) | |
724 && (a3 = stru_721530.field_6C, sub_475D85(&stru_721530.normal, &stru_721530.field_58, &a3, v3)) | |
725 && a3 < (signed int)v10 ) | |
726 { | |
727 v0 = v9; | |
728 v10 = a3; | |
729 v12 = v9->pPortals[v8]; | |
730 } | |
731 else | |
732 { | |
733 v0 = v9; | |
734 } | |
735 } | |
736 } | |
737 } | |
738 ++v8; | |
739 } | |
740 while ( v8 < v0->uNumPortals ); | |
741 v1 = v10; | |
742 } | |
743 if ( stru_721530.field_7C >= (signed int)v1 && (signed int)v1 <= stru_721530.field_6C ) | |
744 { | |
745 stru_721530.field_80 = v12; | |
746 v7 = &pIndoor->pFaces[v12]; | |
747 if ( v7->uSectorID == stru_721530.uSectorID ) | |
748 stru_721530.uSectorID = v7->uBackSectorID; | |
749 else | |
750 stru_721530.uSectorID = v7->uSectorID; | |
751 stru_721530.field_7C = 268435455; | |
752 result = 0; | |
753 } | |
754 else | |
755 { | |
756 result = 1; | |
757 } | |
758 return result; | |
759 } | |
760 | |
761 //----- (0047050A) -------------------------------------------------------- | |
762 int stru141::_47050A(int a2) | |
763 { | |
764 stru141 *v2; // esi@1 | |
765 signed int v3; // eax@1 | |
766 int v4; // ecx@1 | |
767 int v5; // edx@1 | |
768 int v6; // edx@1 | |
769 int v7; // eax@1 | |
770 int v8; // eax@3 | |
771 signed int result; // eax@4 | |
772 int v10; // eax@5 | |
773 int v11; // eax@5 | |
774 int v12; // ebx@5 | |
775 int v13; // edx@5 | |
776 int v14; // edi@5 | |
777 int v15; // ecx@5 | |
778 int v16; // eax@5 | |
779 int v17; // eax@5 | |
780 int v18; // eax@7 | |
781 int v19; // edx@9 | |
782 int v20; // edi@9 | |
783 int v21; // eax@9 | |
784 int v22; // eax@11 | |
785 int v23; // edx@13 | |
786 int v24; // eax@13 | |
787 int v25; // eax@14 | |
788 int v26; // eax@16 | |
789 int v27; // eax@17 | |
790 int v28; // [sp+14h] [bp+8h]@5 | |
791 | |
792 v2 = this; | |
295 | 793 v3 = integer_sqrt(this->field_24 * this->field_24 + this->field_20 * this->field_20 + this->field_1C * this->field_1C); |
0 | 794 v4 = v3 | 1; |
795 v5 = v2->field_1C; | |
796 v2->field_64 = v3 | 1; | |
797 v2->field_58.x = 65536 / (v3 | 1) * v5; | |
798 v2->field_58.y = 65536 / (v3 | 1) * v2->field_20; | |
799 v6 = 65536 / (v3 | 1) * v2->field_24; | |
800 v2->field_68 = 65536 / (v3 | 1); | |
801 v7 = a2; | |
802 v2->field_58.z = v6; | |
803 if ( !a2 ) | |
804 v7 = pEventTimer->dt_in_some_format; | |
805 v8 = ((unsigned __int64)(v7 * (signed __int64)v4) >> 16) - v2->field_70; | |
806 v2->field_6C = v8; | |
807 if ( v8 > 0 ) | |
808 { | |
809 v10 = ((unsigned __int64)(v8 * (signed __int64)v2->field_58.x) >> 16) + v2->normal.x; | |
810 v2->field_4C = v10; | |
811 v2->normal2.x = v10; | |
812 v11 = ((unsigned __int64)(v2->field_6C * (signed __int64)v2->field_58.y) >> 16) + v2->normal.y; | |
813 v2->field_50 = v11; | |
814 v2->normal2.y = v11; | |
815 v2->normal2.z = ((unsigned __int64)(v2->field_6C * (signed __int64)v2->field_58.z) >> 16) + v2->normal.z; | |
816 v12 = v2->field_34.z; | |
817 v13 = v2->normal.x; | |
818 v14 = v2->normal2.x; | |
819 v15 = v2->prolly_normal_d; | |
820 v16 = v12 + ((unsigned __int64)(v2->field_6C * (signed __int64)v2->field_58.z) >> 16); | |
821 v28 = v16; | |
822 v2->field_54 = v16; | |
823 v17 = v13; | |
824 if ( v13 >= v14 ) | |
825 v17 = v14; | |
826 v2->sMaxX = v17 - v15; | |
827 v18 = v15 + v13; | |
828 if ( v13 <= v14 ) | |
829 v18 = v15 + v14; | |
830 v19 = v2->normal.y; | |
831 v20 = v2->normal2.y; | |
832 v2->sMinX = v18; | |
833 v21 = v19; | |
834 if ( v19 >= v20 ) | |
835 v21 = v20; | |
836 v2->sMaxY = v21 - v15; | |
837 v22 = v15 + v19; | |
838 if ( v19 <= v20 ) | |
839 v22 = v20 + v15; | |
840 v23 = v2->normal2.z; | |
841 v2->sMinY = v22; | |
842 v24 = v2->normal.z; | |
843 if ( v24 >= v23 ) | |
844 v25 = v23 - v15; | |
845 else | |
846 v25 = v24 - v15; | |
847 v2->sMaxZ = v25; | |
848 v26 = v2->field_8; | |
849 if ( v12 <= v28 ) | |
850 v27 = v28 + v26; | |
851 else | |
852 v27 = v12 + v26; | |
853 v2->uFaceID = 0; | |
854 v2->field_80 = -1; | |
855 v2->field_88 = -1; | |
856 v2->sMinZ = v27; | |
857 v2->field_7C = 0xFFFFFFu; | |
858 result = 0; | |
859 } | |
860 else | |
861 { | |
862 result = 1; | |
863 } | |
864 return result; | |
865 } | |
866 | |
867 //----- (004706C6) -------------------------------------------------------- | |
868 void __cdecl UpdateActors_ODM() | |
869 { | |
870 Actor *v0; // esi@2 | |
845 | 871 AIState uAIState; // ax@2 |
846 | 872 //unsigned int v2; // ecx@6 |
0 | 873 int v3; // ebx@6 |
845 | 874 //int v4; // eax@8 |
0 | 875 int v5; // eax@10 |
876 int v6; // ecx@10 | |
846 | 877 //signed int v7; // ebx@10 |
0 | 878 signed int v8; // ebx@17 |
845 | 879 //unsigned __int8 v9; // zf@17 |
0 | 880 unsigned __int8 v10; // sf@17 |
881 unsigned __int16 v11; // ax@21 | |
882 int v12; // eax@29 | |
883 unsigned __int64 v13; // qax@29 | |
884 int v14; // eax@30 | |
885 unsigned __int64 v15; // qax@30 | |
886 int v16; // eax@33 | |
846 | 887 //int v17; // edi@34 |
0 | 888 int v18; // edx@42 |
889 int v19; // ecx@42 | |
890 __int16 v20; // ax@42 | |
891 int v21; // ebx@42 | |
892 int v22; // edi@42 | |
893 int v23; // ecx@42 | |
894 __int16 v24; // ax@42 | |
895 int v25; // eax@45 | |
896 signed int v26; // ecx@50 | |
897 int v27; // eax@52 | |
898 int v28; // eax@54 | |
899 signed int v29; // ebx@57 | |
900 signed int v30; // eax@57 | |
901 int v31; // edi@57 | |
902 signed int i; // ebx@57 | |
903 unsigned int v33; // ecx@58 | |
845 | 904 //int v34; // ebx@64 |
0 | 905 int v35; // edi@64 |
906 int v36; // eax@64 | |
848 | 907 //unsigned __int16 v37; // cx@66 |
0 | 908 signed int v38; // edx@71 |
848 | 909 unsigned int v39; // edi@71 |
0 | 910 BSPModel *v40; // eax@75 |
911 ODMFace *v41; // edi@75 | |
912 int v42; // ebx@76 | |
913 int v43; // ecx@77 | |
914 int v44; // edx@77 | |
915 __int16 v45; // dx@82 | |
916 int v46; // ecx@82 | |
917 signed int v47; // ebx@85 | |
918 int v48; // edi@85 | |
919 int v49; // edi@85 | |
920 int v50; // eax@85 | |
921 unsigned __int64 v51; // qax@85 | |
848 | 922 //unsigned __int8 v52; // zf@87 |
923 //unsigned __int8 v53; // sf@87 | |
845 | 924 // unsigned __int8 v54; // of@104 |
0 | 925 int v55; // eax@107 |
926 unsigned int v56; // edi@107 | |
927 int v57; // ST10_4@107 | |
928 unsigned int v58; // edi@107 | |
929 unsigned int v59; // ebx@107 | |
930 signed int v60; // eax@107 | |
931 int v61; // eax@124 | |
932 Vec3_int_ v62; // [sp+Ch] [bp-44h]@42 | |
153 | 933 int v63; // [sp+18h] [bp-38h]@64 |
0 | 934 int v64; // [sp+1Ch] [bp-34h]@64 |
935 int v65; // [sp+20h] [bp-30h]@2 | |
936 int v66; // [sp+24h] [bp-2Ch]@2 | |
937 bool v67; // [sp+28h] [bp-28h]@10 | |
846 | 938 //unsigned int v68; // [sp+2Ch] [bp-24h]@10 |
0 | 939 unsigned int v69; // [sp+30h] [bp-20h]@6 |
940 unsigned int v70; // [sp+34h] [bp-1Ch]@10 | |
941 int v71; // [sp+38h] [bp-18h]@62 | |
845 | 942 int uIsAboveFloor; // [sp+3Ch] [bp-14h]@10 |
943 int v72b; | |
0 | 944 int v73; // [sp+40h] [bp-10h]@17 |
845 | 945 int uIsFlying; // [sp+44h] [bp-Ch]@8 |
0 | 946 unsigned int v75; // [sp+48h] [bp-8h]@1 |
845 | 947 int uIsOnWater; // [sp+4Ch] [bp-4h]@10 |
948 | |
949 for(v75=0;(signed int)v75 < (signed int)uNumActors;++v75) | |
0 | 950 { |
951 v0 = &pActors[v75]; | |
952 v66 = v0->vPosition.x; | |
953 v65 = v0->vPosition.y; | |
845 | 954 uAIState = v0->uAIState; |
955 if ( uAIState == Removed || uAIState == Disabled || uAIState == Summoned || !v0->uMovementSpeed ) | |
956 { | |
957 continue; | |
958 } | |
0 | 959 v3 = 0; |
960 v69 = 0; | |
846 | 961 if ( MonsterStats::BelongsToSupertype(v0->pMonsterInfo.uID, MONSTER_SUPERTYPE_WATER_ELEMENTAL) ) |
0 | 962 v3 = 1; |
963 v0->uSectorID = 0; | |
845 | 964 uIsFlying = v0->pMonsterInfo.uFlying; |
0 | 965 if ( !v0->CanAct() ) |
845 | 966 uIsFlying = 0; |
138 | 967 v70 = IsTerrainSlopeTooHigh(v0->vPosition.x, v0->vPosition.y); |
723 | 968 v5 = ODM_GetFloorLevel( |
0 | 969 v0->vPosition.x, |
970 v0->vPosition.y, | |
971 v0->vPosition.z, | |
972 v0->uActorHeight, | |
845 | 973 &uIsOnWater, |
0 | 974 (int *)&v69, |
975 v3); | |
976 v6 = v0->vPosition.z; | |
845 | 977 uIsAboveFloor = 0; |
0 | 978 v67 = v69 == 0; |
979 if ( v6 > v5 + 1 ) | |
845 | 980 uIsAboveFloor = 1; |
981 if ( uAIState == Dead && uIsOnWater && !uIsAboveFloor ) | |
0 | 982 { |
983 v0->uAIState = Removed; | |
845 | 984 continue; |
0 | 985 } |
305 | 986 if ( v0->uCurrentActionAnimation == ANIM_Walking ) |
0 | 987 { |
988 v8 = v0->uMovementSpeed; | |
989 v73 = v0->uMovementSpeed; | |
845 | 990 if ( (signed __int64)v0->pActorBuffs[7].uExpireTime > 0 ) |
0 | 991 { |
992 v8 = (signed __int64)((double)v73 * 0.5); | |
993 v73 = (signed __int64)((double)v73 * 0.5); | |
994 } | |
845 | 995 if ( uAIState == Fleeing || uAIState == Pursuing ) |
0 | 996 { |
997 v8 *= 2; | |
998 v73 = v8; | |
999 } | |
1340 | 1000 if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->turn_stage == 1 ) |
0 | 1001 v8 = (signed __int64)((double)v73 * flt_6BE3AC_debug_recmod1_x_1_6); |
1002 if ( v8 > 1000 ) | |
1003 v8 = 1000; | |
323 | 1004 v12 = stru_5C6E00->Cos(v0->uYawAngle); |
0 | 1005 v13 = v12 * (signed __int64)v8; |
1006 v73 = v13 >> 16; | |
1007 v0->vVelocity.x = WORD1(v13); | |
323 | 1008 v69 = stru_5C6E00->Sin(v0->uYawAngle); |
0 | 1009 v73 = (unsigned __int64)((signed int)v69 * (signed __int64)v8) >> 16; |
1010 v0->vVelocity.y = v69 * v8 >> 16; | |
845 | 1011 if ( uIsFlying ) |
0 | 1012 { |
323 | 1013 v14 = stru_5C6E00->Sin(v0->uPitchAngle); |
0 | 1014 v69 = v14; |
1015 v15 = v14 * (signed __int64)v8; | |
1016 v73 = v15 >> 16; | |
1017 v0->vVelocity.z = WORD1(v15); | |
1018 } | |
846 | 1019 //v7 = v68; |
0 | 1020 } |
1021 else | |
1022 { | |
1023 v73 = v0->vVelocity.x; | |
1024 v69 = 55000; | |
1025 v73 = (unsigned __int64)(55000i64 * v73) >> 16; | |
1026 v0->vVelocity.x = v73; | |
1027 v73 = v0->vVelocity.y; | |
1028 v73 = (unsigned __int64)((signed int)v69 * (signed __int64)v73) >> 16; | |
1029 v0->vVelocity.y = v73; | |
845 | 1030 if ( uIsFlying ) |
0 | 1031 { |
1032 v69 = 55000; | |
1033 v73 = v0->vVelocity.z; | |
1034 v73 = (unsigned __int64)(55000i64 * v73) >> 16; | |
1035 v0->vVelocity.z = v73; | |
1036 } | |
1037 } | |
846 | 1038 if ( v0->vPosition.z < v5 ) |
0 | 1039 { |
845 | 1040 v16 = uIsFlying; |
846 | 1041 v0->vPosition.z = v5; |
0 | 1042 v0->vVelocity.z = v16 != 0 ? 0x14 : 0; |
1043 } | |
846 | 1044 //v17 = 0; |
845 | 1045 if ( !uIsAboveFloor || uIsFlying ) |
1046 { | |
1047 if ( v70 && !uIsAboveFloor && v67 ) | |
0 | 1048 { |
1049 v18 = v0->vPosition.y; | |
1050 v19 = v0->vPosition.x; | |
846 | 1051 v0->vPosition.z = v5; |
138 | 1052 ODM_GetTerrainNormalAt(v19, v18, &v62); |
0 | 1053 v20 = GetGravityStrength(); |
1054 v21 = v62.y; | |
1055 v22 = v62.z; | |
1056 v23 = v62.y * v0->vVelocity.y; | |
1057 v0->vVelocity.z += -8 * LOWORD(pEventTimer->uTimeElapsed) * v20; | |
1058 v73 = abs(v62.x * v0->vVelocity.x + v22 * v0->vVelocity.z + v23) >> 16; | |
845 | 1059 v72b = v21; |
0 | 1060 v0->vVelocity.x += (unsigned int)(v73 * v62.x) >> 16; |
845 | 1061 v72b = (unsigned __int64)(v73 * (signed __int64)v72b) >> 16; |
1062 v24 = v72b; | |
1063 v72b = v22; | |
0 | 1064 v0->vVelocity.y += v24; |
845 | 1065 v72b = (unsigned __int64)(v73 * (signed __int64)v72b) >> 16; |
1066 v0->vVelocity.z += v72b; | |
846 | 1067 //v17 = 0; |
0 | 1068 } |
1069 } | |
1070 else | |
1071 { | |
1072 v0->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength(); | |
1073 } | |
846 | 1074 if ( pParty->armageddon_timer != 0 && v0->CanAct() ) |
0 | 1075 { |
1076 v0->vVelocity.x += rand() % 100 - 50; | |
1077 v0->vVelocity.y += rand() % 100 - 50; | |
1078 v0->vVelocity.z += rand() % 100 - 20; | |
1079 v25 = rand(); | |
1080 v0->uAIState = Stunned; | |
1081 v0->uYawAngle += v25 % 32 - 16; | |
1082 v0->UpdateAnimation(); | |
1083 } | |
846 | 1084 if ( v0->vVelocity.x * v0->vVelocity.x + v0->vVelocity.y * v0->vVelocity.y < 400 && v70 == 0 ) |
1085 { | |
1086 v0->vVelocity.y = 0; | |
1087 v0->vVelocity.x = 0; | |
0 | 1088 } |
1089 stru_721530.field_0 = 1; | |
845 | 1090 if ( !uIsFlying ) |
0 | 1091 v26 = 40; |
1092 else | |
1093 v26 = v0->uActorRadius; | |
1094 v27 = v0->uActorHeight; | |
1095 stru_721530.field_84 = -1; | |
1096 stru_721530.field_8 = v26; | |
1097 stru_721530.prolly_normal_d = v26; | |
1098 stru_721530.field_C = v27; | |
846 | 1099 stru_721530.field_70 = 0; |
1100 v69 = 0; | |
0 | 1101 while ( 1 ) |
1102 { | |
1103 stru_721530.field_34.x = v0->vPosition.x; | |
1104 stru_721530.normal.x = stru_721530.field_34.x; | |
1105 stru_721530.field_34.y = v0->vPosition.y; | |
1106 stru_721530.normal.y = stru_721530.field_34.y; | |
1107 v28 = v0->vPosition.z; | |
1108 stru_721530.normal.z = v28 + v26 + 1; | |
1109 stru_721530.field_34.z = v28 - v26 + stru_721530.field_C - 1; | |
1110 if ( stru_721530.field_34.z < stru_721530.normal.z ) | |
1111 stru_721530.field_34.z = v28 + v26 + 1; | |
1112 stru_721530.field_1C = v0->vVelocity.x; | |
1113 stru_721530.uSectorID = 0; | |
1114 stru_721530.field_20 = v0->vVelocity.y; | |
1115 stru_721530.field_24 = v0->vVelocity.z; | |
1116 if ( stru_721530._47050A(0) ) | |
1117 break; | |
1118 _46E889_collide_against_bmodels(1u); | |
1119 v29 = WorldPosToGridCellZ(v0->vPosition.y); | |
1120 v30 = WorldPosToGridCellX(v0->vPosition.x); | |
1121 _46E26D_collide_against_sprites(v30, v29); | |
1122 _46EF01_collision_chech_player(0); | |
862 | 1123 _46ED8A_collide_against_sprite_objects(PID(OBJECT_Actor,v75)); |
0 | 1124 v31 = 0; |
1125 for ( i = 0; v31 < ai_arrays_size; ++v31 ) | |
1126 { | |
390 | 1127 v33 = ai_near_actors_ids[v31]; |
0 | 1128 if ( v33 != v75 && _46DF1A_collide_against_actor(v33, 40) ) |
1129 ++i; | |
1130 } | |
1131 v71 = i > 1; | |
1132 if ( stru_721530.field_7C < stru_721530.field_6C ) | |
1133 v70 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16; | |
845 | 1134 //v34 = 0; |
0 | 1135 v35 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1; |
723 | 1136 v36 = ODM_GetFloorLevel( |
0 | 1137 stru_721530.normal2.x, |
1138 stru_721530.normal2.y, | |
1139 stru_721530.normal2.z - stru_721530.prolly_normal_d - 1, | |
1140 v0->uActorHeight, | |
1141 (int *)&v63, | |
1142 &v64, | |
1143 0); | |
845 | 1144 if ( uIsOnWater ) |
0 | 1145 { |
1146 if ( v35 < v36 + 60 ) | |
1147 { | |
848 | 1148 if ( uAIState == Dead || uAIState == Dying || uAIState == Removed || uAIState == Disabled ) |
0 | 1149 { |
1150 if ( v64 ) | |
1151 v61 = v36 + 30; | |
1152 else | |
846 | 1153 v61 = v5 + 60; |
0 | 1154 sub_42F960_create_object(v0->vPosition.x, v0->vPosition.y, v61); |
1155 v0->uAIState = Removed; | |
1156 return; | |
1157 } | |
1158 } | |
1159 } | |
1160 if ( stru_721530.field_7C >= stru_721530.field_6C ) | |
1161 { | |
1162 v0->vPosition.x = LOWORD(stru_721530.normal2.x); | |
1163 v0->vPosition.y = LOWORD(stru_721530.normal2.y); | |
1164 v0->vPosition.z = LOWORD(stru_721530.normal2.z) - LOWORD(stru_721530.prolly_normal_d) - 1; | |
1165 break; | |
1166 } | |
845 | 1167 v72b = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16; |
0 | 1168 v0->vPosition.x += (unsigned int)(stru_721530.field_7C * stru_721530.field_58.x) >> 16; |
845 | 1169 v72b = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16; |
0 | 1170 v0->vPosition.y += (unsigned int)(stru_721530.field_7C * stru_721530.field_58.y) >> 16; |
845 | 1171 v72b = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16; |
0 | 1172 v38 = stru_721530.uFaceID; |
1173 v0->vPosition.z += (unsigned int)(stru_721530.field_7C * stru_721530.field_58.z) >> 16; | |
1174 stru_721530.field_70 += stru_721530.field_7C; | |
848 | 1175 v39 = PID_ID(v38); |
845 | 1176 switch ( PID_TYPE(v38) ) |
1177 { | |
1178 case OBJECT_Actor: | |
1340 | 1179 if ( pTurnEngine->turn_stage != 2 && pTurnEngine->turn_stage != 3 || pParty->bTurnBasedModeOn != 1 ) |
845 | 1180 { |
1181 //if(pParty->bTurnBasedModeOn == 1) | |
1182 //v34 = 0; | |
0 | 1183 if ( v0->pMonsterInfo.uHostilityType ) |
1184 { | |
845 | 1185 if ( v71 == 0 ) |
1186 { | |
1060 | 1187 Actor::AI_Flee(v75, v38, 0, (AIDirection *)0); |
845 | 1188 } |
1189 else | |
1190 { | |
1191 Actor::AI_StandOrBored(v75, 4, 0, (AIDirection *)0); | |
1192 } | |
0 | 1193 } |
845 | 1194 else if ( v71 != 0 ) |
1195 { | |
1196 Actor::AI_StandOrBored(v75, 4, 0, (AIDirection *)0); | |
1197 } | |
1198 else if ( pActors[v39].pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly ) | |
0 | 1199 { |
1060 | 1200 Actor::AI_Flee(v75, v38, 0, (AIDirection *)0); |
0 | 1201 } |
845 | 1202 else |
1203 { | |
1060 | 1204 Actor::AI_FaceObject(v75, v38, 0, (AIDirection *)0); |
845 | 1205 } |
0 | 1206 } |
1207 break; | |
845 | 1208 case OBJECT_Player: |
0 | 1209 if ( !v0->GetActorsRelation(0) ) |
1210 { | |
1211 v38 = stru_721530.uFaceID; | |
1060 | 1212 Actor::AI_FaceObject(v75, v38, 0, (AIDirection *)0); |
845 | 1213 break; |
0 | 1214 } |
1167 | 1215 //v52 = HIDWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) == 0; |
1216 //v53 = SHIDWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) < 0; | |
0 | 1217 v0->vVelocity.y = 0; |
1218 v0->vVelocity.x = 0; | |
1167 | 1219 //if ( !v53 && (!(v53 | v52) || LODWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) > 0) ) |
1220 if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime < 0) | |
1221 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); | |
0 | 1222 viewparams->bRedrawGameUI = 1; |
1223 break; | |
845 | 1224 case OBJECT_Decoration: |
295 | 1225 v47 = integer_sqrt(v0->vVelocity.x * v0->vVelocity.x + v0->vVelocity.y * v0->vVelocity.y); |
0 | 1226 v48 = stru_5C6E00->Atan2( |
1227 v0->vPosition.x - pLevelDecorations[v39].vPosition.x, | |
1228 v0->vPosition.y - pLevelDecorations[v39].vPosition.y); | |
323 | 1229 v71 = stru_5C6E00->Cos(v48); |
0 | 1230 v70 = (unsigned __int64)(v71 * (signed __int64)v47) >> 16; |
323 | 1231 v49 = v48; |
0 | 1232 v0->vVelocity.x = (unsigned int)(v71 * v47) >> 16; |
323 | 1233 v50 = stru_5C6E00->Sin(v48); |
0 | 1234 v71 = v50; |
1235 v51 = v50 * (signed __int64)v47; | |
1236 v70 = v51 >> 16; | |
1237 v0->vVelocity.y = WORD1(v51); | |
1238 break; | |
845 | 1239 case OBJECT_BModel: |
0 | 1240 v40 = &pOutdoor->pBModels[v38 >> 9]; |
1241 v41 = &v40->pFaces[v39 & 0x3F]; | |
1242 if ( !(BYTE3(v41->uAttributes) & 0x20) ) | |
1243 { | |
1244 v42 = v41->uPolygonType; | |
1245 if ( v42 == 3 ) | |
1246 { | |
1247 v43 = v0->vVelocity.y; | |
1248 v44 = v0->vVelocity.x; | |
1249 v0->vVelocity.z = 0; | |
1250 v0->vPosition.z = LOWORD(v40->pVertices.pVertices[v41->pVertexIDs[0]].z) + 1; | |
1251 if ( v44 * v44 + v43 * v43 < 400 ) | |
1252 { | |
1253 v0->vVelocity.y = 0; | |
1254 v0->vVelocity.x = 0; | |
1255 } | |
1256 } | |
1257 else | |
1258 { | |
845 | 1259 v72b = abs(v41->pFacePlane.vNormal.y * v0->vVelocity.y + v41->pFacePlane.vNormal.z * v0->vVelocity.z |
0 | 1260 + v41->pFacePlane.vNormal.x * v0->vVelocity.x) >> 16; |
845 | 1261 if ( stru_721530.field_64 >> 3 > v72b ) |
1262 v72b = stru_721530.field_64 >> 3; | |
0 | 1263 v73 = v41->pFacePlane.vNormal.x; |
845 | 1264 v73 = (unsigned __int64)(v72b * (signed __int64)v73) >> 16; |
0 | 1265 v71 = v41->pFacePlane.vNormal.y; |
845 | 1266 v71 = (unsigned __int64)(v72b * (signed __int64)v71) >> 16; |
0 | 1267 v70 = v41->pFacePlane.vNormal.z; |
845 | 1268 v70 = (unsigned __int64)(v72b * (signed __int64)(signed int)v70) >> 16; |
0 | 1269 v0->vVelocity.x += v73; |
1270 v0->vVelocity.y += v71; | |
1271 v0->vVelocity.z += v70; | |
1272 if ( v42 != 4 ) | |
1273 { | |
1274 v45 = v0->vPosition.z; | |
1275 v46 = stru_721530.prolly_normal_d | |
1276 - ((v41->pFacePlane.dist | |
1277 + v41->pFacePlane.vNormal.x * v0->vPosition.x | |
1278 + v41->pFacePlane.vNormal.y * v0->vPosition.y | |
1279 + v41->pFacePlane.vNormal.z * v0->vPosition.z) >> 16); | |
1280 if ( v46 > 0 ) | |
1281 { | |
1282 v0->vPosition.x += (unsigned int)(v46 * v41->pFacePlane.vNormal.x) >> 16; | |
1283 v0->vPosition.y += (unsigned int)(v46 * v41->pFacePlane.vNormal.y) >> 16; | |
1284 v0->vPosition.z = v45 + ((unsigned int)(v46 * v41->pFacePlane.vNormal.z) >> 16); | |
1285 } | |
1286 v0->uYawAngle = stru_5C6E00->Atan2(v0->vVelocity.x, v0->vVelocity.y); | |
1287 } | |
1288 } | |
1289 } | |
1290 break; | |
1291 } | |
1292 v70 = v0->vVelocity.x; | |
1293 v71 = 58500; | |
1294 v70 = (unsigned __int64)(58500i64 * (signed int)v70) >> 16; | |
1295 v0->vVelocity.x = v70; | |
1296 v70 = v0->vVelocity.y; | |
1297 v70 = (unsigned __int64)(v71 * (signed __int64)(signed int)v70) >> 16; | |
1298 v71 = 58500; | |
1299 v0->vVelocity.y = v70; | |
1300 v70 = v0->vVelocity.z; | |
1301 v70 = (unsigned __int64)(v71 * (signed __int64)(signed int)v70) >> 16; | |
1302 ++v69; | |
845 | 1303 //v54 = v69 < 100; |
1304 //v10 = (v69 - 100) < 0; | |
0 | 1305 v0->vVelocity.z = v70; |
845 | 1306 if ( v69 >= 100 ) |
0 | 1307 break; |
1308 v26 = stru_721530.prolly_normal_d; | |
1309 } | |
846 | 1310 v58 = ((unsigned int)~pOutdoor->ActuallyGetSomeOtherTileInfo(WorldPosToGridCellX(v66), WorldPosToGridCellZ(v65) - 1) >> 1) & 1; |
1311 v59 = ((unsigned int)~pOutdoor->ActuallyGetSomeOtherTileInfo(WorldPosToGridCellX(v0->vPosition.x), WorldPosToGridCellZ(v0->vPosition.y) - 1) >> 1) & 1; | |
1312 if ( WorldPosToGridCellX(v66) == WorldPosToGridCellX(v0->vPosition.x) | |
845 | 1313 && WorldPosToGridCellZ(v65) == WorldPosToGridCellZ(v0->vPosition.y) |
1314 && v58 | |
1315 || v67 != 0 ) | |
0 | 1316 { |
1317 if ( MonsterStats::BelongsToSupertype(v0->pMonsterInfo.uID, MONSTER_SUPERTYPE_WATER_ELEMENTAL) ) | |
1318 { | |
1319 v58 = v58 == 0; | |
1320 v59 = v59 == 0; | |
1321 } | |
845 | 1322 if ( !uIsFlying && v58 && !v59 ) |
0 | 1323 { |
1324 v0->vPosition.x = v66; | |
1325 v0->vPosition.y = v65; | |
1326 if ( v0->CanAct() ) | |
1327 { | |
1328 v0->uYawAngle -= 32; | |
1329 v0->uCurrentActionTime = 0; | |
1330 v0->uCurrentActionLength = 128; | |
1331 v0->uAIState = Fleeing; | |
1332 } | |
1333 } | |
1334 } | |
845 | 1335 } |
0 | 1336 } |
1337 | |
1338 //----- (0047253E) -------------------------------------------------------- | |
1339 void UpdateObjects() | |
1340 { | |
1341 unsigned int v0; // ebx@0 | |
1342 //unsigned int v1; // edi@1 | |
1083 | 1343 //char *v2; // esi@2 |
0 | 1344 //__int16 v3; // dx@5 |
1345 ObjectDesc *v4; // eax@5 | |
1346 int v5; // ecx@6 | |
1347 __int16 v6; // cx@7 | |
1348 signed int v7; // eax@9 | |
1349 __int16 v8; // cx@14 | |
1350 __int16 v9; // dx@14 | |
1351 unsigned int v10; // ecx@16 | |
1352 signed int v11; // eax@17 | |
1353 int v12; // edi@27 | |
1354 int v13; // eax@27 | |
1355 int v14; // ebx@27 | |
1356 unsigned int v15; // ecx@27 | |
1357 unsigned int v16; // edx@30 | |
1358 unsigned int v17; // edx@32 | |
1359 int v18; // [sp+4h] [bp-10h]@27 | |
1360 int v19; // [sp+8h] [bp-Ch]@27 | |
1361 //signed int v20; // [sp+10h] [bp-4h]@1 | |
1362 | |
1363 //v1 = 0; | |
1364 //v20 = 0; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
1365 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
|
1366 { |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
1367 auto item = &pSpriteObjects[i]; |
1083 | 1368 //v2 = (char *)&item->uSpriteFrameID; |
0 | 1369 //do |
1370 //{ | |
1371 //LOWORD(v0) = item->uAttributes; | |
1372 if (item->uAttributes & 0x40) | |
1373 item->uAttributes &= 0xFFBF; | |
1374 else | |
1375 { | |
1376 //v3 = item->uObjectDescID; | |
1377 v4 = &pObjectList->pObjects[item->uObjectDescID]; | |
430 | 1378 if (item->AttachedToActor()) |
1379 { | |
848 | 1380 v5 = PID_ID(item->spell_target_pid); |
1083 | 1381 item->vPosition.x = pActors[v5].vPosition.x; |
1382 item->vPosition.y = pActors[v5].vPosition.y; | |
1383 item->vPosition.z = pActors[v5].vPosition.z + pActors[v5].uActorHeight; | |
1384 if ( !item->uObjectDescID || (v6 = LOWORD(pEventTimer->uTimeElapsed) + item->uSpriteFrameID, item->uSpriteFrameID = v6, !(v4->uFlags & 4)) ) | |
1385 continue; | |
0 | 1386 if ( v6 >= 0 ) |
1387 { | |
1388 v7 = v4->uLifetime; | |
1389 if (item->uAttributes & 2) | |
1083 | 1390 v7 = item->field_20; |
0 | 1391 if ( v6 < v7 ) |
1083 | 1392 continue; |
1393 } | |
1394 v10 = i; | |
1395 SpriteObject::OnInteraction(v10); | |
1396 continue; | |
0 | 1397 } |
1398 | |
1399 if ( item->uObjectDescID ) | |
1400 { | |
1401 v8 = LOWORD(pEventTimer->uTimeElapsed) + item->uSpriteFrameID; | |
1402 item->uSpriteFrameID = v8; | |
1403 v9 = v4->uFlags; | |
1083 | 1404 if ( v9 & 4 ) |
1405 { | |
1406 if ( v8 < 0 ) | |
1407 { | |
1408 v10 = i; | |
1409 SpriteObject::OnInteraction(v10); | |
1410 continue; | |
1411 } | |
1412 v11 = v4->uLifetime; | |
1413 if (item->uAttributes & 2) | |
1414 v11 = item->field_20; | |
1415 } | |
1416 if ( !(v9 & 4) || v8 < v11 ) | |
1417 { | |
0 | 1418 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
1419 SpriteObject::UpdateObject_fn0_BLV(i); |
0 | 1420 else |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
1421 SpriteObject::UpdateObject_fn0_ODM(i); |
1083 | 1422 if ( pParty->bTurnBasedModeOn != 1 || !(item->uSectorID & 4) ) |
1423 continue; | |
1424 v12 = abs(pParty->vPosition.x - item->vPosition.x); | |
1425 v18 = abs(pParty->vPosition.y - item->vPosition.y); | |
1426 v19 = abs(pParty->vPosition.z - item->vPosition.z); | |
0 | 1427 v13 = v12; |
1428 v14 = v18; | |
1429 v15 = v19; | |
1430 if ( v12 < v18 ) | |
1431 { | |
1432 v13 = v18; | |
1433 v14 = v12; | |
1434 } | |
1435 if ( v13 < v19 ) | |
1436 { | |
1437 v16 = v13; | |
1438 v13 = v19; | |
1439 v15 = v16; | |
1440 } | |
1441 if ( v14 < (signed int)v15 ) | |
1442 { | |
1443 v17 = v15; | |
1444 v15 = v14; | |
1445 v14 = v17; | |
1446 } | |
1447 v0 = (unsigned int)(11 * v14) >> 5; | |
1448 if ( (signed int)(v0 + (v15 >> 2) + v13) <= 5120 ) | |
1083 | 1449 continue; |
0 | 1450 v10 = i; |
1083 | 1451 SpriteObject::OnInteraction(v10); |
1452 continue; | |
0 | 1453 } |
1454 v10 = i; | |
1455 if ( !(v9 & 0x40) ) | |
1083 | 1456 { |
1457 SpriteObject::OnInteraction(v10); | |
1458 continue; | |
1459 } | |
862 | 1460 _46BFFA_check_object_intercept(i, PID(OBJECT_Item,i)); |
0 | 1461 } |
1462 } | |
1463 //v2 += 112; | |
1464 //v1 = v20++ + 1; | |
1465 //} | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
1466 //while ( v20 < (signed int)uNumSpriteObjects ); |
0 | 1467 } |
1468 } | |
1469 | |
1470 //----- (0047272C) -------------------------------------------------------- | |
831 | 1471 int collide_against_floor_approximate(int x, int y, int z, unsigned int *pSectorID, unsigned int *pFaceID) |
0 | 1472 { |
1473 signed int v5; // ebx@1 | |
1474 int result; // eax@1 | |
1475 int v7; // [sp+10h] [bp-8h]@1 | |
1476 signed int v8; // [sp+14h] [bp-4h]@1 | |
1477 | |
1478 v5 = x - 2; | |
1479 v7 = x; | |
1480 v8 = y; | |
1481 *pSectorID = pIndoor->GetSector(x - 2, y, z + 40); | |
783 | 1482 result = collide_against_floor(v5, v8, z + 40, pSectorID, pFaceID); |
0 | 1483 if ( result == -30000 || !*pSectorID ) |
1484 { | |
1485 *pSectorID = pIndoor->GetSector(v7 + 2, v8, z + 40); | |
783 | 1486 result = collide_against_floor(v7 + 2, v8, z + 40, pSectorID, pFaceID); |
0 | 1487 if ( result == -30000 || !*pSectorID ) |
1488 { | |
1489 *pSectorID = pIndoor->GetSector(v7, v8 - 2, z + 40); | |
783 | 1490 result = collide_against_floor(v7, v8 - 2, z + 40, pSectorID, pFaceID); |
0 | 1491 if ( result == -30000 || !*pSectorID ) |
1492 { | |
1493 *pSectorID = pIndoor->GetSector(v7, v8 + 2, z + 40); | |
783 | 1494 result = collide_against_floor(v7, v8 + 2, z + 40, pSectorID, pFaceID); |
0 | 1495 if ( result == -30000 || !*pSectorID ) |
1496 { | |
1497 *pSectorID = pIndoor->GetSector(v7, v8, z + 140); | |
783 | 1498 result = collide_against_floor(v7, v8, z + 140, pSectorID, pFaceID); |
0 | 1499 } |
1500 } | |
1501 } | |
1502 } | |
1503 return result; | |
1504 } | |
1505 | |
1506 //----- (00472866) -------------------------------------------------------- | |
1507 void BLV_ProcessPartyActions() | |
1508 { | |
1509 int v1; // ebx@1 | |
1510 int v2; // edi@1 | |
831 | 1511 //int v6; // eax@18 |
1512 //signed __int64 v8; // qax@27 | |
1513 //int v9; // eax@27 | |
0 | 1514 double v10; // st7@27 |
1515 unsigned int v12; // eax@49 | |
1516 double v13; // st7@50 | |
831 | 1517 //int v14; // eax@51 |
1518 //signed __int64 v15; // qax@53 | |
1519 //double v16; // st7@54 | |
0 | 1520 int v17; // eax@62 |
1521 double v18; // st7@62 | |
1522 int v19; // ST40_4@62 | |
1523 int v20; // eax@65 | |
1524 double v21; // st7@65 | |
1525 int v22; // ST40_4@65 | |
1526 int v23; // eax@66 | |
1527 double v24; // st7@66 | |
1528 int v25; // ST40_4@66 | |
1529 int v26; // eax@67 | |
1530 double v27; // st7@67 | |
1531 int v28; // ST40_4@67 | |
1532 unsigned int v35; // eax@74 | |
1533 int v36; // ecx@88 | |
1534 int new_party_z; // esi@96 | |
1535 int v38; // eax@96 | |
1536 int v39; // ecx@106 | |
1537 int v40; // eax@106 | |
1538 Player **v41; // esi@113 | |
1539 int v42; // eax@120 | |
1540 signed int v43; // ecx@123 | |
1541 BLVFace *v44; // esi@126 | |
1542 PolygonType v45; // al@126 | |
1543 int v46; // ecx@133 | |
1544 char v47; // zf@133 | |
1545 int v48; // eax@133 | |
1546 int v49; // ST40_4@136 | |
1547 int v50; // ST40_4@140 | |
1548 int v51; // eax@140 | |
1549 int v52; // eax@140 | |
1550 signed int v53; // edi@146 | |
1551 int v54; // ebx@146 | |
1552 int v55; // ST30_4@146 | |
1553 AudioPlayer *v56; // ecx@162 | |
1554 SoundID v57; // [sp-20h] [bp-80h]@163 | |
1555 signed int v58; // [sp-1Ch] [bp-7Ch]@161 | |
1556 unsigned int v59; // [sp-18h] [bp-78h]@161 | |
1557 signed int v60; // [sp-14h] [bp-74h]@161 | |
1558 signed int v61; // [sp-10h] [bp-70h]@161 | |
1559 int v62; // [sp-Ch] [bp-6Ch]@161 | |
1560 int v63; // [sp-8h] [bp-68h]@75 | |
1561 unsigned int v64; // [sp-8h] [bp-68h]@161 | |
1562 int v65; // [sp-4h] [bp-64h]@75 | |
1563 int v66; // [sp-4h] [bp-64h]@161 | |
831 | 1564 //int v68; // [sp+10h] [bp-50h]@45 |
0 | 1565 int v69; // [sp+10h] [bp-50h]@140 |
1566 unsigned int uFaceEvent; // [sp+14h] [bp-4Ch]@1 | |
831 | 1567 //signed int v71; // [sp+18h] [bp-48h]@1 |
0 | 1568 signed int v72; // [sp+1Ch] [bp-44h]@1 |
1569 signed int v73; // [sp+20h] [bp-40h]@100 | |
1570 int v74; // [sp+20h] [bp-40h]@140 | |
1571 bool bFeatherFall; // [sp+24h] [bp-3Ch]@15 | |
1572 unsigned int uSectorID; // [sp+28h] [bp-38h]@1 | |
1573 int v78; // [sp+2Ch] [bp-34h]@1 | |
1574 unsigned int uFaceID; // [sp+30h] [bp-30h]@1 | |
1575 int v80; // [sp+34h] [bp-2Ch]@1 | |
1576 int v81; // [sp+38h] [bp-28h]@47 | |
1577 int v82; // [sp+3Ch] [bp-24h]@47 | |
1578 int _view_angle; // [sp+40h] [bp-20h]@47 | |
1579 int bJumping; // [sp+44h] [bp-1Ch]@1 | |
1580 int new_party_y; // [sp+48h] [bp-18h]@1 | |
1581 int new_party_x; // [sp+4Ch] [bp-14h]@1 | |
1582 int party_z; // [sp+50h] [bp-10h]@1 | |
717 | 1583 //int v89; // [sp+58h] [bp-8h]@1 |
0 | 1584 int angle; // [sp+5Ch] [bp-4h]@47 |
1585 | |
1586 uFaceEvent = 0; | |
717 | 1587 //v89 = pParty->uFallSpeed; |
0 | 1588 v1 = 0; |
1589 v2 = 0; | |
1590 new_party_x = pParty->vPosition.x; | |
717 | 1591 new_party_y = pParty->vPosition.y; |
0 | 1592 party_z = pParty->vPosition.z; |
1593 uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z); | |
1594 v72 = 0; | |
1595 v78 = 0; | |
1596 bJumping = 0; | |
792 | 1597 |
1598 uFaceID = -1; | |
831 | 1599 auto floor_level = collide_against_floor(new_party_x, new_party_y, party_z + 40, &uSectorID, &uFaceID); |
792 | 1600 |
0 | 1601 if ( pParty->bFlying ) |
1602 { | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
1603 pParty->bFlying = false; |
0 | 1604 if (pParty->FlyActive()) |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
1605 pOtherOverlayList->pOverlays[pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID - 1].field_E |= 1; |
831 | 1606 } |
1607 | |
1608 if ( floor_level == -30000 || uFaceID == -1) | |
1609 { | |
1610 floor_level = collide_against_floor_approximate(new_party_x, new_party_y, party_z + 40, &uSectorID, &uFaceID); | |
1611 if ( floor_level == -30000 || uFaceID == -1) | |
1612 { | |
1613 __debugbreak(); // level built with errors | |
0 | 1614 pParty->vPosition.x = blv_prev_party_x; |
1615 pParty->vPosition.y = blv_prev_party_z; | |
1616 pParty->vPosition.z = blv_prev_party_y; | |
1617 pParty->uFallStartY = blv_prev_party_y; | |
1618 return; | |
1619 } | |
1620 } | |
831 | 1621 |
0 | 1622 blv_prev_party_x = pParty->vPosition.x; |
1623 blv_prev_party_z = pParty->vPosition.y; | |
1624 blv_prev_party_y = pParty->vPosition.z; | |
1625 if (!pParty->bTurnBasedModeOn) | |
1626 { | |
1627 auto v67 = GetTickCount() / 500; | |
1628 if (dword_720CDC != v67 ) | |
1629 { | |
1285 | 1630 dword_4F8580[3 * dword_4F8580[1]] = pParty->vPosition.x; |
1631 dword_4F8580[3 * dword_4F8580[2]] = pParty->vPosition.y; | |
1632 dword_4F8580[3 * dword_4F8580[3]] = pParty->vPosition.z; | |
0 | 1633 if ( dword_4F8580[0] > 60 ) |
1634 dword_4F8580[0] = 1; | |
1635 } | |
1636 dword_720CDC = v67; | |
1637 } | |
831 | 1638 |
1639 uint fall_start; | |
0 | 1640 if (!pParty->FeatherFallActive()) |
1641 { | |
1642 bFeatherFall = false; | |
1080 | 1643 if (!pParty->pPlayers[0].WearsItem(ITEM_ARTIFACT_LADYS_ESCORT, EQIUP_ANY) && // grants feather fall |
1644 !pParty->pPlayers[1].WearsItem(ITEM_ARTIFACT_LADYS_ESCORT, EQIUP_ANY) && | |
1645 !pParty->pPlayers[2].WearsItem(ITEM_ARTIFACT_LADYS_ESCORT, EQIUP_ANY) && | |
1646 !pParty->pPlayers[3].WearsItem(ITEM_ARTIFACT_LADYS_ESCORT, EQIUP_ANY)) | |
831 | 1647 { |
1648 fall_start = pParty->uFallStartY; | |
1649 } | |
1650 } | |
1651 else | |
1652 { | |
1653 fall_start = floor_level; | |
0 | 1654 bFeatherFall = true; |
831 | 1655 pParty->uFallStartY = floor_level; |
1656 } | |
1657 | |
1658 | |
1659 if (fall_start - party_z > 512 && !bFeatherFall && party_z <= floor_level + 1) | |
1660 { | |
1661 assert(~pParty->uFlags & PARTY_FLAGS_1_LANDING); // why land in indoor? | |
569 | 1662 if (pParty->uFlags & PARTY_FLAGS_1_LANDING) |
1663 pParty->uFlags &= ~PARTY_FLAGS_1_LANDING; | |
0 | 1664 else for (uint i = 0; i < 4; ++i) |
1665 { // receive falling damage | |
831 | 1666 auto player = pParty->pPlayers + i; |
1080 | 1667 if (!player->HasEnchantedItemEquipped(72) && !player->WearsItem(ITEM_ARTIFACT_HERMES_SANDALS, EQUIP_BOOTS)) |
831 | 1668 { |
1036 | 1669 player->ReceiveDamage((pParty->uFallStartY - party_z) * (0.1f * player->GetMaxHealth()) / 256, DMGT_PHISYCAL); |
1670 v10 = (double)(20 - player->GetParameterBonus(player->GetActualEndurance())) * flt_6BE3A4_debug_recmod1 * 2.133333333333333; | |
831 | 1671 player->SetRecoveryTime((signed __int64)v10); |
1672 } | |
1673 } | |
1674 } | |
1675 | |
1676 if ( party_z > floor_level + 1 ) | |
0 | 1677 bJumping = 1; |
831 | 1678 |
1679 bool jumping_up = false; | |
1680 | |
1681 if ( party_z - floor_level <= 32 ) | |
1682 { | |
0 | 1683 pParty->uFallStartY = party_z; |
831 | 1684 jumping_up = true; |
1685 } | |
1686 | |
1687 if (bWalkSound && pParty->walk_sound_timer) | |
1688 { | |
1689 if (pParty->walk_sound_timer > pEventTimer->uTimeElapsed) | |
1690 pParty->walk_sound_timer -= pEventTimer->uTimeElapsed; | |
1691 else pParty->walk_sound_timer = 0; | |
1692 } | |
1693 | |
1694 | |
1695 if (party_z <= floor_level + 1) | |
1696 { | |
1697 party_z = floor_level + 1; | |
1698 pParty->uFallStartY = floor_level + 1; | |
1699 | |
1700 if (!bJumping && pParty->floor_face_pid != uFaceID) | |
1701 { | |
1702 auto pFace = &pIndoor->pFaces[uFaceID]; | |
1703 if (pFace->uAttributes & FACE_PRESSURE_PLATE) | |
1704 uFaceEvent = pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID; | |
1705 } | |
1706 } | |
1707 if (!bJumping) | |
1708 pParty->floor_face_pid = uFaceID; | |
1709 | |
1710 bool on_water = false; | |
1711 if ( pIndoor->pFaces[uFaceID].Fluid()) | |
1712 on_water = true; | |
1713 | |
0 | 1714 v81 = pParty->uWalkSpeed; |
1715 angle = pParty->sRotationY; | |
1716 _view_angle = pParty->sRotationX; | |
831 | 1717 v82 = (unsigned __int64)(pEventTimer->dt_in_some_format * (signed __int64)((signed int)(pParty->y_rotation_speed * stru_5C6E00->uIntegerPi) |
0 | 1718 / 180)) >> 16; |
809 | 1719 //LABEL_87: |
0 | 1720 while ( pPartyActionQueue->uNumActions ) |
1721 { | |
1722 switch ( pPartyActionQueue->Next() ) | |
1723 { | |
1724 case PARTY_TurnLeft: | |
831 | 1725 if (uTurnSpeed) |
1726 angle = stru_5C6E00->uDoublePiMask & (angle + uTurnSpeed); | |
1727 else | |
1728 angle = stru_5C6E00->uDoublePiMask & (angle + (int)(v82 * fTurnSpeedMultiplier)); | |
809 | 1729 break; |
0 | 1730 case PARTY_TurnRight: |
831 | 1731 if (uTurnSpeed) |
809 | 1732 angle = stru_5C6E00->uDoublePiMask & (angle - uTurnSpeed); |
831 | 1733 else |
1734 angle = stru_5C6E00->uDoublePiMask & (angle - (int)(v82 * fTurnSpeedMultiplier)); | |
809 | 1735 break; |
831 | 1736 |
0 | 1737 case PARTY_FastTurnLeft: |
831 | 1738 if (uTurnSpeed) |
1739 angle = stru_5C6E00->uDoublePiMask & (angle + uTurnSpeed); | |
0 | 1740 else |
831 | 1741 angle = stru_5C6E00->uDoublePiMask & (angle + (int)(2.0f * fTurnSpeedMultiplier * (double)v82)); |
809 | 1742 break; |
831 | 1743 |
0 | 1744 case PARTY_FastTurnRight: |
831 | 1745 if (uTurnSpeed) |
1746 angle = stru_5C6E00->uDoublePiMask & (angle - uTurnSpeed); | |
1747 else | |
1748 angle = stru_5C6E00->uDoublePiMask & (angle - (int)(2.0f * fTurnSpeedMultiplier * (double)v82)); | |
809 | 1749 break; |
831 | 1750 |
809 | 1751 case PARTY_StrafeLeft: |
1752 v2 -= (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)((signed int)(signed __int64)((double)v81 * fWalkSpeedMultiplier) >> 1)) >> 16; | |
1753 v1 += (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)((signed int)(signed __int64)((double)v81 * fWalkSpeedMultiplier) >> 1)) >> 16; | |
717 | 1754 v78 = 1; |
809 | 1755 break; |
0 | 1756 case PARTY_StrafeRight: |
809 | 1757 v2 += (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)((signed int)(signed __int64)((double)v81 * fWalkSpeedMultiplier) >> 1)) >> 16; |
1758 v1 -= (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)((signed int)(signed __int64)((double)v81 * fWalkSpeedMultiplier) >> 1)) >> 16; | |
717 | 1759 v78 = 1; |
809 | 1760 break; |
0 | 1761 case PARTY_WalkForward: |
831 | 1762 v2 += (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)(signed int)(signed __int64)(5 * (double)v81 * fWalkSpeedMultiplier)) >> 16; |
1763 v1 += (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)(signed int)(signed __int64)(5 * (double)v81 * fWalkSpeedMultiplier)) >> 16; | |
717 | 1764 v78 = 1; |
809 | 1765 break; |
0 | 1766 case PARTY_WalkBackward: |
809 | 1767 v2 -= (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)(signed int)(signed __int64)((double)v81 * fBackwardWalkSpeedMultiplier)) >> 16; |
1768 v1 -= (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)(signed int)(signed __int64)((double)v81 * fBackwardWalkSpeedMultiplier)) >> 16; | |
0 | 1769 v78 = 1; |
809 | 1770 break; |
0 | 1771 case PARTY_RunForward: |
323 | 1772 v2 += (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)(signed int)(2 * (unsigned __int64)(signed __int64)((double)v81 * fWalkSpeedMultiplier))) >> 16; |
1773 v1 += (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)(signed int)(2 * (unsigned __int64)(signed __int64)((double)v81 * fWalkSpeedMultiplier))) >> 16; | |
0 | 1774 v72 = 1; |
809 | 1775 break; |
0 | 1776 case PARTY_RunBackward: |
1777 //v32 = stru_5C6E00->SinCos(angle); | |
1778 //v33 = (double)v81; | |
1779 //v88 = (double)v81; | |
323 | 1780 v2 -= (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)(signed int)(signed __int64)((double)v81 * fBackwardWalkSpeedMultiplier)) >> 16; |
0 | 1781 //v34 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); |
323 | 1782 v1 -= (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)(signed int)(signed __int64)((double)v81 * fBackwardWalkSpeedMultiplier)) >> 16; |
0 | 1783 v72 = 1; |
807 | 1784 break; |
0 | 1785 case PARTY_LookUp: |
1786 _view_angle += (signed __int64)(flt_6BE150_look_up_down_dangle * 25.0); | |
1787 if ( _view_angle > 128 ) | |
1788 _view_angle = 128; | |
1789 v35 = uActiveCharacter; | |
809 | 1790 if ( uActiveCharacter ) |
1791 pPlayers[v35]->PlaySound((PlayerSpeech)SPEECH_63, 0); | |
717 | 1792 break; |
0 | 1793 case PARTY_LookDown: |
1794 _view_angle += (signed __int64)(flt_6BE150_look_up_down_dangle * -25.0); | |
1795 if ( _view_angle < -128 ) | |
1796 _view_angle = -128; | |
1797 v35 = uActiveCharacter; | |
1798 if ( uActiveCharacter ) | |
717 | 1799 pPlayers[v35]->PlaySound((PlayerSpeech)SPEECH_64, 0); |
0 | 1800 break; |
1801 case PARTY_CenterView: | |
1802 _view_angle = 0; | |
1803 break; | |
1804 case PARTY_Jump: | |
831 | 1805 if ( (!bJumping || party_z <= floor_level + 6 && pParty->uFallSpeed <= 0) && pParty->field_24 ) |
0 | 1806 { |
1807 bJumping = 1; | |
717 | 1808 pParty->uFallSpeed = (signed __int64)((double)(pParty->field_24 << 6) * 1.5 + (double)pParty->uFallSpeed); |
0 | 1809 } |
1810 break; | |
1811 default: | |
809 | 1812 break; |
0 | 1813 } |
1814 } | |
1815 v36 = 0; | |
1816 pParty->sRotationY = angle; | |
1817 pParty->sRotationX = _view_angle; | |
1818 if ( bJumping ) | |
1819 { | |
717 | 1820 pParty->uFallSpeed += -2 * pEventTimer->uTimeElapsed * GetGravityStrength(); |
0 | 1821 } |
1822 else | |
1823 { | |
831 | 1824 if ( pIndoor->pFaces[uFaceID].pFacePlane_old.vNormal.z < 32768 ) |
0 | 1825 { |
717 | 1826 pParty->uFallSpeed -= pEventTimer->uTimeElapsed * GetGravityStrength(); |
0 | 1827 goto LABEL_92; |
1828 } | |
569 | 1829 if (pParty->uFlags & PARTY_FLAGS_1_LANDING) |
0 | 1830 goto LABEL_92; |
717 | 1831 pParty->uFallSpeed = 0; |
1832 } | |
1833 if ( bJumping != v36 && pParty->uFallSpeed <= v36 ) | |
1834 { | |
1835 if ( pParty->uFallSpeed < -500 && !pParty->bFlying ) | |
0 | 1836 { |
1837 v41 = &pPlayers[1]; | |
1838 do | |
1839 { | |
1080 | 1840 if ( !(*v41)->HasEnchantedItemEquipped(72) && !(*v41)->WearsItem(ITEM_ARTIFACT_HERMES_SANDALS, EQUIP_BOOTS) ) //was 8 |
831 | 1841 (*v41)->PlayEmotion(CHARACTER_EXPRESSION_SCARED, 0); |
0 | 1842 ++v41; |
1843 } | |
1844 while ( (signed int)v41 <= (signed int)&pPlayers[4] ); | |
1845 } | |
1846 goto LABEL_93; | |
1847 } | |
1848 LABEL_92: | |
1849 pParty->uFallStartY = party_z; | |
1850 LABEL_93: | |
1851 if ( v2 * v2 + v1 * v1 < 400 ) | |
1852 { | |
1853 v1 = 0; | |
1854 v2 = 0; | |
1855 } | |
1856 stru_721530.field_84 = -1; | |
1857 stru_721530.field_70 = 0; | |
1858 stru_721530.prolly_normal_d = pParty->field_14; | |
1859 stru_721530.field_8 = pParty->field_14 >> 1; | |
1860 auto v83 = 0; | |
1861 stru_721530.field_0 = 1; | |
1862 stru_721530.field_C = pParty->uPartyHeight - 32; | |
1863 while ( 1 ) | |
1864 { | |
1865 new_party_z = party_z; | |
1866 stru_721530.field_34.x = new_party_x; | |
1867 stru_721530.normal.x = new_party_x; | |
1868 stru_721530.field_1C = v2; | |
1869 stru_721530.field_34.y = new_party_y; | |
1870 stru_721530.normal.y = new_party_y; | |
1871 stru_721530.field_20 = v1; | |
1872 stru_721530.normal.z = stru_721530.prolly_normal_d + party_z + 1; | |
1873 stru_721530.field_34.z = stru_721530.field_C + party_z + 1; | |
717 | 1874 stru_721530.field_24 = pParty->uFallSpeed; |
0 | 1875 stru_721530.uSectorID = uSectorID; |
1876 v38 = 0; | |
1340 | 1877 if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->turn_stage == 3 ) |
0 | 1878 v38 = 13312; |
1879 if ( stru_721530._47050A(v38) ) | |
1880 break; | |
1881 v73 = 0; | |
1882 do | |
1883 { | |
1884 _46E44E_collide_against_faces_and_portals(1u); | |
1885 _46E0B2_collide_against_decorations(); | |
1886 for ( v80 = 0; v80 < (signed int)uNumActors; ++v80 ) | |
1887 _46DF1A_collide_against_actor(v80, 0); | |
1888 if ( _46F04E_collide_against_portals() ) | |
1889 break; | |
1890 ++v73; | |
1891 } | |
1892 while ( v73 < 100 ); | |
1893 if ( stru_721530.field_7C >= stru_721530.field_6C ) | |
1894 { | |
1895 v39 = stru_721530.normal2.x; | |
1896 uSectorID = stru_721530.normal2.y; | |
1897 v40 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1; | |
1898 } | |
1899 else | |
1900 { | |
1901 v39 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16) + new_party_x; | |
1902 uSectorID = new_party_y + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16); | |
1903 v40 = new_party_z + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16); | |
1904 } | |
783 | 1905 v42 = collide_against_floor(v39, uSectorID, v40 + 40, &stru_721530.uSectorID, &uFaceID); |
0 | 1906 if ( v42 == -30000 || v42 - new_party_z > 128 ) |
1907 return; | |
1908 if ( stru_721530.field_7C >= stru_721530.field_6C ) | |
1909 { | |
1910 new_party_x = stru_721530.normal2.x; | |
1911 new_party_y = stru_721530.normal2.y; | |
1912 new_party_z = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1; | |
1913 break; | |
1914 } | |
1915 new_party_x += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16; | |
1916 new_party_y += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16; | |
1917 v43 = stru_721530.uFaceID; | |
1918 uSectorID = stru_721530.uSectorID; | |
1919 stru_721530.field_70 += stru_721530.field_7C; | |
1920 auto v87 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16) + new_party_z; | |
848 | 1921 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Actor) |
0 | 1922 { |
1167 | 1923 if ( SHIDWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) >= 0 |
1924 && (SHIDWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime)) ) | |
1925 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); | |
0 | 1926 viewparams->bRedrawGameUI = 1; |
1927 goto LABEL_152; | |
1928 } | |
848 | 1929 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Decoration) |
0 | 1930 { |
295 | 1931 v53 = integer_sqrt(v2 * v2 + v1 * v1); |
0 | 1932 v80 = v53; |
717 | 1933 v54 = stru_5C6E00->Atan2(new_party_x - pLevelDecorations[stru_721530.uFaceID >> 3].vPosition.x, |
0 | 1934 new_party_y - pLevelDecorations[stru_721530.uFaceID >> 3].vPosition.y); |
323 | 1935 v2 = (unsigned __int64)(stru_5C6E00->Cos(v54) * (signed __int64)v53) >> 16; |
1936 v55 = stru_5C6E00->Sin(v54); | |
0 | 1937 v1 = (unsigned __int64)(v55 * (signed __int64)v80) >> 16; |
1938 } | |
1939 else | |
1940 { | |
848 | 1941 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_BModel) |
0 | 1942 { |
1943 v44 = &pIndoor->pFaces[(signed int)stru_721530.uFaceID >> 3]; | |
1944 v45 = v44->uPolygonType; | |
1945 if ( v45 == 3 ) | |
1946 { | |
717 | 1947 if ( pParty->uFallSpeed < 0 ) |
1948 pParty->uFallSpeed = 0; | |
0 | 1949 v87 = pIndoor->pVertices[*v44->pVertexIDs].z + 1; |
1950 if ( pParty->uFallStartY - v87 < 512 ) | |
1951 pParty->uFallStartY = v87; | |
1952 if ( v2 * v2 + v1 * v1 < 400 ) | |
1953 { | |
1954 v1 = 0; | |
1955 v2 = 0; | |
1956 } | |
831 | 1957 if ( pParty->floor_face_pid != PID_ID(v43) && BYTE3(v44->uAttributes) & 4 ) |
717 | 1958 uFaceEvent = pIndoor->pFaceExtras[v44->uFaceExtraID].uEventID; |
1959 goto LABEL_152; | |
1960 } | |
1961 v46 = pParty->uFallSpeed * v44->pFacePlane_old.vNormal.z; | |
0 | 1962 v47 = v45 == 4; |
1963 v48 = v44->pFacePlane_old.vNormal.x; | |
1964 if ( !v47 ) | |
1965 { | |
1966 v80 = abs(v1 * v44->pFacePlane_old.vNormal.y + v46 + v2 * v48) >> 16; | |
1967 if ( stru_721530.field_64 >> 3 > v80 ) | |
1968 v80 = stru_721530.field_64 >> 3; | |
1969 v50 = (unsigned __int64)(v80 * (signed __int64)v44->pFacePlane_old.vNormal.x) >> 16; | |
1970 v81 = v44->pFacePlane_old.vNormal.y; | |
1971 v81 = (unsigned __int64)(v80 * (signed __int64)v81) >> 16; | |
1972 v82 = v44->pFacePlane_old.vNormal.z; | |
1973 v82 = (unsigned __int64)(v80 * (signed __int64)v82) >> 16; | |
1974 v2 += v50; | |
717 | 1975 pParty->uFallSpeed += v82; |
0 | 1976 v74 = v44->pFacePlane_old.vNormal.z; |
1977 v51 = v44->pFacePlane_old.vNormal.y; | |
1978 v69 = v44->pFacePlane_old.vNormal.x; | |
1979 v80 = v51; | |
1980 v1 += v81; | |
1981 v52 = stru_721530.prolly_normal_d - ((v44->pFacePlane_old.dist + v87 * v74 + new_party_y * v51 + new_party_x * v69) >> 16); | |
1982 if ( v52 > 0 ) | |
1983 { | |
1984 new_party_x += v52 * v69 >> 16; | |
1985 new_party_y += v52 * v80 >> 16; | |
1986 v87 += v52 * v74 >> 16; | |
1987 } | |
1988 v43 = stru_721530.uFaceID; | |
831 | 1989 if ( pParty->floor_face_pid != PID_ID(v43) && BYTE3(v44->uAttributes) & 4 ) |
0 | 1990 uFaceEvent = pIndoor->pFaceExtras[v44->uFaceExtraID].uEventID; |
1991 goto LABEL_152; | |
1992 } | |
1993 v80 = abs(v1 * v44->pFacePlane_old.vNormal.y + v46 + v2 * v48) >> 16; | |
1994 if ( stru_721530.field_64 >> 3 > v80 ) | |
1995 v80 = stru_721530.field_64 >> 3; | |
1996 v49 = (unsigned __int64)(v80 * (signed __int64)v44->pFacePlane_old.vNormal.x) >> 16; | |
1997 v81 = v44->pFacePlane_old.vNormal.y; | |
1998 v81 = (unsigned __int64)(v80 * (signed __int64)v81) >> 16; | |
1999 v82 = v44->pFacePlane_old.vNormal.z; | |
2000 v82 = (unsigned __int64)(v80 * (signed __int64)v82) >> 16; | |
2001 v2 += v49; | |
2002 v1 += v81; | |
717 | 2003 pParty->uFallSpeed += v82; |
0 | 2004 if ( v2 * v2 + v1 * v1 >= 400 ) |
717 | 2005 { |
2006 v43 = stru_721530.uFaceID; | |
831 | 2007 if ( pParty->floor_face_pid != PID_ID(v43) && BYTE3(v44->uAttributes) & 4 ) |
717 | 2008 uFaceEvent = pIndoor->pFaceExtras[v44->uFaceExtraID].uEventID; |
2009 goto LABEL_152; | |
2010 } | |
0 | 2011 v2 = 0; |
2012 v1 = 0; | |
717 | 2013 pParty->uFallSpeed = 0; |
0 | 2014 } |
2015 } | |
2016 LABEL_152: | |
2017 v2 = (unsigned __int64)(58500i64 * v2) >> 16; | |
2018 v1 = (unsigned __int64)(58500i64 * v1) >> 16; | |
2019 ++v83; | |
717 | 2020 pParty->uFallSpeed = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16; |
0 | 2021 if ( v83 >= 100 ) |
2022 { | |
2023 new_party_z = v87; | |
2024 break; | |
2025 } | |
2026 } | |
831 | 2027 if ( bWalkSound && !pParty->walk_sound_timer) |
0 | 2028 { |
295 | 2029 if ( integer_sqrt((pParty->vPosition.x - new_party_x) * (pParty->vPosition.x - new_party_x) + (pParty->vPosition.y - new_party_y) |
717 | 2030 * (pParty->vPosition.y - new_party_y) + (pParty->vPosition.z - new_party_z) |
2031 * (pParty->vPosition.z - new_party_z)) <= 16 ) | |
0 | 2032 goto LABEL_188; |
831 | 2033 if ( v72 && (!bJumping || jumping_up) ) |
0 | 2034 { |
2035 v66 = 0; | |
2036 v64 = 0; | |
2037 v62 = 0; | |
2038 v61 = 0; | |
2039 v60 = -1; | |
2040 v59 = 1; | |
2041 v58 = 804; | |
831 | 2042 if ( !on_water ) |
0 | 2043 { |
2044 v56 = pAudioPlayer; | |
2045 if ( BYTE2(pIndoor->pFaces[uFaceID].uAttributes) & 0x20 ) | |
2046 v57 = (SoundID)50; | |
2047 else | |
2048 v57 = (SoundID)64; | |
2049 goto LABEL_175; | |
2050 } | |
2051 v57 = (SoundID)63; | |
2052 v56 = pAudioPlayer; | |
2053 goto LABEL_175; | |
2054 } | |
831 | 2055 if ( v78 && (!bJumping || jumping_up) ) |
0 | 2056 { |
2057 v66 = 0; | |
2058 v64 = 0; | |
2059 v62 = 0; | |
2060 v61 = 0; | |
2061 v60 = -1; | |
2062 v59 = 1; | |
2063 v58 = 804; | |
831 | 2064 if ( on_water ) |
0 | 2065 { |
2066 v57 = (SoundID)102; | |
717 | 2067 v56 = pAudioPlayer; |
2068 goto LABEL_175; | |
0 | 2069 } |
2070 v56 = pAudioPlayer; | |
2071 if ( BYTE2(pIndoor->pFaces[uFaceID].uAttributes) & 0x20 ) | |
2072 v57 = (SoundID)89; | |
2073 else | |
2074 v57 = (SoundID)103; | |
2075 LABEL_175: | |
2076 pAudioPlayer->PlaySound(v57, v58, v59, v60, v61, v62, v64, v66); | |
2077 } | |
2078 else | |
2079 { | |
2080 LABEL_188: | |
2081 pAudioPlayer->_4AA258(804); | |
831 | 2082 pParty->walk_sound_timer = 64; |
2083 } | |
2084 } | |
2085 if ( !bJumping || jumping_up ) | |
569 | 2086 pParty->uFlags &= ~PARTY_FLAGS_1_FALLING; |
2087 else | |
2088 pParty->uFlags |= PARTY_FLAGS_1_FALLING; | |
2089 pParty->uFlags &= ~0x200; | |
0 | 2090 pParty->vPosition.x = new_party_x; |
2091 pParty->vPosition.z = new_party_z; | |
2092 pParty->vPosition.y = new_party_y; | |
717 | 2093 //pParty->uFallSpeed = v89; |
0 | 2094 if ( !bJumping && BYTE3(pIndoor->pFaces[uFaceID].uAttributes) & 0x40 ) |
569 | 2095 pParty->uFlags |= 0x200; |
0 | 2096 if (uFaceEvent) |
2097 EventProcessor(uFaceEvent, 0, 1); | |
2098 } | |
2099 | |
2100 //----- (00473893) -------------------------------------------------------- | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
2101 void ODM_ProcessPartyActions() |
0 | 2102 { |
138 | 2103 //int _zero; // esi@1 |
0 | 2104 int v1; // edi@1 |
2105 int v2; // ebx@1 | |
2106 int v3; // eax@14 | |
141 | 2107 //Player **v4; // esi@21 |
2108 //int v5; // eax@24 | |
0 | 2109 int v6; // esi@45 |
2110 ODMFace *v7; // ecx@45 | |
122 | 2111 //unsigned int v8; // eax@71 |
139 | 2112 //double v9; // st7@72 |
122 | 2113 //signed __int64 v10; // qax@74 |
139 | 2114 //double v11; // st7@75 |
2115 //int v12; // ecx@77 | |
2116 //int v13; // eax@84 | |
2117 //double v14; // st7@84 | |
2118 //int v15; // eax@87 | |
2119 //double v16; // st7@87 | |
140 | 2120 //int v17; // eax@88 |
2121 //double v18; // st7@88 | |
2122 //int v19; // eax@89 | |
2123 //double v20; // st7@89 | |
2124 //int v21; // eax@92 | |
2125 //double v22; // st7@92 | |
2126 //int v23; // eax@96 | |
2127 //double v24; // st7@96 | |
2128 //int v25; // eax@97 | |
2129 //double v26; // st7@97 | |
2130 //int v27; // eax@98 | |
2131 //double v28; // st7@98 | |
2132 //signed __int64 v29; // qax@98 | |
2133 //unsigned int v30; // eax@103 | |
0 | 2134 int v31; // eax@130 |
141 | 2135 //int v32; // ecx@141 |
0 | 2136 signed int v33; // eax@143 |
2137 int v34; // esi@143 | |
141 | 2138 int v35; // esi@147 |
0 | 2139 int v36; // eax@155 |
2140 signed int v37; // esi@159 | |
2141 signed int v38; // eax@159 | |
2142 signed int i; // esi@159 | |
2143 int v40; // esi@162 | |
141 | 2144 //Player **v41; // esi@172 |
0 | 2145 bool v42; // eax@180 |
2146 signed int v43; // ecx@184 | |
2147 signed int v44; // edx@184 | |
2148 int v45; // ecx@200 | |
2149 BSPModel *v46; // eax@203 | |
2150 ODMFace *v47; // esi@203 | |
2151 int v48; // eax@203 | |
2152 char v49; // zf@203 | |
2153 char v50; // sf@203 | |
2154 unsigned __int8 v51; // of@203 | |
2155 int v52; // eax@203 | |
2156 unsigned __int8 v53; // dl@205 | |
2157 BSPModel *v54; // eax@215 | |
2158 int v55; // eax@217 | |
2159 signed int v56; // ebx@228 | |
2160 int v57; // eax@228 | |
2161 BSPModel *v58; // eax@228 | |
2162 unsigned __int64 v59; // qax@228 | |
2163 BSPModel *v60; // eax@228 | |
2164 unsigned __int64 v61; // qax@228 | |
2165 int v62; // eax@241 | |
2166 signed int v63; // ST04_4@255 | |
2167 signed int v64; // eax@255 | |
2168 unsigned int v65; // ebx@263 | |
2169 unsigned int v66; // esi@263 | |
2170 int v67; // eax@263 | |
2171 signed int v68; // ecx@263 | |
2172 int v69; // eax@263 | |
2173 int v70; // ebx@271 | |
2174 int v71; // esi@271 | |
2175 int v72; // edi@271 | |
2176 int v73; // eax@271 | |
2177 Player **v74; // esi@283 | |
2178 int v75; // eax@284 | |
2179 unsigned int v76; // edi@293 | |
2180 bool v77; // edx@297 | |
2181 bool v78; // ecx@303 | |
2182 int v79; // ecx@314 | |
2183 __int16 v80; // dx@317 | |
2184 int v81; // ebx@318 | |
2185 int v82; // ecx@318 | |
2186 int v83; // eax@321 | |
2187 Player **v84; // esi@333 | |
2188 int v85; // eax@334 | |
2189 int v86; // [sp-20h] [bp-B4h]@246 | |
2190 int v87; // [sp-20h] [bp-B4h]@248 | |
2191 signed int v88; // [sp-1Ch] [bp-B0h]@246 | |
2192 unsigned int v89; // [sp-18h] [bp-ACh]@246 | |
2193 signed int v90; // [sp-14h] [bp-A8h]@246 | |
2194 signed int v91; // [sp-10h] [bp-A4h]@246 | |
2195 int v92; // [sp-Ch] [bp-A0h]@246 | |
140 | 2196 //int v93; // [sp-8h] [bp-9Ch]@104 |
0 | 2197 unsigned int v94; // [sp-8h] [bp-9Ch]@246 |
140 | 2198 //int v95; // [sp-4h] [bp-98h]@104 |
0 | 2199 int v96; // [sp-4h] [bp-98h]@246 |
2200 int v97; // [sp+Ch] [bp-88h]@180 | |
138 | 2201 Vec3_int_ v98; |
2202 //int v98; // [sp+10h] [bp-84h]@147 | |
2203 //int v99; // [sp+14h] [bp-80h]@147 | |
2204 //int v100; // [sp+18h] [bp-7Ch]@147 | |
0 | 2205 bool v101; // [sp+1Ch] [bp-78h]@33 |
2206 int v102; // [sp+20h] [bp-74h]@1 | |
2207 int v103; // [sp+24h] [bp-70h]@1 | |
2208 int bFeatherFall; // [sp+28h] [bp-6Ch]@4 | |
2209 int v105; // [sp+2Ch] [bp-68h]@24 | |
2210 int bWaterWalk; // [sp+30h] [bp-64h]@1 | |
2211 bool v107; // [sp+34h] [bp-60h]@30 | |
2212 int v108; // [sp+38h] [bp-5Ch]@1 | |
2213 int v109; // [sp+3Ch] [bp-58h]@28 | |
2214 int v110; // [sp+40h] [bp-54h]@180 | |
2215 int v111; // [sp+44h] [bp-50h]@14 | |
2216 int bJumping; // [sp+48h] [bp-4Ch]@1 | |
2217 int v113; // [sp+4Ch] [bp-48h]@1 | |
2218 unsigned int v114; // [sp+50h] [bp-44h]@1 | |
2219 int _walk_speed; // [sp+54h] [bp-40h]@48 | |
723 | 2220 int pX; // [sp+58h] [bp-3Ch]@1 |
2221 int pY; // [sp+5Ch] [bp-38h]@1 | |
0 | 2222 int v118; // [sp+60h] [bp-34h]@1 |
122 | 2223 //Player **v119; // [sp+64h] [bp-30h]@4 |
0 | 2224 int _angle_x; // [sp+68h] [bp-2Ch]@48 |
2225 int v121; // [sp+6Ch] [bp-28h]@1 | |
2226 unsigned int v122; // [sp+70h] [bp-24h]@180 | |
723 | 2227 int pZ; // [sp+74h] [bp-20h]@1 |
0 | 2228 int v124; // [sp+78h] [bp-1Ch]@1 |
2229 int _angle_y; // [sp+7Ch] [bp-18h]@48 | |
2230 int v126; // [sp+80h] [bp-14h]@48 | |
2231 BSPModel *v127; // [sp+84h] [bp-10h]@1 | |
2232 int v128; // [sp+88h] [bp-Ch]@1 | |
2233 int v129; // [sp+8Ch] [bp-8h]@92 | |
2234 int v130; // [sp+90h] [bp-4h]@14 | |
2235 | |
2236 v121 = pParty->uFallSpeed; | |
723 | 2237 pZ = pParty->vPosition.z; |
0 | 2238 v1 = 0; |
2239 v103 = 0; | |
2240 v2 = 0; | |
1061 | 2241 //*(float *)&v128 = 0.0; |
2242 v128 = 0; | |
2243 v129 = 0; | |
723 | 2244 pX = pParty->vPosition.x; |
2245 pY = pParty->vPosition.y; | |
0 | 2246 v113 = pParty->field_6F0; |
2247 bJumping = 0; | |
138 | 2248 auto partyAtHighSlope = IsTerrainSlopeTooHigh(pParty->vPosition.x, pParty->vPosition.y); |
0 | 2249 v114 = 0; |
2250 v124 = 0; | |
2251 v108 = 0; | |
2252 v102 = 0; | |
2253 v127 = 0; | |
2254 bWaterWalk = 0; | |
122 | 2255 if (!pParty->FeatherFallActive()) |
2256 //SHIDWORD(pParty->pPartyBuffs[5].uExpireTime) < 0 | |
2257 //|| SHIDWORD(pParty->pPartyBuffs[5].uExpireTime) <= 0 && LODWORD(pParty->pPartyBuffs[5].uExpireTime) <= 0 ) | |
0 | 2258 { |
2259 bFeatherFall = 0; | |
122 | 2260 /*v119 = &pPlayers[1]; |
0 | 2261 while ( !(*v119)->WearsItem(536, 16) ) |
2262 { | |
2263 ++v119; | |
2264 if ( (signed int)v119 > (signed int)&pPlayers[4] ) | |
2265 goto LABEL_9; | |
122 | 2266 }*/ |
2267 for (int i = 0; i < 4; ++i) | |
1080 | 2268 if (pParty->pPlayers[i].WearsItem(ITEM_ARTIFACT_LADYS_ESCORT, EQIUP_ANY)) // seems like flying boots |
122 | 2269 { |
2270 bFeatherFall = 1; | |
2271 break; | |
2272 } | |
2273 } | |
889 | 2274 else |
2275 { | |
2276 bFeatherFall = 1; | |
2277 } | |
122 | 2278 //LABEL_9: |
569 | 2279 pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER; |
122 | 2280 if (pParty->WaterWalkActive()) |
2281 { | |
2282 //LOBYTE(pParty->uFlags) &= 0x7Fu; | |
0 | 2283 bWaterWalk = 1; |
1167 | 2284 *(short *)&stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID + 119] |= 1u; |
122 | 2285 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
|
2286 pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster - 1].sMana <= 0 ) |
0 | 2287 bWaterWalk = 0; |
2288 } | |
723 | 2289 v3 = ODM_GetFloorLevel(pX, pY, pZ, pParty->uPartyHeight, &v130, &v108, bWaterWalk); |
0 | 2290 v111 = v3; |
2291 if ( bFeatherFall ) | |
2292 pParty->uFallStartY = v3; | |
2293 else | |
2294 v3 = pParty->uFallStartY; | |
723 | 2295 if ( v3 - pZ > 512 && !bFeatherFall && pZ <= v111 + 1 ) |
0 | 2296 { |
141 | 2297 if (pParty->uFlags & PARTY_FLAGS_1_LANDING) |
2298 { | |
2299 pParty->uFlags &= ~PARTY_FLAGS_1_LANDING; | |
2300 } | |
2301 else for (int _i = 0; _i < 4; ++_i) // receive falling damage | |
2302 { | |
2303 auto player = pParty->pPlayers + _i; | |
2304 | |
1080 | 2305 if ( !player->HasEnchantedItemEquipped(72) && !player->WearsItem(ITEM_ARTIFACT_HERMES_SANDALS, EQUIP_BOOTS) ) |
141 | 2306 { |
2307 player->ReceiveDamage( | |
723 | 2308 (signed int)((pParty->uFallStartY - pZ) * (unsigned __int64)(player->GetMaxHealth() / 10)) / 256, |
1036 | 2309 DMGT_PHISYCAL); |
2310 v105 = 20 - player->GetParameterBonus(player->GetActualEndurance()); | |
141 | 2311 player->SetRecoveryTime((signed __int64)((double)v105 * flt_6BE3A4_debug_recmod1 * 2.133333333333333)); |
2312 } | |
2313 //} | |
2314 //while ( (signed int)v4 <= (signed int)&pPlayers[4] ); | |
0 | 2315 } |
2316 } | |
2317 v109 = -1; | |
138 | 2318 if ( pParty->bFlying ) |
723 | 2319 v109 = sub_46D8E3(pX, pY, pZ + pParty->uPartyHeight, (int)&v102); |
138 | 2320 v107 = v108 == 0; |
0 | 2321 v105 = v111 + 1; |
723 | 2322 if ( pZ <= v111 + 1 ) |
0 | 2323 { |
2324 v109 = -1; | |
138 | 2325 pParty->bFlying = false; |
0 | 2326 } |
2327 else | |
2328 { | |
2329 bJumping = 1; | |
2330 } | |
723 | 2331 v101 = pZ - v111 <= 32; |
831 | 2332 if ( bWalkSound && pParty->walk_sound_timer) |
2333 { | |
2334 if (pParty->walk_sound_timer >= pEventTimer->uTimeElapsed) | |
2335 pParty->walk_sound_timer -= pEventTimer->uTimeElapsed; | |
2336 else pParty->walk_sound_timer = 0; | |
2337 } | |
141 | 2338 if (!bUnderwater |
1167 | 2339 && SHIDWORD(pParty->pPartyBuffs[PARTY_BUFF_FLY].uExpireTime) <= 0 |
2340 && (SHIDWORD(pParty->pPartyBuffs[PARTY_BUFF_FLY].uExpireTime) < 0 || LODWORD(pParty->pPartyBuffs[PARTY_BUFF_FLY].uExpireTime) <= 0) ) | |
138 | 2341 pParty->bFlying = false; |
2342 if (!bJumping) | |
0 | 2343 { |
831 | 2344 if ( pParty->floor_face_pid != PID(OBJECT_BModel, v108) ) |
0 | 2345 { |
138 | 2346 if (v108) |
0 | 2347 { |
2348 if ( v108 >> 6 < pOutdoor->uNumBModels ) | |
2349 { | |
79 | 2350 v7 = pOutdoor->pBModels[v108 >> 6].pFaces; |
0 | 2351 v6 = v108 & 0x3F; |
79 | 2352 /*if ( *(char *)(v7->pFacePlane.vNormal.x + 308 * v6 + 31) & 4 ) |
0 | 2353 { |
862 | 2354 pParty->field_6F4_packedid = PID(OBJECT_BModel,v108); |
0 | 2355 v103 = *(short *)(v7->pFacePlane.vNormal.x + 308 * v6 + 292); |
79 | 2356 }*/ |
2357 if ( BYTE3(v7[v6].uAttributes) & 4 ) | |
2358 { | |
831 | 2359 pParty->floor_face_pid = PID(OBJECT_BModel, v108); |
79 | 2360 v103 = v7[v6].sCogTriggeredID; |
0 | 2361 } |
2362 } | |
2363 } | |
2364 } | |
831 | 2365 pParty->floor_face_pid = PID(OBJECT_BModel, v108); |
0 | 2366 } |
2367 _walk_speed = pParty->uWalkSpeed; | |
2368 _angle_y = pParty->sRotationY; | |
2369 _angle_x = pParty->sRotationX; | |
2370 v126 = pEventTimer->dt_in_some_format; | |
122 | 2371 /*v119 = (Player **)((unsigned __int64)(pEventTimer->dt_in_some_format |
0 | 2372 * (signed __int64)((signed int)(pParty->field_20_prolly_turn_speed |
2373 * stru_5C6E00->uIntegerPi) | |
122 | 2374 / 180)) >> 16);*/ |
2375 __int64 dturn = (unsigned __int64)(pEventTimer->dt_in_some_format * (signed __int64)((signed int)(pParty->y_rotation_speed * stru_5C6E00->uIntegerPi) / 180)) >> 16; | |
140 | 2376 while (pPartyActionQueue->uNumActions) |
2377 { | |
2378 switch (pPartyActionQueue->Next()) | |
0 | 2379 { |
2380 case PARTY_FlyUp: | |
138 | 2381 { |
2382 if (!pParty->FlyActive() && !bUnderwater) | |
2383 break; | |
2384 | |
2385 pParty->bFlying = false; | |
2386 if (bUnderwater || | |
2387 pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1 || | |
569 | 2388 pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster - 1].sMana > 0 ) |
0 | 2389 { |
2390 if ( pParty->vPosition.z < 4000 || bJumping ) | |
2391 { | |
723 | 2392 pZ += 30; |
0 | 2393 v113 += 30; |
2394 pParty->bFlying = 1; | |
723 | 2395 if ( pZ > 4000 ) |
0 | 2396 { |
723 | 2397 pZ = 4000; |
0 | 2398 v113 = 4000; |
2399 } | |
2400 v1 = 0; | |
2401 v2 = 0; | |
2402 v121 = 0; | |
2403 *(float *)&v128 = 0.0; | |
723 | 2404 if ( v102 && pZ < v109 && (signed int)(pParty->uPartyHeight + pZ) >= v109 ) |
0 | 2405 { |
2406 pParty->field_6E0 = 0; | |
2407 pParty->field_6E4 = 0; | |
2408 pPartyActionQueue->uNumActions = 0; | |
569 | 2409 pParty->uFlags |= PARTY_FLAGS_1_LANDING; |
0 | 2410 pParty->vPosition.z = v109 - pParty->uPartyHeight - 31; |
723 | 2411 pParty->field_6F0 = pZ; |
0 | 2412 pParty->bFlying = 0; |
723 | 2413 pZ = v109 - pParty->uPartyHeight - 31; |
0 | 2414 v113 = pParty->field_6F0; |
2415 } | |
2416 pParty->uFallSpeed = 0; | |
2417 v127 = (BSPModel *)1; | |
2418 } | |
2419 } | |
138 | 2420 } |
2421 break; | |
2422 | |
0 | 2423 case PARTY_FlyDown: |
139 | 2424 if (pParty->FlyActive() || bUnderwater) |
0 | 2425 { |
2426 pParty->bFlying = 0; | |
2427 if ( bUnderwater | |
1167 | 2428 || pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1 |
2429 || pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster - 1].sMana > 0 )//*(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster + 10] > 0 ) | |
0 | 2430 { |
723 | 2431 pZ -= 30; |
0 | 2432 v113 -= 30; |
2433 pParty->uFallSpeed = 0; | |
2434 v121 = 0; | |
2435 pParty->bFlying = 1; | |
2436 v127 = (BSPModel *)1; | |
723 | 2437 if ( pZ <= v111 ) |
0 | 2438 { |
2439 pParty->bFlying = 0; | |
2440 pPartyActionQueue->uNumActions = 0; | |
2441 } | |
2442 } | |
2443 } | |
139 | 2444 break; |
2445 | |
0 | 2446 case PARTY_TurnLeft: |
139 | 2447 if (uTurnSpeed) |
2448 _angle_y += uTurnSpeed; //descrete turn | |
2449 else | |
2450 _angle_y += dturn * fTurnSpeedMultiplier; // time-based smooth turn | |
2451 | |
2452 _angle_y &= stru_5C6E00->uDoublePiMask; | |
2453 break; | |
122 | 2454 |
2455 case PARTY_TurnRight: | |
139 | 2456 if (uTurnSpeed) |
2457 _angle_y -= uTurnSpeed; | |
2458 else | |
2459 _angle_y -= dturn * fTurnSpeedMultiplier; | |
2460 | |
2461 _angle_y &= stru_5C6E00->uDoublePiMask; | |
2462 break; | |
122 | 2463 |
2464 case PARTY_FastTurnLeft: | |
139 | 2465 if (uTurnSpeed) |
2466 _angle_y += uTurnSpeed; | |
2467 else | |
2468 _angle_y += 2.0f * fTurnSpeedMultiplier * (double)dturn; | |
2469 | |
2470 _angle_y &= stru_5C6E00->uDoublePiMask; | |
2471 break; | |
122 | 2472 |
0 | 2473 case PARTY_FastTurnRight: |
139 | 2474 if (!uTurnSpeed) |
2475 _angle_y -= 2.0f * fTurnSpeedMultiplier * (double)dturn; | |
2476 else | |
2477 _angle_y -= uTurnSpeed; | |
2478 | |
2479 _angle_y &= stru_5C6E00->uDoublePiMask; | |
2480 break; | |
122 | 2481 |
0 | 2482 case PARTY_StrafeLeft: |
139 | 2483 { |
2484 *(float *)&v128 = pParty->uWalkSpeed; | |
2485 | |
2486 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0); | |
2487 int dx = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier; | |
2488 v2 -= 3 * dx / 4; | |
2489 | |
2490 float cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0); | |
2491 int dy = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier; | |
2492 v1 += 3 * dy / 4; | |
2493 | |
2494 v128 = v1; | |
2495 v124 = 1; | |
2496 } | |
2497 break; | |
2498 | |
0 | 2499 case PARTY_StrafeRight: |
139 | 2500 { |
2501 *(float *)&v128 = pParty->uWalkSpeed; | |
140 | 2502 |
139 | 2503 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0); |
2504 int dx = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier; | |
2505 v2 += 3 * dx / 4; | |
2506 | |
2507 float cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0); | |
2508 int dy = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier; | |
2509 v1 -= 3 * dy / 4; | |
2510 | |
2511 v128 = v1; | |
2512 v124 = 1; | |
2513 } | |
2514 break; | |
2515 | |
0 | 2516 case PARTY_WalkForward: |
140 | 2517 { |
2518 *(float *)&v128 = _walk_speed; | |
2519 | |
2520 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0), | |
2521 cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0); | |
2522 | |
2523 int dx = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier; | |
433 | 2524 v2 += dx * 12; |
140 | 2525 |
2526 int dy = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier; | |
433 | 2527 v1 += dy * 12; |
140 | 2528 |
139 | 2529 v128 = v1; |
2530 v124 = 1; | |
140 | 2531 } |
139 | 2532 break; |
2533 | |
0 | 2534 case PARTY_RunForward: |
140 | 2535 { |
2536 *(float *)&v128 = _walk_speed; | |
2537 | |
2538 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0), | |
2539 cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0); | |
2540 | |
2541 int dx = cos_y * pParty->uWalkSpeed * fWalkSpeedMultiplier; | |
2542 int dy = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier; | |
2543 | |
2544 if (pParty->bFlying) | |
2545 { | |
2546 v2 += 4 * dx; | |
2547 v1 += 4 * dy; | |
2548 | |
2549 v128 = v1; | |
2550 } | |
2551 else if (partyAtHighSlope && !v108) | |
2552 { | |
2553 v2 += dx; | |
2554 v1 += dy; | |
2555 | |
139 | 2556 v128 = v1; |
2557 v124 = 1; | |
140 | 2558 } |
2559 else | |
2560 { | |
2561 v2 += 2 * dx; | |
2562 v1 += 2 * dy; | |
2563 | |
2564 v128 = v1; | |
2565 v114 = 1; | |
2566 } | |
2567 } | |
2568 break; | |
2569 | |
2570 | |
2571 case PARTY_WalkBackward: | |
2572 { | |
2573 *(float *)&v128 = _walk_speed; | |
2574 | |
2575 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0), | |
2576 cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0); | |
2577 | |
2578 int dx = cos_y * pParty->uWalkSpeed * fBackwardWalkSpeedMultiplier; | |
2579 v2 -= dx; | |
2580 | |
2581 int dy = sin_y * pParty->uWalkSpeed * fBackwardWalkSpeedMultiplier; | |
2582 v1 -= dy; | |
2583 | |
0 | 2584 v128 = v1; |
140 | 2585 v124 = 1; |
2586 } | |
2587 break; | |
2588 | |
139 | 2589 |
0 | 2590 case PARTY_RunBackward: |
140 | 2591 { |
2592 float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0), | |
2593 cos_y = cosf(2 * 3.141592653589 * _angle_y / 2048.0); | |
2594 | |
2595 int dx = cos_y * pParty->uWalkSpeed * fBackwardWalkSpeedMultiplier; | |
2596 int dy = sin_y * pParty->uWalkSpeed * fBackwardWalkSpeedMultiplier; | |
2597 | |
2598 if (pParty->bFlying) | |
2599 { | |
2600 v2 -= 4 * dx; | |
2601 v1 -= 4 * dy; | |
0 | 2602 v128 = v1; |
2603 } | |
2604 else | |
2605 { | |
140 | 2606 v2 -= dx; |
2607 v1 -= dy; | |
2608 | |
0 | 2609 v128 = v1; |
2610 v124 = 1; | |
2611 } | |
140 | 2612 } |
2613 break; | |
2614 | |
2615 | |
2616 case PARTY_CenterView: | |
2617 _angle_x = 0; | |
2618 break; | |
2619 | |
0 | 2620 case PARTY_LookUp: |
2621 _angle_x += (signed __int64)(flt_6BE150_look_up_down_dangle * 25.0); | |
2622 if ( _angle_x > 128 ) | |
2623 _angle_x = 128; | |
140 | 2624 if (uActiveCharacter) |
187 | 2625 pPlayers[uActiveCharacter]->PlaySound(SPEECH_63, 0); |
140 | 2626 break; |
2627 | |
0 | 2628 case PARTY_LookDown: |
2629 _angle_x += (signed __int64)(flt_6BE150_look_up_down_dangle * -25.0); | |
2630 if ( _angle_x < -128 ) | |
2631 _angle_x = -128; | |
140 | 2632 if (uActiveCharacter) |
187 | 2633 pPlayers[uActiveCharacter]->PlaySound(SPEECH_64, 0); |
140 | 2634 break; |
2635 | |
0 | 2636 case PARTY_Jump: |
138 | 2637 if ( (!partyAtHighSlope || v108) && !bJumping && pParty->field_24 && !(pParty->uFlags & 4) && !(BYTE1(pParty->uFlags) & 2) ) |
0 | 2638 { |
2639 v126 = pParty->field_24 << 6; | |
2640 bJumping = 1; | |
2641 v121 = (signed __int64)((double)(pParty->field_24 << 6) * 1.5 + (double)v121); | |
2642 } | |
140 | 2643 break; |
2644 | |
0 | 2645 default: |
140 | 2646 assert(false); |
2647 | |
0 | 2648 case PARTY_Land: |
140 | 2649 if (pParty->bFlying) |
0 | 2650 { |
141 | 2651 pParty->uFlags |= PARTY_FLAGS_1_LANDING; |
0 | 2652 pParty->uFallSpeed = 0; |
2653 } | |
140 | 2654 pParty->bFlying = false; |
0 | 2655 pPartyActionQueue->uNumActions = 0; |
140 | 2656 break; |
2657 } | |
2658 } | |
2659 | |
1061 | 2660 //LABEL_123: |
0 | 2661 pParty->sRotationY = _angle_y; |
2662 pParty->sRotationX = _angle_x; | |
1061 | 2663 if ( pZ < v111 || pParty->bFlying) |
0 | 2664 { |
2665 if ( pParty->bFlying ) | |
2666 { | |
1061 | 2667 //LABEL_130: |
0 | 2668 v31 = GetTickCount(); |
323 | 2669 v126 = stru_5C6E00->Cos(v31); |
0 | 2670 v129 = (unsigned __int64)(4i64 * v126) >> 16; |
723 | 2671 pZ = v113 + v129; |
0 | 2672 if ( v127 ) |
723 | 2673 pZ = v113; |
141 | 2674 if (pParty->FlyActive()) |
1167 | 2675 stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] &= 0xFEu; |
723 | 2676 pParty->uFallStartY = pZ; |
1061 | 2677 //goto LABEL_141; |
2678 } | |
2679 else | |
2680 { | |
2681 if ( v130 && v121 ) | |
2682 sub_42F960_create_object(pX, pY, v111); | |
2683 v121 = 0; | |
2684 pZ = v111; | |
2685 pParty->uFallStartY = v111; | |
2686 v113 = pZ; | |
2687 if (pParty->FlyActive()) | |
1167 | 2688 stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] |= 1u; |
1061 | 2689 |
2690 } | |
2691 } | |
2692 else | |
2693 { | |
2694 v113 = pZ; | |
2695 if (pParty->FlyActive()) | |
1167 | 2696 stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] |= 1u; |
1061 | 2697 } |
2698 //LABEL_141: | |
141 | 2699 if (bJumping && !pParty->bFlying) |
0 | 2700 { |
2701 v33 = -(pEventTimer->uTimeElapsed * GetGravityStrength()); | |
2702 v34 = v121 + 2 * v33; | |
2703 v121 += 2 * v33; | |
1061 | 2704 } |
2705 else if (!partyAtHighSlope) | |
0 | 2706 { |
2707 v34 = v121; | |
1061 | 2708 } |
2709 else if (!bJumping) | |
2710 { | |
2711 if ( !v108 ) | |
2712 { | |
2713 // rolling down the hill | |
2714 // how it's done: you get a little bit pushed in the air along terrain normal, getting in the air | |
2715 // and falling to the gravity, gradually sliding downwards. nice trick | |
2716 pZ = v111; | |
2717 ODM_GetTerrainNormalAt(pX, pY, &v98); | |
2718 v35 = v121 + -8 * pEventTimer->uTimeElapsed * GetGravityStrength(); | |
2719 v129 = abs((signed __int64)v2 * v98.x + (signed __int64)v1 * v98.y + (signed __int64)v35 * v98.z) >> 16; | |
2720 v2 += (unsigned __int64)(v129 * (signed __int64)v98.x) >> 16; | |
2721 v1 += (unsigned __int64)(v129 * (signed __int64)v98.y) >> 16; | |
2722 v34 = v35 + ((unsigned __int64)(v129 * (signed __int64)v98.z) >> 16); | |
2723 v128 = v1; | |
2724 v121 = v34; | |
2725 } | |
2726 } | |
2727 else | |
2728 v34 = v121; | |
2729 | |
2730 //LABEL_164: | |
1070 | 2731 if(bJumping) |
2732 { | |
2733 if ( !bUnderwater && v34 <= 0) | |
2734 { | |
2735 if ( v34 < -500 | |
2736 && !pParty->bFlying | |
2737 && pParty->vPosition.z - v111 > 1000 | |
2738 && !pParty->FeatherFallActive()) | |
2739 { // falling scream | |
2740 for (int i = 0; i < 4; ++i) | |
2741 { | |
2742 auto player = pParty->pPlayers + i; | |
1080 | 2743 if (!player->HasEnchantedItemEquipped(72) && !player->WearsItem(ITEM_ARTIFACT_HERMES_SANDALS, EQUIP_BOOTS) && player->CanAct()) |
1070 | 2744 player->PlaySound(SPEECH_66, 0); |
2745 } | |
2746 } | |
2747 } | |
141 | 2748 } |
2749 else | |
2750 { | |
1061 | 2751 //LABEL_150: |
723 | 2752 pParty->uFallStartY = pZ; |
141 | 2753 } |
2754 | |
138 | 2755 if ( v2 * v2 + v1 * v1 < 400 && !partyAtHighSlope ) |
0 | 2756 { |
2757 *(float *)&v128 = 0.0; | |
2758 v2 = 0; | |
2759 } | |
2760 stru_721530.field_84 = -1; | |
2761 stru_721530.field_70 = 0; | |
2762 stru_721530.prolly_normal_d = pParty->field_14; | |
2763 stru_721530.field_8 = pParty->field_14 >> 1; | |
2764 v126 = 0; | |
2765 stru_721530.field_0 = 1; | |
2766 stru_721530.field_C = pParty->uPartyHeight - 32; | |
2767 do | |
2768 { | |
723 | 2769 stru_721530.field_34.x = pX; |
2770 stru_721530.normal.x = pX; | |
0 | 2771 stru_721530.field_1C = v2; |
723 | 2772 stru_721530.field_34.y = pY; |
2773 stru_721530.normal.y = pY; | |
2774 stru_721530.normal.z = stru_721530.prolly_normal_d + pZ + 1; | |
2775 stru_721530.field_34.z = stru_721530.field_C + pZ + 1; | |
0 | 2776 stru_721530.field_20 = v128; |
2777 stru_721530.field_24 = v121; | |
2778 v36 = 0; | |
2779 stru_721530.uSectorID = 0; | |
1340 | 2780 if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->turn_stage == 3 ) |
0 | 2781 v36 = 13312; |
2782 if ( stru_721530._47050A(v36) ) | |
2783 break; | |
2784 _46E889_collide_against_bmodels(1u); | |
2785 v37 = WorldPosToGridCellZ(pParty->vPosition.y); | |
2786 v38 = WorldPosToGridCellX(pParty->vPosition.x); | |
2787 _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
|
2788 _46ED8A_collide_against_sprite_objects(4u); |
0 | 2789 for ( i = 0; i < (signed int)uNumActors; ++i ) |
2790 _46DF1A_collide_against_actor(i, 0); | |
2791 if ( stru_721530.field_7C >= stru_721530.field_6C ) | |
2792 { | |
2793 _angle_x = stru_721530.normal2.x; | |
2794 _angle_y = stru_721530.normal2.y; | |
2795 v40 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1; | |
2796 } | |
2797 else | |
2798 { | |
723 | 2799 _angle_x = pX + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16); |
2800 _angle_y = pY + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16); | |
0 | 2801 v127 = (BSPModel *)((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16); |
723 | 2802 v40 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16) + pZ; |
0 | 2803 } |
2804 v122 = v40; | |
723 | 2805 ODM_GetFloorLevel(_angle_x, _angle_y, v40, pParty->uPartyHeight, &v130, &v108, 0); |
2806 v129 = ODM_GetFloorLevel(_angle_x, pY, v40, pParty->uPartyHeight, &v130, &v97, 0); | |
2807 auto v119 = ODM_GetFloorLevel(pX, _angle_y, v40, pParty->uPartyHeight, &v130, &v110, 0); | |
2808 v127 = (BSPModel *)IsTerrainSlopeTooHigh(_angle_x, pY); | |
2809 v42 = IsTerrainSlopeTooHigh(pX, _angle_y); | |
0 | 2810 v107 = 0; |
2811 v118 = v42; | |
2812 if ( !v97 && !v110 && !v108 ) | |
2813 v107 = 1; | |
2814 v43 = 1; | |
2815 v44 = 1; | |
2816 if ( bUnderwater || !v107 ) | |
1061 | 2817 { |
2818 pX = _angle_x; | |
2819 if ( v43 ) | |
2820 pY = _angle_y; | |
2821 } | |
2822 else | |
2823 { | |
2824 if ( v127 && v129 > pZ ) | |
2825 v44 = 0; | |
2826 if ( v118 && v119 > pZ ) | |
2827 v43 = 0; | |
2828 if ( v44 ) | |
2829 { | |
2830 pX = _angle_x; | |
2831 if ( v43 ) | |
2832 pY = _angle_y; | |
2833 } | |
2834 else if ( v43 ) | |
2835 pY = _angle_y; | |
2836 else | |
2837 { | |
2838 v127 = (BSPModel *)ODM_GetFloorLevel(_angle_x, _angle_y, v40, pParty->uPartyHeight, &v130, &v108, 0); | |
2839 if ( IsTerrainSlopeTooHigh(_angle_x, _angle_y) && (signed int)v127 <= pZ ) | |
2840 { | |
2841 v43 = 1; | |
2842 pX = _angle_x; | |
2843 if ( v43 ) | |
2844 pY = _angle_y; | |
2845 } | |
2846 } | |
2847 } | |
0 | 2848 if ( stru_721530.field_7C >= stru_721530.field_6C ) |
2849 { | |
2850 if ( !v107 ) | |
2851 { | |
723 | 2852 pX = stru_721530.normal2.x; |
2853 pY = stru_721530.normal2.y; | |
2854 } | |
2855 pZ = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1; | |
0 | 2856 break; |
2857 } | |
2858 stru_721530.field_70 += stru_721530.field_7C; | |
723 | 2859 pX = _angle_x; |
2860 pY = _angle_y; | |
0 | 2861 v45 = stru_721530.uFaceID; |
723 | 2862 pZ = v40; |
848 | 2863 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Actor) |
141 | 2864 { |
2865 if (pParty->Invisible()) | |
2866 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); | |
2867 | |
0 | 2868 viewparams->bRedrawGameUI = 1; |
1061 | 2869 v2 = (unsigned __int64)(58500i64 * v2) >> 16; |
2870 v127 = (BSPModel *)58500; | |
2871 v128 = (unsigned __int64)(58500i64 * v128) >> 16; | |
2872 v122 = (unsigned __int64)(58500i64 * v121) >> 16; | |
2873 ++v126; | |
2874 v121 = (unsigned __int64)(58500i64 * v121) >> 16; | |
2875 continue; | |
2876 } | |
848 | 2877 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Decoration) |
0 | 2878 { |
295 | 2879 v56 = integer_sqrt(v2 * v2 + v128 * v128); |
0 | 2880 v118 = v56; |
2881 v57 = stru_5C6E00->Atan2( | |
2882 _angle_x - pLevelDecorations[(signed int)stru_721530.uFaceID >> 3].vPosition.x, | |
2883 _angle_y - pLevelDecorations[(signed int)stru_721530.uFaceID >> 3].vPosition.y); | |
2884 v129 = v57; | |
323 | 2885 v58 = (BSPModel *)stru_5C6E00->Cos(v57); |
0 | 2886 v127 = v58; |
2887 v59 = (signed int)v58 * (signed __int64)v56; | |
2888 v122 = v59 >> 16; | |
2889 v2 = v59 >> 16; | |
323 | 2890 v60 = (BSPModel *)stru_5C6E00->Sin(v129); |
0 | 2891 v127 = v60; |
2892 v61 = (signed int)v60 * (signed __int64)v118; | |
2893 v122 = v61 >> 16; | |
2894 v128 = v61 >> 16; | |
2895 } | |
2896 else | |
2897 { | |
848 | 2898 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_BModel) |
0 | 2899 { |
2900 pParty->bFlying = 0; | |
2901 v46 = &pOutdoor->pBModels[(signed int)stru_721530.uFaceID >> 9]; | |
2902 v127 = v46; | |
79 | 2903 v47 = &v46->pFaces[((signed int)stru_721530.uFaceID >> 3) & 0x3F]; |
0 | 2904 v48 = v47->pBoundingBox.z2 - v47->pBoundingBox.z1; |
2905 v51 = __OFSUB__(v48, 32); | |
2906 v49 = v48 == 32; | |
2907 v50 = v48 - 32 < 0; | |
2908 v52 = v47->pFacePlane.vNormal.z; | |
2909 v129 = (unsigned __int8)(v50 ^ v51 | v49); | |
122 | 2910 v119 = v52 < 46378; |
0 | 2911 if ( bUnderwater == 1 ) |
2912 v119 = 0; | |
2913 v53 = v47->uPolygonType; | |
2914 if ( v53 == 3 ) | |
2915 { | |
1061 | 2916 if ( v121 < 0 ) |
2917 v121 = 0; | |
2918 pZ = v127->pVertices.pVertices[v47->pVertexIDs[0]].z + 1; | |
2919 if ( v2 * v2 + v128 * v128 < 400 ) | |
2920 { | |
2921 v2 = 0; | |
2922 *(float *)&v128 = 0.0; | |
2923 } | |
2924 if ( pParty->floor_face_pid != v45 && BYTE3(v47->uAttributes) & 4 ) | |
2925 { | |
2926 pParty->floor_face_pid = v45; | |
2927 v103 = v47->sCogTriggeredID; | |
2928 } | |
2929 v2 = (unsigned __int64)(58500i64 * v2) >> 16; | |
2930 v127 = (BSPModel *)58500; | |
2931 v128 = (unsigned __int64)(58500i64 * v128) >> 16; | |
2932 v122 = (unsigned __int64)(58500i64 * v121) >> 16; | |
2933 ++v126; | |
2934 v121 = (unsigned __int64)(58500i64 * v121) >> 16; | |
2935 continue; | |
0 | 2936 } |
2937 if ( !v129 && (v53 != 4 || v119) ) | |
2938 { | |
2939 v118 = abs(v128 * v47->pFacePlane.vNormal.y + v121 * v52 + v2 * v47->pFacePlane.vNormal.x) >> 16; | |
2940 if ( stru_721530.field_64 >> 3 > v118 ) | |
2941 v118 = stru_721530.field_64 >> 3; | |
2942 v129 = v47->pFacePlane.vNormal.x; | |
2943 v129 = (unsigned __int64)(v118 * (signed __int64)v129) >> 16; | |
2944 _walk_speed = v47->pFacePlane.vNormal.y; | |
2945 _walk_speed = (unsigned __int64)(v118 * (signed __int64)_walk_speed) >> 16; | |
2946 v54 = 0; | |
2947 if ( !v119 ) | |
2948 { | |
2949 v127 = (BSPModel *)v47->pFacePlane.vNormal.z; | |
2950 v127 = (BSPModel *)((unsigned __int64)(v118 * (signed __int64)(signed int)v127) >> 16); | |
2951 v54 = v127; | |
2952 } | |
2953 v121 += (int)v54; | |
2954 v128 += _walk_speed; | |
2955 v2 += v129; | |
2956 v55 = stru_721530.prolly_normal_d | |
2957 - ((signed int)(v47->pFacePlane.dist | |
2958 + v122 * v47->pFacePlane.vNormal.z | |
2959 + _angle_y * v47->pFacePlane.vNormal.y | |
2960 + _angle_x * v47->pFacePlane.vNormal.x) >> 16); | |
2961 if ( v55 > 0 ) | |
2962 { | |
723 | 2963 pX = _angle_x + (v47->pFacePlane.vNormal.x * v55 >> 16); |
2964 pY = _angle_y + (v47->pFacePlane.vNormal.y * v55 >> 16); | |
0 | 2965 if ( !v119 ) |
723 | 2966 pZ = v122 + (v47->pFacePlane.vNormal.z * v55 >> 16); |
0 | 2967 } |
1061 | 2968 //LABEL_220: |
2969 v45 = stru_721530.uFaceID; | |
2970 if ( pParty->floor_face_pid != v45 && BYTE3(v47->uAttributes) & 4 ) | |
2971 { | |
2972 pParty->floor_face_pid = v45; | |
2973 v103 = v47->sCogTriggeredID; | |
2974 } | |
2975 v2 = (unsigned __int64)(58500i64 * v2) >> 16; | |
2976 v127 = (BSPModel *)58500; | |
2977 v128 = (unsigned __int64)(58500i64 * v128) >> 16; | |
2978 v122 = (unsigned __int64)(58500i64 * v121) >> 16; | |
2979 ++v126; | |
2980 v121 = (unsigned __int64)(58500i64 * v121) >> 16; | |
2981 continue; | |
0 | 2982 } |
2983 v118 = abs(v128 * v47->pFacePlane.vNormal.y + v121 * v52 + v2 * v47->pFacePlane.vNormal.x) >> 16; | |
2984 if ( stru_721530.field_64 >> 3 > v118 ) | |
2985 v118 = stru_721530.field_64 >> 3; | |
2986 v122 = v47->pFacePlane.vNormal.x; | |
2987 v122 = (unsigned __int64)(v118 * (signed __int64)(signed int)v122) >> 16; | |
2988 v127 = (BSPModel *)v47->pFacePlane.vNormal.y; | |
2989 v127 = (BSPModel *)((unsigned __int64)(v118 * (signed __int64)(signed int)v127) >> 16); | |
2990 v129 = v47->pFacePlane.vNormal.z; | |
2991 v129 = (unsigned __int64)(v118 * (signed __int64)v129) >> 16; | |
2992 v121 += v129; | |
2993 v2 += v122; | |
2994 v128 += (int)v127; | |
2995 if ( v2 * v2 + v128 * v128 >= 400 ) | |
1061 | 2996 { |
2997 v45 = stru_721530.uFaceID; | |
2998 if ( pParty->floor_face_pid != v45 && BYTE3(v47->uAttributes) & 4 ) | |
2999 { | |
3000 pParty->floor_face_pid = v45; | |
3001 v103 = v47->sCogTriggeredID; | |
3002 } | |
3003 v2 = (unsigned __int64)(58500i64 * v2) >> 16; | |
3004 v127 = (BSPModel *)58500; | |
3005 v128 = (unsigned __int64)(58500i64 * v128) >> 16; | |
3006 v122 = (unsigned __int64)(58500i64 * v121) >> 16; | |
3007 ++v126; | |
3008 v121 = (unsigned __int64)(58500i64 * v121) >> 16; | |
3009 continue; | |
3010 } | |
0 | 3011 v2 = 0; |
3012 v121 = 0; | |
3013 *(float *)&v128 = 0.0; | |
3014 } | |
3015 } | |
1061 | 3016 //LABEL_234: |
0 | 3017 v2 = (unsigned __int64)(58500i64 * v2) >> 16; |
3018 v127 = (BSPModel *)58500; | |
3019 v128 = (unsigned __int64)(58500i64 * v128) >> 16; | |
3020 v122 = (unsigned __int64)(58500i64 * v121) >> 16; | |
3021 ++v126; | |
3022 v121 = (unsigned __int64)(58500i64 * v121) >> 16; | |
3023 } | |
3024 while ( v126 < 100 ); | |
831 | 3025 if ( bWalkSound && pParty->walk_sound_timer <= 0 ) |
0 | 3026 { |
723 | 3027 v122 = abs(pParty->vPosition.x - pX); |
3028 v126 = abs(pParty->vPosition.y - pY); | |
3029 v62 = abs(pParty->vPosition.z - pZ); | |
295 | 3030 if ( integer_sqrt(v122 * v122 + v126 * v126 + v62 * v62) < 8 ) |
1061 | 3031 { |
3032 pAudioPlayer->_4AA258(804); | |
3033 pParty->walk_sound_timer = 64; | |
3034 } | |
3035 else | |
3036 { | |
3037 if ( v114 && (!bJumping || v101) ) | |
3038 { | |
3039 if ( !v107 | |
3040 && !(BYTE1(pOutdoor->pBModels[pParty->floor_face_pid >> 9].pFaces[(pParty->floor_face_pid >> 3) & 0x3F].uAttributes) & 0x20) ) | |
3041 { | |
764 | 3042 |
1061 | 3043 v90 = -1; |
3044 v89 = 1; | |
3045 v88 = 804; | |
3046 v87 = 64; | |
3047 pAudioPlayer->PlaySound((SoundID)v87, v88, v89, v90, 0, 0, 0, 0); | |
3048 } | |
3049 else | |
3050 { | |
3051 v90 = -1; | |
3052 v89 = 1; | |
3053 v88 = 804; | |
3054 v86 = 1; | |
3055 //LABEL_255: | |
3056 v63 = WorldPosToGridCellZ(pParty->vPosition.y) - 1; | |
3057 v64 = WorldPosToGridCellX(pParty->vPosition.x); | |
3058 v87 = pOutdoor->GetSoundIdByPosition(v64, v63, v86); | |
3059 pAudioPlayer->PlaySound((SoundID)v87, v88, v89, v90, 0, 0, 0, 0); | |
3060 } | |
3061 } | |
3062 else | |
3063 { | |
3064 if ( v124 && (!bJumping || v101) ) | |
3065 { | |
3066 if ( v107 | |
3067 || BYTE1(pOutdoor->pBModels[pParty->floor_face_pid >> 9].pFaces[(pParty->floor_face_pid >> 3) & 0x3F].uAttributes) & 0x20 ) | |
3068 { | |
764 | 3069 |
1061 | 3070 v90 = -1; |
3071 v89 = 1; | |
3072 v88 = 804; | |
3073 v86 = 0; | |
3074 v63 = WorldPosToGridCellZ(pParty->vPosition.y) - 1; | |
3075 v64 = WorldPosToGridCellX(pParty->vPosition.x); | |
3076 v87 = pOutdoor->GetSoundIdByPosition(v64, v63, v86); | |
3077 pAudioPlayer->PlaySound((SoundID)v87, v88, v89, v90, 0, 0, 0, 0); | |
3078 } | |
3079 else | |
3080 { | |
3081 v90 = -1; | |
3082 v89 = 1; | |
3083 v88 = 804; | |
3084 v87 = 103; | |
3085 //LABEL_257: | |
3086 pAudioPlayer->PlaySound((SoundID)v87, v88, v89, v90, 0, 0, 0, 0); | |
3087 } | |
3088 } | |
3089 else | |
3090 { | |
3091 //LABEL_344: | |
3092 pAudioPlayer->_4AA258(804); | |
3093 pParty->walk_sound_timer = 64; | |
3094 } | |
3095 } | |
0 | 3096 } |
3097 } | |
3098 if ( !bJumping || v101 ) | |
569 | 3099 pParty->uFlags &= ~PARTY_FLAGS_1_FALLING; |
3100 else | |
3101 pParty->uFlags |= PARTY_FLAGS_1_FALLING; | |
0 | 3102 v126 = WorldPosToGridCellX(pParty->vPosition.x); |
3103 v65 = WorldPosToGridCellZ(pParty->vPosition.y) - 1; | |
723 | 3104 v114 = WorldPosToGridCellX(pX); |
3105 v66 = WorldPosToGridCellZ(pY) - 1; | |
0 | 3106 v127 = (BSPModel *)(((unsigned int)~pOutdoor->ActuallyGetSomeOtherTileInfo(v126, v65) >> 1) & 1); |
3107 v122 = ((unsigned int)~pOutdoor->ActuallyGetSomeOtherTileInfo(v114, v65) >> 1) & 1; | |
3108 v67 = pOutdoor->ActuallyGetSomeOtherTileInfo(v126, v66); | |
3109 v68 = 0; | |
3110 v69 = ((unsigned int)~v67 >> 1) & 1; | |
3111 if ( v114 == v126 && v66 == v65 && v122 && v69 ) | |
3112 v68 = 1; | |
3113 if ( !v107 ) | |
3114 v68 = 1; | |
3115 if ( v68 ) | |
3116 { | |
723 | 3117 v70 = pZ; |
3118 v71 = pX; | |
3119 v72 = pY; | |
0 | 3120 pParty->uFallSpeed = v121; |
723 | 3121 v73 = pZ; |
3122 pParty->vPosition.x = pX; | |
3123 pParty->vPosition.y = pY; | |
3124 pParty->vPosition.z = pZ; | |
0 | 3125 pParty->field_6F0 = v113; |
723 | 3126 if ( pZ > 8160 ) |
0 | 3127 { |
3128 v73 = 8160; | |
3129 pParty->uFallStartY = 8160; | |
3130 pParty->vPosition.z = 8160; | |
3131 } | |
3132 if ( !v103 | |
3133 || (EventProcessor(v103, 0, 1), pParty->vPosition.x == v71) | |
3134 && pParty->vPosition.y == v72 | |
3135 && (v73 = pParty->vPosition.z, pParty->vPosition.z == v70) ) | |
3136 { | |
3137 if ( v73 < v111 ) | |
3138 { | |
3139 pParty->uFallSpeed = 0; | |
3140 v73 = v105; | |
3141 pParty->vPosition.z = v105; | |
3142 if ( pParty->uFallStartY - v70 > 512 && !bFeatherFall && v70 <= v105 && !bUnderwater ) | |
3143 { | |
569 | 3144 if ( pParty->uFlags & PARTY_FLAGS_1_LANDING ) |
3145 { | |
3146 pParty->uFlags &= ~PARTY_FLAGS_1_LANDING; | |
0 | 3147 } |
3148 else | |
3149 { | |
3150 v74 = &pPlayers[1]; | |
3151 do | |
3152 { | |
3153 v110 = (*v74)->GetMaxHealth(); | |
3154 (*v74)->ReceiveDamage( | |
3155 (signed int)((pParty->uFallStartY - v70) * (unsigned __int64)(signed __int64)((double)v110 * 0.1)) / 256, | |
1036 | 3156 DMGT_PHISYCAL); |
0 | 3157 v75 = (*v74)->GetActualEndurance(); |
1036 | 3158 v110 = 20 - (*v74)->GetParameterBonus(v75); |
0 | 3159 (*v74)->SetRecoveryTime( |
3160 (signed __int64)((double)v110 * flt_6BE3A4_debug_recmod1 * 2.133333333333333)); | |
3161 ++v74; | |
3162 } | |
3163 while ( (signed int)v74 <= (signed int)&pPlayers[4] ); | |
3164 v73 = pParty->vPosition.z; | |
3165 } | |
3166 } | |
3167 pParty->uFallStartY = v70; | |
3168 } | |
3169 if ( v102 && v73 < v109 ) | |
3170 { | |
3171 if ( (signed int)(pParty->uPartyHeight + v73) >= v109 ) | |
3172 { | |
3173 pParty->vPosition.z = v109 - pParty->uPartyHeight - 1; | |
3174 pParty->field_6F0 = v109 - pParty->uPartyHeight - 1; | |
3175 } | |
3176 } | |
569 | 3177 pParty->uFlags &= ~0x204; |
0 | 3178 } |
3179 return; | |
3180 } | |
3181 v76 = pParty->bFlying; | |
3182 if ( pParty->bFlying || v101 == 0 || bWaterWalk || !v127 ) | |
3183 v77 = 1; | |
3184 else | |
3185 v77 = v122 != 0; | |
3186 v114 = 0; | |
3187 if ( !pParty->bFlying && v101 != 0 && !bWaterWalk ) | |
3188 { | |
3189 if ( v127 ) | |
3190 { | |
3191 v78 = v69 != 0; | |
1061 | 3192 } |
3193 else | |
3194 { | |
3195 v114 = 1; | |
3196 v78 = 1; | |
3197 } | |
3198 } | |
3199 else | |
3200 v78 = 1; | |
3201 //LABEL_306: | |
0 | 3202 if ( v77 ) |
3203 { | |
723 | 3204 pParty->vPosition.x = pX; |
0 | 3205 } |
3206 if ( v78 ) | |
3207 { | |
723 | 3208 pParty->vPosition.y = pY; |
1061 | 3209 } |
3210 if ( v78 || v77) | |
3211 { | |
0 | 3212 if ( bWaterWalk ) |
3213 { | |
569 | 3214 pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER; |
1167 | 3215 //v79 = 20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID + 6180178; |
3216 //*(short *)&stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID + 119] |= 1u; | |
3217 v79 = (int)&stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uOverlayID + 119]; | |
569 | 3218 *(short *)v79 |= 1u; |
0 | 3219 if ( !v122 || !v69 ) |
3220 { | |
3221 if ( !v76 ) | |
3222 { | |
3223 v80 = *(short *)v79; | |
569 | 3224 pParty->uFlags |= PARTY_FLAGS_1_STANDING_ON_WATER; |
0 | 3225 *(short *)v79 = v80 & 0xFFFE; |
3226 } | |
3227 } | |
3228 } | |
1061 | 3229 } |
3230 else if ( bWalkSound && pParty->walk_sound_timer <= 0 ) | |
0 | 3231 { |
3232 pAudioPlayer->_4AA258(804); | |
831 | 3233 pParty->walk_sound_timer = 64; |
0 | 3234 } |
1061 | 3235 //LABEL_318: |
723 | 3236 v81 = pZ; |
3237 v82 = pZ; | |
3238 pParty->vPosition.z = pZ; | |
3239 if ( pZ > 8160 ) | |
0 | 3240 { |
3241 v82 = 8160; | |
3242 pParty->uFallStartY = 8160; | |
3243 pParty->vPosition.z = 8160; | |
3244 } | |
3245 LOWORD(pParty->uFlags) &= 0xFDFBu; | |
3246 pParty->uFallSpeed = v121; | |
3247 pParty->field_6F0 = v113; | |
3248 if ( v114 ) | |
3249 { | |
3250 v83 = GetTerrainHeightsAroundParty2(pParty->vPosition.x, pParty->vPosition.y, &v110, 1); | |
3251 v82 = pParty->vPosition.z; | |
3252 if ( pParty->vPosition.z <= v83 ) | |
3253 pParty->uFlags |= 4u; | |
3254 } | |
3255 if ( !v103 | |
723 | 3256 || (EventProcessor(v103, 0, 1), pParty->vPosition.x == pX) |
3257 && pParty->vPosition.y == pY | |
0 | 3258 && (v82 = pParty->vPosition.z, pParty->vPosition.z == v81) ) |
3259 { | |
3260 if ( v82 < v111 ) | |
3261 { | |
3262 v82 = v105; | |
3263 pParty->uFallSpeed = 0; | |
3264 pParty->vPosition.z = v105; | |
3265 if ( pParty->uFallStartY - v81 > 512 && !bFeatherFall && v81 <= v105 && !bUnderwater ) | |
3266 { | |
569 | 3267 if ( pParty->uFlags & PARTY_FLAGS_1_LANDING ) |
3268 { | |
3269 pParty->uFlags &= ~PARTY_FLAGS_1_LANDING; | |
0 | 3270 } |
3271 else | |
3272 { | |
3273 v84 = &pPlayers[1]; | |
3274 do | |
3275 { | |
3276 v110 = (*v84)->GetMaxHealth(); | |
3277 (*v84)->ReceiveDamage( | |
3278 (signed int)((pParty->uFallStartY - v81) * (unsigned __int64)(signed __int64)((double)v110 * 0.1)) / 256, | |
1036 | 3279 DMGT_PHISYCAL); |
0 | 3280 v85 = (*v84)->GetActualEndurance(); |
1036 | 3281 v110 = 20 - (*v84)->GetParameterBonus(v85); |
0 | 3282 (*v84)->SetRecoveryTime((signed __int64)((double)v110 * flt_6BE3A4_debug_recmod1 * 2.133333333333333)); |
3283 ++v84; | |
3284 } | |
3285 while ( (signed int)v84 <= (signed int)&pPlayers[4] ); | |
3286 v82 = pParty->vPosition.z; | |
3287 } | |
3288 } | |
3289 pParty->uFallStartY = v81; | |
3290 } | |
3291 if ( v102 && v82 < v109 && (signed int)(pParty->uPartyHeight + v82) >= v109 ) | |
3292 { | |
3293 pParty->vPosition.z = v82 + pParty->uPartyHeight - v109 + 1; | |
3294 pParty->field_6F0 = v82 + pParty->uPartyHeight - v109 + 1; | |
3295 } | |
3296 } | |
3297 } | |
3298 | |
3299 //----- (0047531C) -------------------------------------------------------- | |
3300 bool __fastcall sub_47531C(int a1, int *a2, int a3, int a4, int a5, int a6, int a7, int a8, BLVFace *a9, int a10) | |
3301 { | |
3302 BLVFace *v10; // ebx@1 | |
3303 int v11; // ST1C_4@3 | |
3304 int v12; // edi@3 | |
3305 int v13; // esi@3 | |
3306 int v14; // edi@4 | |
3307 signed __int64 v15; // qtt@6 | |
3308 __int16 v16; // si@7 | |
3309 int *v18; // [sp+Ch] [bp-Ch]@1 | |
3310 int v19; // [sp+10h] [bp-8h]@1 | |
3311 int a7a; // [sp+30h] [bp+18h]@7 | |
3312 int a9b; // [sp+38h] [bp+20h]@3 | |
3313 int a9a; // [sp+38h] [bp+20h]@3 | |
3314 int a10b; // [sp+3Ch] [bp+24h]@3 | |
3315 signed int a10a; // [sp+3Ch] [bp+24h]@4 | |
3316 int a10c; // [sp+3Ch] [bp+24h]@5 | |
3317 | |
3318 v10 = a9; | |
3319 v18 = a2; | |
3320 v19 = a1; | |
3321 if ( a10 && BYTE3(a9->uAttributes) & 0x20 ) | |
3322 return 0; | |
3323 v11 = (unsigned __int64)(a6 * (signed __int64)a9->pFacePlane_old.vNormal.x) >> 16; | |
3324 a10b = (unsigned __int64)(a7 * (signed __int64)a9->pFacePlane_old.vNormal.y) >> 16; | |
3325 a9b = (unsigned __int64)(a8 * (signed __int64)a9->pFacePlane_old.vNormal.z) >> 16; | |
3326 v12 = v11 + a9b + a10b; | |
3327 a9a = v11 + a9b + a10b; | |
3328 v13 = (a1 << 16) | |
3329 - a3 * v10->pFacePlane_old.vNormal.x | |
3330 - a4 * v10->pFacePlane_old.vNormal.y | |
3331 - a5 * v10->pFacePlane_old.vNormal.z | |
3332 - v10->pFacePlane_old.dist; | |
3333 if ( abs((a1 << 16) | |
3334 - a3 * v10->pFacePlane_old.vNormal.x | |
3335 - a4 * v10->pFacePlane_old.vNormal.y | |
3336 - a5 * v10->pFacePlane_old.vNormal.z - v10->pFacePlane_old.dist) >= a1 << 16 ) | |
3337 { | |
3338 a10c = abs(v13) >> 14; | |
3339 if ( a10c > abs(v12) ) | |
3340 return 0; | |
3341 LODWORD(v15) = v13 << 16; | |
3342 HIDWORD(v15) = v13 >> 16; | |
3343 v14 = v19; | |
3344 a10a = v15 / a9a; | |
3345 } | |
3346 else | |
3347 { | |
3348 a10a = 0; | |
3349 v14 = abs(v13) >> 16; | |
3350 } | |
3351 v16 = a4 + ((unsigned int)((unsigned __int64)(a10a * (signed __int64)a7) >> 16) >> 16); | |
3352 LOWORD(a7a) = (short)a3 | |
3353 + ((unsigned int)((unsigned __int64)(a10a * (signed __int64)a6) >> 16) >> 16) | |
3354 - ((unsigned int)(v14 * v10->pFacePlane_old.vNormal.x) >> 16); | |
3355 HIWORD(a7a) = v16 - ((unsigned int)(v14 * v10->pFacePlane_old.vNormal.y) >> 16); | |
3356 if ( !sub_475665( | |
3357 v10, | |
3358 a7a, | |
3359 (short)a5 | |
3360 + ((unsigned int)((unsigned __int64)(a10a * (signed __int64)a8) >> 16) >> 16) | |
3361 - ((unsigned int)(v14 * v10->pFacePlane_old.vNormal.z) >> 16)) ) | |
3362 return 0; | |
3363 *v18 = a10a >> 16; | |
3364 if ( a10a >> 16 < 0 ) | |
3365 *v18 = 0; | |
3366 return 1; | |
3367 } | |
3368 | |
3369 //----- (004754BF) -------------------------------------------------------- | |
3370 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) | |
3371 { | |
3372 BLVFace *v11; // ebx@1 | |
3373 int v12; // ST1C_4@3 | |
3374 int v13; // edi@3 | |
3375 int v14; // esi@3 | |
3376 int v15; // edi@4 | |
3377 signed __int64 v16; // qtt@6 | |
3378 __int16 v17; // si@7 | |
3379 int *v19; // [sp+Ch] [bp-Ch]@1 | |
3380 int v20; // [sp+10h] [bp-8h]@1 | |
3381 int a7a; // [sp+30h] [bp+18h]@7 | |
3382 int a1b; // [sp+38h] [bp+20h]@3 | |
3383 int a1a; // [sp+38h] [bp+20h]@3 | |
3384 int a11b; // [sp+40h] [bp+28h]@3 | |
3385 signed int a11a; // [sp+40h] [bp+28h]@4 | |
3386 int a11c; // [sp+40h] [bp+28h]@5 | |
3387 | |
3388 v11 = a9; | |
3389 v19 = a2; | |
3390 v20 = a1; | |
3391 if ( a11 && BYTE3(a9->uAttributes) & 0x20 ) | |
3392 return 0; | |
3393 v12 = (unsigned __int64)(a6 * (signed __int64)a9->pFacePlane_old.vNormal.x) >> 16; | |
3394 a11b = (unsigned __int64)(a7 * (signed __int64)a9->pFacePlane_old.vNormal.y) >> 16; | |
3395 a1b = (unsigned __int64)(a8 * (signed __int64)a9->pFacePlane_old.vNormal.z) >> 16; | |
3396 v13 = v12 + a1b + a11b; | |
3397 a1a = v12 + a1b + a11b; | |
3398 v14 = (a1 << 16) | |
3399 - a3 * v11->pFacePlane_old.vNormal.x | |
3400 - a4 * v11->pFacePlane_old.vNormal.y | |
3401 - a5 * v11->pFacePlane_old.vNormal.z | |
3402 - v11->pFacePlane_old.dist; | |
3403 if ( abs((a1 << 16) | |
3404 - a3 * v11->pFacePlane_old.vNormal.x | |
3405 - a4 * v11->pFacePlane_old.vNormal.y | |
3406 - a5 * v11->pFacePlane_old.vNormal.z - v11->pFacePlane_old.dist) >= a1 << 16 ) | |
3407 { | |
3408 a11c = abs(v14) >> 14; | |
3409 if ( a11c > abs(v13) ) | |
3410 return 0; | |
3411 LODWORD(v16) = v14 << 16; | |
3412 HIDWORD(v16) = v14 >> 16; | |
3413 v15 = v20; | |
3414 a11a = v16 / a1a; | |
3415 } | |
3416 else | |
3417 { | |
3418 a11a = 0; | |
3419 v15 = abs(v14) >> 16; | |
3420 } | |
3421 v17 = a4 + ((unsigned int)((unsigned __int64)(a11a * (signed __int64)a7) >> 16) >> 16); | |
3422 LOWORD(a7a) = (short)a3 | |
3423 + ((unsigned int)((unsigned __int64)(a11a * (signed __int64)a6) >> 16) >> 16) | |
3424 - ((unsigned int)(v15 * v11->pFacePlane_old.vNormal.x) >> 16); | |
3425 HIWORD(a7a) = v17 - ((unsigned int)(v15 * v11->pFacePlane_old.vNormal.y) >> 16); | |
3426 if ( !sub_4759C9( | |
3427 v11, | |
3428 a10, | |
3429 a7a, | |
3430 (short)a5 | |
3431 + ((unsigned int)((unsigned __int64)(a11a * (signed __int64)a8) >> 16) >> 16) | |
3432 - ((unsigned int)(v15 * v11->pFacePlane_old.vNormal.z) >> 16)) ) | |
3433 return 0; | |
3434 *v19 = a11a >> 16; | |
3435 if ( a11a >> 16 < 0 ) | |
3436 *v19 = 0; | |
3437 return 1; | |
3438 } | |
3439 | |
3440 //----- (00475665) -------------------------------------------------------- | |
3441 signed int __thiscall sub_475665(BLVFace *_this, int a2, __int16 a3) | |
3442 { | |
3443 unsigned int v3; // eax@1 | |
3444 Vec3_short_ *v4; // edx@3 | |
3445 signed int v5; // eax@4 | |
3446 int v6; // esi@4 | |
3447 signed int v7; // eax@7 | |
3448 Vec3_short_ *v8; // edx@8 | |
3449 signed int v9; // eax@9 | |
3450 int v10; // esi@9 | |
3451 signed int v11; // eax@11 | |
3452 Vec3_short_ *v12; // edx@12 | |
3453 signed int v13; // eax@13 | |
3454 int v14; // esi@13 | |
3455 int v15; // esi@14 | |
3456 bool v16; // edi@14 | |
3457 int v17; // ecx@16 | |
3458 signed int v18; // edx@16 | |
3459 int v19; // eax@17 | |
3460 signed int v20; // ebx@18 | |
3461 int v21; // edi@20 | |
3462 signed int v22; // ST14_4@22 | |
3463 signed __int64 v23; // qtt@22 | |
3464 signed int result; // eax@25 | |
3465 int v25; // [sp+14h] [bp-10h]@14 | |
3466 int v26; // [sp+1Ch] [bp-8h]@2 | |
3467 signed int v27; // [sp+20h] [bp-4h]@2 | |
3468 signed int v28; // [sp+30h] [bp+Ch]@2 | |
3469 signed int v29; // [sp+30h] [bp+Ch]@7 | |
3470 signed int v30; // [sp+30h] [bp+Ch]@11 | |
3471 signed int v31; // [sp+30h] [bp+Ch]@14 | |
3472 | |
3473 v3 = _this->uAttributes; | |
3474 if ( BYTE1(v3) & 1 ) | |
3475 { | |
3476 v28 = 0; | |
3477 v26 = (signed __int16)a2; | |
3478 v27 = SHIWORD(a2); | |
3479 if ( _this->uNumVertices ) | |
3480 { | |
3481 v4 = pIndoor->pVertices; | |
3482 do | |
3483 { | |
3484 v5 = v28; | |
3485 v6 = 2 * v28; | |
3486 word_720C10_intercepts_xs[2 * v28] = _this->pXInterceptDisplacements[v28] + v4[_this->pVertexIDs[v28]].x; | |
3487 word_720B40_intercepts_zs[2 * v28] = _this->pYInterceptDisplacements[v5] + v4[_this->pVertexIDs[v5]].y; | |
3488 word_720C10_intercepts_xs[2 * v28++ + 1] = _this->pXInterceptDisplacements[v5 + 1] | |
3489 + v4[_this->pVertexIDs[v5 + 1]].x; | |
3490 word_720B40_intercepts_zs[v6 + 1] = _this->pYInterceptDisplacements[v5 + 1] + v4[_this->pVertexIDs[v5 + 1]].y; | |
3491 } | |
3492 while ( v28 < _this->uNumVertices ); | |
3493 } | |
3494 } | |
3495 else | |
3496 { | |
3497 if ( BYTE1(v3) & 2 ) | |
3498 { | |
3499 v26 = (signed __int16)a2; | |
3500 v7 = a3; | |
3501 v29 = 0; | |
3502 v27 = v7; | |
3503 if ( _this->uNumVertices ) | |
3504 { | |
3505 v8 = pIndoor->pVertices; | |
3506 do | |
3507 { | |
3508 v9 = v29; | |
3509 v10 = 2 * v29; | |
3510 word_720C10_intercepts_xs[2 * v29] = _this->pXInterceptDisplacements[v29] + v8[_this->pVertexIDs[v29]].x; | |
3511 word_720B40_intercepts_zs[2 * v29] = _this->pZInterceptDisplacements[v9] + v8[_this->pVertexIDs[v9]].z; | |
3512 word_720C10_intercepts_xs[2 * v29++ + 1] = _this->pXInterceptDisplacements[v9 + 1] + v8[_this->pVertexIDs[v9 + 1]].x; | |
3513 word_720B40_intercepts_zs[v10 + 1] = _this->pZInterceptDisplacements[v9 + 1] + v8[_this->pVertexIDs[v9 + 1]].z; | |
3514 } | |
3515 while ( v29 < _this->uNumVertices ); | |
3516 } | |
3517 } | |
3518 else | |
3519 { | |
3520 v26 = SHIWORD(a2); | |
3521 v11 = a3; | |
3522 v30 = 0; | |
3523 v27 = v11; | |
3524 if ( _this->uNumVertices ) | |
3525 { | |
3526 v12 = pIndoor->pVertices; | |
3527 do | |
3528 { | |
3529 v13 = v30; | |
3530 v14 = 2 * v30; | |
3531 word_720C10_intercepts_xs[2 * v30] = _this->pYInterceptDisplacements[v30] + v12[_this->pVertexIDs[v30]].y; | |
3532 word_720B40_intercepts_zs[2 * v30] = _this->pZInterceptDisplacements[v13] + v12[_this->pVertexIDs[v13]].z; | |
3533 word_720C10_intercepts_xs[2 * v30++ + 1] = _this->pYInterceptDisplacements[v13 + 1] + v12[_this->pVertexIDs[v13 + 1]].y; | |
3534 word_720B40_intercepts_zs[v14 + 1] = _this->pZInterceptDisplacements[v13 + 1] + v12[_this->pVertexIDs[v13 + 1]].z; | |
3535 } | |
3536 while ( v30 < _this->uNumVertices ); | |
3537 } | |
3538 } | |
3539 } | |
3540 v15 = 2 * _this->uNumVertices; | |
3541 v31 = 0; | |
3542 word_720C10_intercepts_xs[2 * _this->uNumVertices] = word_720C10_intercepts_xs[0]; | |
3543 word_720B40_intercepts_zs[v15] = word_720B40_intercepts_zs[0]; | |
3544 v25 = 0; | |
3545 v16 = word_720B40_intercepts_zs[0] >= v27; | |
3546 if ( v15 <= 0 ) | |
3547 goto LABEL_29; | |
3548 do | |
3549 { | |
3550 if ( v31 >= 2 ) | |
3551 break; | |
3552 v17 = v25; | |
3553 v18 = word_720B40_intercepts_zs[v25 + 1]; | |
1110 | 3554 if ( v16 ^ (v18 >= v27) ) |
0 | 3555 { |
3556 v19 = word_720C10_intercepts_xs[v17 + 1]; | |
3557 if ( v19 >= v26 ) | |
3558 v20 = 0; | |
3559 else | |
3560 v20 = 2; | |
1110 | 3561 v21 = v20 | (word_720C10_intercepts_xs[v17] < v26); |
0 | 3562 if ( v21 != 3 ) |
3563 { | |
3564 if ( !v21 | |
3565 || (v22 = v19 - word_720C10_intercepts_xs[v17], | |
3566 LODWORD(v23) = v22 << 16, | |
3567 HIDWORD(v23) = v22 >> 16, | |
3568 word_720C10_intercepts_xs[v17] | |
3569 + ((signed int)(((unsigned __int64)(v23 | |
3570 / (v18 - word_720B40_intercepts_zs[v17]) | |
3571 * ((v27 - (signed int)word_720B40_intercepts_zs[v17]) << 16)) >> 16) | |
3572 + 32768) >> 16) >= v26) ) | |
3573 ++v31; | |
3574 } | |
3575 } | |
3576 ++v25; | |
3577 v16 = v18 >= v27; | |
3578 } | |
3579 while ( v25 < v15 ); | |
3580 result = 1; | |
3581 if ( v31 != 1 ) | |
3582 LABEL_29: | |
3583 result = 0; | |
3584 return result; | |
3585 } | |
3586 | |
3587 //----- (004759C9) -------------------------------------------------------- | |
3588 bool __fastcall sub_4759C9(BLVFace *a1, int a2, int a3, __int16 a4) | |
3589 { | |
3590 unsigned int v4; // eax@1 | |
3591 int v5; // edx@4 | |
3592 __int16 v6; // si@4 | |
3593 int v7; // edx@9 | |
3594 __int16 v8; // si@9 | |
3595 int v9; // edx@13 | |
3596 __int16 v10; // si@13 | |
3597 int v11; // esi@14 | |
3598 bool v12; // edi@14 | |
3599 int v13; // ecx@16 | |
3600 signed int v14; // edx@16 | |
3601 int v15; // eax@17 | |
3602 signed int v16; // ebx@18 | |
3603 int v17; // edi@20 | |
3604 signed int v18; // ST14_4@22 | |
3605 signed __int64 v19; // qtt@22 | |
3606 bool result; // eax@25 | |
3607 int v21; // [sp+14h] [bp-10h]@14 | |
3608 signed int v22; // [sp+18h] [bp-Ch]@1 | |
3609 int v23; // [sp+1Ch] [bp-8h]@2 | |
3610 signed int v24; // [sp+20h] [bp-4h]@2 | |
3611 Vec3_int_ **a4a; // [sp+30h] [bp+Ch]@3 | |
3612 Vec3_int_ **a4b; // [sp+30h] [bp+Ch]@8 | |
3613 Vec3_int_ **a4c; // [sp+30h] [bp+Ch]@12 | |
3614 signed int a4d; // [sp+30h] [bp+Ch]@14 | |
3615 | |
3616 v4 = a1->uAttributes; | |
3617 v22 = 0; | |
3618 if ( BYTE1(v4) & 1 ) | |
3619 { | |
3620 v23 = (signed __int16)a3; | |
3621 v24 = SHIWORD(a3); | |
3622 if ( a1->uNumVertices ) | |
3623 { | |
3624 a4a = &pOutdoor->pBModels[a2].pVertices.pVertices; | |
3625 do | |
3626 { | |
3627 v5 = 2 * v22; | |
3628 word_720A70_intercepts_xs_plus_xs[2 * v22] = a1->pXInterceptDisplacements[v22] + LOWORD((*a4a)[a1->pVertexIDs[v22]].x); | |
3629 word_7209A0_intercepts_ys_plus_ys[2 * v22] = a1->pYInterceptDisplacements[v22] + LOWORD((*a4a)[a1->pVertexIDs[v22]].y); | |
3630 word_720A70_intercepts_xs_plus_xs[2 * v22 + 1] = a1->pXInterceptDisplacements[v22 + 1] + LOWORD((*a4a)[a1->pVertexIDs[v22 + 1]].x); | |
3631 word_7209A0_intercepts_ys_plus_ys[v5 + 1] = v6 = a1->pYInterceptDisplacements[v22 + 1] + LOWORD((*a4a)[a1->pVertexIDs[v22 + 1]].y); | |
3632 ++v22; | |
3633 } | |
3634 while ( v22 < a1->uNumVertices ); | |
3635 } | |
3636 } | |
3637 else | |
3638 { | |
3639 if ( BYTE1(v4) & 2 ) | |
3640 { | |
3641 v23 = (signed __int16)a3; | |
3642 v24 = a4; | |
3643 if ( a1->uNumVertices ) | |
3644 { | |
3645 a4b = &pOutdoor->pBModels[a2].pVertices.pVertices; | |
3646 do | |
3647 { | |
3648 v7 = 2 * v22; | |
3649 word_720A70_intercepts_xs_plus_xs[2 * v22] = a1->pXInterceptDisplacements[v22] + LOWORD((*a4b)[a1->pVertexIDs[v22]].x); | |
3650 word_7209A0_intercepts_ys_plus_ys[2 * v22] = a1->pZInterceptDisplacements[v22] + LOWORD((*a4b)[a1->pVertexIDs[v22]].z); | |
3651 word_720A70_intercepts_xs_plus_xs[2 * v22 + 1] = a1->pXInterceptDisplacements[v22 + 1] + LOWORD((*a4b)[a1->pVertexIDs[v22 + 1]].x); | |
3652 word_7209A0_intercepts_ys_plus_ys[v7 + 1] = v8 = a1->pZInterceptDisplacements[v22 + 1] + LOWORD((*a4b)[a1->pVertexIDs[v22 + 1]].z); | |
3653 ++v22; | |
3654 } | |
3655 while ( v22 < a1->uNumVertices ); | |
3656 } | |
3657 } | |
3658 else | |
3659 { | |
3660 v23 = SHIWORD(a3); | |
3661 v24 = a4; | |
3662 if ( a1->uNumVertices ) | |
3663 { | |
3664 a4c = &pOutdoor->pBModels[a2].pVertices.pVertices; | |
3665 do | |
3666 { | |
3667 v9 = 2 * v22; | |
3668 word_720A70_intercepts_xs_plus_xs[2 * v22] = a1->pYInterceptDisplacements[v22] + LOWORD((*a4c)[a1->pVertexIDs[v22]].y); | |
3669 word_7209A0_intercepts_ys_plus_ys[2 * v22] = a1->pZInterceptDisplacements[v22] + LOWORD((*a4c)[a1->pVertexIDs[v22]].z); | |
3670 word_720A70_intercepts_xs_plus_xs[2 * v22 + 1] = a1->pYInterceptDisplacements[v22 + 1] + LOWORD((*a4c)[a1->pVertexIDs[v22 + 1]].y); | |
3671 word_7209A0_intercepts_ys_plus_ys[v9 + 1] = v10 = a1->pZInterceptDisplacements[v22 + 1] + LOWORD((*a4c)[a1->pVertexIDs[v22 + 1]].z); | |
3672 ++v22; | |
3673 } | |
3674 while ( v22 < a1->uNumVertices ); | |
3675 } | |
3676 } | |
3677 } | |
3678 v11 = 2 * a1->uNumVertices; | |
3679 a4d = 0; | |
3680 word_720A70_intercepts_xs_plus_xs[2 * a1->uNumVertices] = word_720A70_intercepts_xs_plus_xs[0]; | |
3681 word_7209A0_intercepts_ys_plus_ys[v11] = word_7209A0_intercepts_ys_plus_ys[0]; | |
3682 v21 = 0; | |
3683 v12 = word_7209A0_intercepts_ys_plus_ys[0] >= v24; | |
3684 if ( v11 <= 0 ) | |
3685 goto LABEL_29; | |
3686 do | |
3687 { | |
3688 if ( a4d >= 2 ) | |
3689 break; | |
3690 v13 = v21; | |
3691 v14 = word_7209A0_intercepts_ys_plus_ys[v21 + 1]; | |
1110 | 3692 if ( v12 ^ (v14 >= v24) ) |
0 | 3693 { |
3694 v15 = word_720A70_intercepts_xs_plus_xs[v13 + 1]; | |
3695 if ( v15 >= v23 ) | |
3696 v16 = 0; | |
3697 else | |
3698 v16 = 2; | |
1110 | 3699 v17 = v16 | (word_720A70_intercepts_xs_plus_xs[v13] < v23); |
0 | 3700 if ( v17 != 3 ) |
3701 { | |
3702 if ( !v17 | |
3703 || (v18 = v15 - word_720A70_intercepts_xs_plus_xs[v13], | |
3704 LODWORD(v19) = v18 << 16, | |
3705 HIDWORD(v19) = v18 >> 16, | |
3706 word_720A70_intercepts_xs_plus_xs[v13] | |
3707 + ((signed int)(((unsigned __int64)(v19 | |
3708 / (v14 - word_7209A0_intercepts_ys_plus_ys[v13]) | |
3709 * ((v24 - (signed int)word_7209A0_intercepts_ys_plus_ys[v13]) << 16)) >> 16) | |
3710 + 32768) >> 16) >= v23) ) | |
3711 ++a4d; | |
3712 } | |
3713 } | |
3714 ++v21; | |
3715 v12 = v14 >= v24; | |
3716 } | |
3717 while ( v21 < v11 ); | |
3718 result = 1; | |
3719 if ( a4d != 1 ) | |
3720 LABEL_29: | |
3721 result = 0; | |
3722 return result; | |
3723 } | |
3724 | |
3725 //----- (00475D85) -------------------------------------------------------- | |
3726 bool __fastcall sub_475D85(Vec3_int_ *a1, Vec3_int_ *a2, int *a3, BLVFace *a4) | |
3727 { | |
3728 BLVFace *v4; // ebx@1 | |
3729 int v5; // ST24_4@2 | |
3730 int v6; // ST28_4@2 | |
3731 int v7; // edi@2 | |
3732 int v8; // eax@5 | |
3733 signed int v9; // esi@5 | |
3734 signed __int64 v10; // qtt@10 | |
3735 Vec3_int_ *v11; // esi@11 | |
3736 int v12; // ST14_4@11 | |
3737 Vec3_int_ *v14; // [sp+Ch] [bp-18h]@1 | |
3738 Vec3_int_ *v15; // [sp+14h] [bp-10h]@1 | |
3739 int v16; // [sp+18h] [bp-Ch]@2 | |
3740 int v17; // [sp+20h] [bp-4h]@10 | |
3741 int a4b; // [sp+30h] [bp+Ch]@2 | |
3742 int a4c; // [sp+30h] [bp+Ch]@9 | |
3743 signed int a4a; // [sp+30h] [bp+Ch]@10 | |
3744 | |
3745 v4 = a4; | |
3746 v15 = a2; | |
3747 v14 = a1; | |
3748 if ( BYTE3(a4->uAttributes) & 0x20 | |
3749 || (v5 = (unsigned __int64)(a2->x * (signed __int64)a4->pFacePlane_old.vNormal.x) >> 16, | |
3750 a4b = (unsigned __int64)(a2->y * (signed __int64)a4->pFacePlane_old.vNormal.y) >> 16, | |
3751 v6 = (unsigned __int64)(a2->z * (signed __int64)v4->pFacePlane_old.vNormal.z) >> 16, | |
3752 v7 = v5 + v6 + a4b, | |
3753 (v16 = v5 + v6 + a4b) == 0) | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
675
diff
changeset
|
3754 || v7 > 0 && !v4->Portal()) |
0 | 3755 return 0; |
3756 v8 = v4->pFacePlane_old.vNormal.z * a1->z; | |
3757 v9 = -(v4->pFacePlane_old.dist + v8 + a1->y * v4->pFacePlane_old.vNormal.y + a1->x * v4->pFacePlane_old.vNormal.x); | |
3758 if ( v7 <= 0 ) | |
3759 { | |
3760 if ( v4->pFacePlane_old.dist + v8 + a1->y * v4->pFacePlane_old.vNormal.y + a1->x * v4->pFacePlane_old.vNormal.x < 0 ) | |
3761 return 0; | |
3762 } | |
3763 else | |
3764 { | |
3765 if ( v9 < 0 ) | |
3766 return 0; | |
3767 } | |
3768 a4c = abs(-(v4->pFacePlane_old.dist + v8 + a1->y * v4->pFacePlane_old.vNormal.y + a1->x * v4->pFacePlane_old.vNormal.x)) >> 14; | |
3769 if ( a4c > abs(v7) | |
3770 || (LODWORD(v10) = v9 << 16, HIDWORD(v10) = v9 >> 16, a4a = v10 / v16, v17 = v10 / v16, v17 > *a3 << 16) | |
3771 || (v11 = v14, | |
3772 LOWORD(v12) = LOWORD(v14->x) | |
3773 + (((unsigned int)((unsigned __int64)(v17 * (signed __int64)v15->x) >> 16) + 32768) >> 16), | |
3774 HIWORD(v12) = LOWORD(v11->y) | |
3775 + (((unsigned int)((unsigned __int64)(v17 * (signed __int64)v15->y) >> 16) + 32768) >> 16), | |
3776 !sub_475665( | |
3777 v4, | |
3778 v12, | |
3779 LOWORD(v11->z) + (((unsigned int)((unsigned __int64)(v17 * (signed __int64)v15->z) >> 16) + 32768) >> 16))) ) | |
3780 return 0; | |
3781 *a3 = a4a >> 16; | |
3782 return 1; | |
3783 } | |
3784 | |
3785 //----- (00475F30) -------------------------------------------------------- | |
3786 bool __fastcall sub_475F30(int *a1, BLVFace *a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9) | |
3787 { | |
3788 BLVFace *v9; // ebx@1 | |
3789 int v10; // ST20_4@2 | |
3790 int v11; // ST28_4@2 | |
3791 int v12; // ST24_4@2 | |
3792 char v13; // zf@2 | |
3793 int v14; // edi@2 | |
3794 int v15; // eax@5 | |
3795 signed int v16; // esi@5 | |
3796 int v17; // ST20_4@9 | |
3797 signed __int64 v18; // qtt@10 | |
3798 int v19; // ST14_4@11 | |
3799 int *v21; // [sp+14h] [bp-10h]@1 | |
3800 int v22; // [sp+1Ch] [bp-8h]@2 | |
3801 int v23; // [sp+1Ch] [bp-8h]@10 | |
3802 signed int v24; // [sp+20h] [bp-4h]@10 | |
3803 | |
3804 v9 = a2; | |
3805 v21 = a1; | |
3806 if ( BYTE3(a2->uAttributes) & 0x20 | |
3807 || (v10 = (unsigned __int64)(a6 * (signed __int64)a2->pFacePlane_old.vNormal.x) >> 16, | |
3808 v11 = (unsigned __int64)(a7 * (signed __int64)a2->pFacePlane_old.vNormal.y) >> 16, | |
3809 v12 = (unsigned __int64)(a8 * (signed __int64)a2->pFacePlane_old.vNormal.z) >> 16, | |
3810 v13 = v10 + v12 + v11 == 0, | |
3811 v14 = v10 + v12 + v11, | |
3812 v22 = v10 + v12 + v11, | |
3813 v13) | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
675
diff
changeset
|
3814 || v14 > 0 && !a2->Portal()) |
0 | 3815 return 0; |
3816 v15 = a4 * a2->pFacePlane_old.vNormal.y; | |
3817 v16 = -(a2->pFacePlane_old.dist + v15 + a3 * a2->pFacePlane_old.vNormal.x + a5 * a2->pFacePlane_old.vNormal.z); | |
3818 if ( v14 <= 0 ) | |
3819 { | |
3820 if ( a2->pFacePlane_old.dist + v15 + a3 * a2->pFacePlane_old.vNormal.x + a5 * a2->pFacePlane_old.vNormal.z < 0 ) | |
3821 return 0; | |
3822 } | |
3823 else | |
3824 { | |
3825 if ( v16 < 0 ) | |
3826 return 0; | |
3827 } | |
3828 v17 = abs(-(a2->pFacePlane_old.dist + v15 + a3 * a2->pFacePlane_old.vNormal.x + a5 * a2->pFacePlane_old.vNormal.z)) >> 14; | |
3829 if ( v17 > abs(v14) | |
3830 || (LODWORD(v18) = v16 << 16, HIDWORD(v18) = v16 >> 16, v24 = v18 / v22, v23 = v18 / v22, v23 > *v21 << 16) | |
3831 || (LOWORD(v19) = a3 + (((unsigned int)((unsigned __int64)(v23 * (signed __int64)a6) >> 16) + 32768) >> 16), | |
3832 HIWORD(v19) = a4 + (((unsigned int)((unsigned __int64)(v23 * (signed __int64)a7) >> 16) + 32768) >> 16), | |
3833 !sub_4759C9( | |
3834 v9, | |
3835 a9, | |
3836 v19, | |
3837 a5 + (((unsigned int)((unsigned __int64)(v23 * (signed __int64)a8) >> 16) + 32768) >> 16))) ) | |
3838 return 0; | |
3839 *v21 = v24 >> 16; | |
3840 return 1; | |
3841 } | |
3842 | |
3843 //----- (004760D5) -------------------------------------------------------- | |
3844 PartyAction ActionQueue::Next() | |
3845 { | |
3846 if (!uNumActions) | |
3847 return PARTY_INVALID; | |
3848 | |
3849 auto result = pActions[0]; | |
3850 for (unsigned int i = 0; i < uNumActions - 1; ++i) | |
3851 pActions[i] = pActions[i + 1]; | |
3852 --uNumActions; | |
3853 | |
3854 return result; | |
3855 } | |
3856 | |
3857 //----- (004775ED) -------------------------------------------------------- | |
3858 int stru6_stru1_indoor_sw_billboard::_4775ED(float a2) | |
3859 { | |
3860 char *v2; // edi@1 | |
3861 int v3; // eax@1 | |
3862 char *v4; // edx@2 | |
3863 char *v5; // esi@3 | |
3864 double v6; // st7@6 | |
3865 signed __int64 v7; // ST84_8@6 | |
3866 double v8; // ST0C_8@6 | |
3867 int v9; // esi@6 | |
3868 double v10; // ST44_8@6 | |
3869 int v11; // ecx@6 | |
3870 double v12; // ST34_8@6 | |
3871 int v13; // ecx@6 | |
3872 double v14; // ST14_8@6 | |
3873 double v15; // st7@8 | |
3874 unsigned int v16; // ecx@8 | |
3875 signed __int64 v17; // ST64_8@8 | |
3876 double v18; // ST24_8@8 | |
3877 int v19; // edi@8 | |
3878 double v20; // ST3C_8@8 | |
3879 int v21; // ecx@8 | |
3880 double v22; // ST2C_8@8 | |
3881 int v23; // ST9C_4@8 | |
3882 double v24; // ST1C_8@8 | |
3883 int *v25; // edi@8 | |
3884 int v26; // esi@8 | |
3885 int *v27; // edi@10 | |
3886 int v28; // esi@10 | |
3887 int result; // eax@12 | |
3888 __int64 v30; // [sp+A8h] [bp-30h]@8 | |
3889 float v31; // [sp+B0h] [bp-28h]@6 | |
3890 float v32; // [sp+B4h] [bp-24h]@6 | |
3891 int v33; // [sp+B8h] [bp-20h]@6 | |
3892 int v34; // [sp+BCh] [bp-1Ch]@2 | |
3893 stru6_stru1_indoor_sw_billboard *v35; // [sp+C0h] [bp-18h]@1 | |
3894 float v36; // [sp+C4h] [bp-14h]@6 | |
3895 int v37; // [sp+C8h] [bp-10h]@6 | |
3896 int v38; // [sp+CCh] [bp-Ch]@1 | |
3897 float v39; // [sp+D0h] [bp-8h]@6 | |
3898 int *v40; // [sp+D4h] [bp-4h]@2 | |
3899 | |
1390 | 3900 v2 = (char *)&this->field_64[4 * this->uNumVertices]; |
0 | 3901 v38 = 0; |
1390 | 3902 *(int *)v2 = this->field_64[0]; |
0 | 3903 v2 += 4; |
1390 | 3904 *(int *)v2 = this->field_64[1]; |
0 | 3905 v2 += 4; |
1390 | 3906 *(int *)v2 = this->field_64[2]; |
3907 *((int *)v2 + 1) = this->field_64[3]; | |
3908 v3 = this->uNumVertices; | |
0 | 3909 v35 = this; |
3910 if ( v3 > 0 ) | |
3911 { | |
1390 | 3912 v40 = &this->field_64[20]; |
3913 v4 = (char *)&this->field_64[3] + 3; | |
0 | 3914 v34 = v3; |
3915 while ( 1 ) | |
3916 { | |
3917 v5 = v4 - 15; | |
3918 if ( *(float *)(v4 - 15) <= (double)a2 && *(float *)(v4 + 1) <= (double)a2 ) | |
3919 goto LABEL_11; | |
3920 if ( *(float *)v5 <= (double)a2 ) | |
3921 break; | |
3922 if ( *(float *)(v4 + 1) <= (double)a2 ) | |
3923 { | |
3924 v15 = (a2 - *(float *)v5) / (*(float *)(v4 + 1) - *(float *)v5); | |
3925 v16 = (unsigned __int8)*v4; | |
3926 HIDWORD(v30) = LODWORD(a2); | |
3927 v17 = (unsigned __int8)v4[16] - v16; | |
3928 v36 = v15; | |
3929 v31 = (*(float *)(v4 + 5) - *(float *)(v4 - 11)) * v15 + *(float *)(v4 - 11); | |
3930 v32 = (*(float *)(v4 + 9) - *(float *)(v4 - 7)) * v15 + *(float *)(v4 - 7); | |
3931 v39 = (double)v17 * v15; | |
3932 v18 = v39 + 6.7553994e15; | |
3933 v19 = (unsigned __int8)*v4; | |
3934 v39 = (double)((unsigned __int8)v4[15] - (unsigned int)(unsigned __int8)*(v4 - 1)) * v36; | |
3935 v20 = v39 + 6.7553994e15; | |
3936 v21 = (unsigned __int8)*(v4 - 2); | |
3937 v37 = LODWORD(v20) + (unsigned __int8)*(v4 - 1); | |
3938 v39 = (double)((unsigned int)(unsigned __int8)v4[14] - v21) * v36; | |
3939 v22 = v39 + 6.7553994e15; | |
3940 v23 = LODWORD(v22) + (unsigned __int8)*(v4 - 2); | |
3941 v39 = (double)((*(int *)(v4 + 13) & 0xFF) - (*(int *)(v4 - 3) & 0xFFu)) * v36; | |
3942 v24 = v39 + 6.7553994e15; | |
3943 v33 = (LODWORD(v24) + (*(int *)(v4 - 3) & 0xFF)) | ((v23 | ((v37 | ((LODWORD(v18) + v19) << 8)) << 8)) << 8); | |
3944 v25 = v40; | |
3945 *v40 = *(int *)v5; | |
3946 v26 = (int)(v5 + 4); | |
3947 ++v25; | |
3948 *v25 = *(int *)v26; | |
3949 v26 += 4; | |
3950 ++v25; | |
3951 ++v38; | |
3952 v40 += 4; | |
3953 *v25 = *(int *)v26; | |
3954 v25[1] = *(int *)(v26 + 4); | |
3955 goto LABEL_9; | |
3956 } | |
3957 LABEL_10: | |
3958 v27 = v40; | |
3959 ++v38; | |
3960 *v40 = *(int *)v5; | |
3961 v28 = (int)(v5 + 4); | |
3962 ++v27; | |
3963 *v27 = *(int *)v28; | |
3964 v28 += 4; | |
3965 ++v27; | |
3966 v40 += 4; | |
3967 *v27 = *(int *)v28; | |
3968 v27[1] = *(int *)(v28 + 4); | |
3969 LABEL_11: | |
3970 v4 += 16; | |
3971 --v34; | |
3972 if ( !v34 ) | |
3973 goto LABEL_12; | |
3974 } | |
3975 v6 = (a2 - *(float *)v5) / (*(float *)(v4 + 1) - *(float *)v5); | |
3976 v7 = (unsigned __int8)v4[16] - (unsigned int)(unsigned __int8)*v4; | |
3977 v36 = v6; | |
3978 v31 = (*(float *)(v4 + 5) - *(float *)(v4 - 11)) * v6 + *(float *)(v4 - 11); | |
3979 v32 = (*(float *)(v4 + 9) - *(float *)(v4 - 7)) * v6 + *(float *)(v4 - 7); | |
3980 *(float *)&v37 = (double)v7 * v6; | |
3981 v8 = *(float *)&v37 + 6.7553994e15; | |
3982 v9 = (unsigned __int8)*v4; | |
3983 *(float *)&v37 = (double)((unsigned __int8)v4[15] - (unsigned int)(unsigned __int8)*(v4 - 1)) * v36; | |
3984 v10 = *(float *)&v37 + 6.7553994e15; | |
3985 v11 = (unsigned __int8)*(v4 - 2); | |
3986 v37 = LODWORD(v10) + (unsigned __int8)*(v4 - 1); | |
3987 v39 = (double)((unsigned int)(unsigned __int8)v4[14] - v11) * v36; | |
3988 v12 = v39 + 6.7553994e15; | |
3989 v13 = LODWORD(v12) + (unsigned __int8)*(v4 - 2); | |
3990 v39 = (double)((*(int *)(v4 + 13) & 0xFF) - (*(int *)(v4 - 3) & 0xFFu)) * v36; | |
3991 v14 = v39 + 6.7553994e15; | |
3992 v33 = (LODWORD(v14) + (*(int *)(v4 - 3) & 0xFF)) | ((v13 | ((v37 | ((LODWORD(v8) + v9) << 8)) << 8)) << 8); | |
3993 LABEL_9: | |
3994 //this = v35; | |
3995 v5 = (char *)&v30 + 4; | |
3996 goto LABEL_10; | |
3997 } | |
3998 LABEL_12: | |
1390 | 3999 return this->uNumVertices = v38; |
0 | 4000 } |
4001 | |
4002 //----- (00477927) -------------------------------------------------------- | |
4003 int stru6_stru1_indoor_sw_billboard::_477927(float a2) | |
4004 { | |
4005 char *v2; // edi@1 | |
4006 int v3; // eax@1 | |
4007 char *v4; // edx@2 | |
4008 char *v5; // esi@3 | |
4009 double v6; // st7@6 | |
4010 signed __int64 v7; // ST84_8@6 | |
4011 double v8; // ST0C_8@6 | |
4012 int v9; // esi@6 | |
4013 double v10; // ST44_8@6 | |
4014 int v11; // ecx@6 | |
4015 double v12; // ST34_8@6 | |
4016 int v13; // ecx@6 | |
4017 double v14; // ST14_8@6 | |
4018 double v15; // st7@8 | |
4019 unsigned int v16; // ecx@8 | |
4020 signed __int64 v17; // ST64_8@8 | |
4021 double v18; // ST24_8@8 | |
4022 int v19; // edi@8 | |
4023 double v20; // ST3C_8@8 | |
4024 int v21; // ecx@8 | |
4025 double v22; // ST2C_8@8 | |
4026 int v23; // ST9C_4@8 | |
4027 double v24; // ST1C_8@8 | |
4028 int *v25; // edi@8 | |
4029 int v26; // esi@8 | |
4030 int *v27; // edi@10 | |
4031 int v28; // esi@10 | |
4032 int result; // eax@12 | |
4033 __int64 v30; // [sp+A8h] [bp-30h]@8 | |
4034 float v31; // [sp+B0h] [bp-28h]@6 | |
4035 float v32; // [sp+B4h] [bp-24h]@6 | |
4036 int v33; // [sp+B8h] [bp-20h]@6 | |
4037 int v34; // [sp+BCh] [bp-1Ch]@2 | |
4038 stru6_stru1_indoor_sw_billboard *v35; // [sp+C0h] [bp-18h]@1 | |
4039 float v36; // [sp+C4h] [bp-14h]@6 | |
4040 int v37; // [sp+C8h] [bp-10h]@6 | |
4041 int v38; // [sp+CCh] [bp-Ch]@1 | |
4042 float v39; // [sp+D0h] [bp-8h]@6 | |
4043 int *v40; // [sp+D4h] [bp-4h]@2 | |
4044 | |
1390 | 4045 v2 = (char *)&this->field_64[4 * this->uNumVertices]; |
0 | 4046 v38 = 0; |
1390 | 4047 *(int *)v2 = this->field_64[0]; |
0 | 4048 v2 += 4; |
1390 | 4049 *(int *)v2 = this->field_64[1]; |
0 | 4050 v2 += 4; |
1390 | 4051 *(int *)v2 = this->field_64[2]; |
4052 *((int *)v2 + 1) = this->field_64[3]; | |
4053 v3 = this->uNumVertices; | |
0 | 4054 v35 = this; |
4055 if ( v3 > 0 ) | |
4056 { | |
1390 | 4057 v40 = &this->field_64[20]; |
4058 v4 = (char *)&this->field_64[3] + 3; | |
0 | 4059 v34 = v3; |
4060 while ( 1 ) | |
4061 { | |
4062 v5 = v4 - 15; | |
4063 if ( *(float *)(v4 - 15) >= (double)a2 && *(float *)(v4 + 1) >= (double)a2 ) | |
4064 goto LABEL_11; | |
4065 if ( *(float *)v5 >= (double)a2 ) | |
4066 break; | |
4067 if ( *(float *)(v4 + 1) >= (double)a2 ) | |
4068 { | |
4069 v15 = (a2 - *(float *)v5) / (*(float *)(v4 + 1) - *(float *)v5); | |
4070 v16 = (unsigned __int8)*v4; | |
4071 HIDWORD(v30) = LODWORD(a2); | |
4072 v17 = (unsigned __int8)v4[16] - v16; | |
4073 v36 = v15; | |
4074 v31 = (*(float *)(v4 + 5) - *(float *)(v4 - 11)) * v15 + *(float *)(v4 - 11); | |
4075 v32 = (*(float *)(v4 + 9) - *(float *)(v4 - 7)) * v15 + *(float *)(v4 - 7); | |
4076 v39 = (double)v17 * v15; | |
4077 v18 = v39 + 6.7553994e15; | |
4078 v19 = (unsigned __int8)*v4; | |
4079 v39 = (double)((unsigned __int8)v4[15] - (unsigned int)(unsigned __int8)*(v4 - 1)) * v36; | |
4080 v20 = v39 + 6.7553994e15; | |
4081 v21 = (unsigned __int8)*(v4 - 2); | |
4082 v37 = LODWORD(v20) + (unsigned __int8)*(v4 - 1); | |
4083 v39 = (double)((unsigned int)(unsigned __int8)v4[14] - v21) * v36; | |
4084 v22 = v39 + 6.7553994e15; | |
4085 v23 = LODWORD(v22) + (unsigned __int8)*(v4 - 2); | |
4086 v39 = (double)((*(int *)(v4 + 13) & 0xFF) - (*(int *)(v4 - 3) & 0xFFu)) * v36; | |
4087 v24 = v39 + 6.7553994e15; | |
4088 v33 = (LODWORD(v24) + (*(int *)(v4 - 3) & 0xFF)) | ((v23 | ((v37 | ((LODWORD(v18) + v19) << 8)) << 8)) << 8); | |
4089 v25 = v40; | |
4090 *v40 = *(int *)v5; | |
4091 v26 = (int)(v5 + 4); | |
4092 ++v25; | |
4093 *v25 = *(int *)v26; | |
4094 v26 += 4; | |
4095 ++v25; | |
4096 ++v38; | |
4097 v40 += 4; | |
4098 *v25 = *(int *)v26; | |
4099 v25[1] = *(int *)(v26 + 4); | |
4100 goto LABEL_9; | |
4101 } | |
4102 LABEL_10: | |
4103 v27 = v40; | |
4104 ++v38; | |
4105 *v40 = *(int *)v5; | |
4106 v28 = (int)(v5 + 4); | |
4107 ++v27; | |
4108 *v27 = *(int *)v28; | |
4109 v28 += 4; | |
4110 ++v27; | |
4111 v40 += 4; | |
4112 *v27 = *(int *)v28; | |
4113 v27[1] = *(int *)(v28 + 4); | |
4114 LABEL_11: | |
4115 v4 += 16; | |
4116 --v34; | |
4117 if ( !v34 ) | |
4118 goto LABEL_12; | |
4119 } | |
4120 v6 = (a2 - *(float *)v5) / (*(float *)(v4 + 1) - *(float *)v5); | |
4121 v7 = (unsigned __int8)v4[16] - (unsigned int)(unsigned __int8)*v4; | |
4122 v36 = v6; | |
4123 v31 = (*(float *)(v4 + 5) - *(float *)(v4 - 11)) * v6 + *(float *)(v4 - 11); | |
4124 v32 = (*(float *)(v4 + 9) - *(float *)(v4 - 7)) * v6 + *(float *)(v4 - 7); | |
4125 *(float *)&v37 = (double)v7 * v6; | |
4126 v8 = *(float *)&v37 + 6.7553994e15; | |
4127 v9 = (unsigned __int8)*v4; | |
4128 *(float *)&v37 = (double)((unsigned __int8)v4[15] - (unsigned int)(unsigned __int8)*(v4 - 1)) * v36; | |
4129 v10 = *(float *)&v37 + 6.7553994e15; | |
4130 v11 = (unsigned __int8)*(v4 - 2); | |
4131 v37 = LODWORD(v10) + (unsigned __int8)*(v4 - 1); | |
4132 v39 = (double)((unsigned int)(unsigned __int8)v4[14] - v11) * v36; | |
4133 v12 = v39 + 6.7553994e15; | |
4134 v13 = LODWORD(v12) + (unsigned __int8)*(v4 - 2); | |
4135 v39 = (double)((*(int *)(v4 + 13) & 0xFF) - (*(int *)(v4 - 3) & 0xFFu)) * v36; | |
4136 v14 = v39 + 6.7553994e15; | |
4137 v33 = (LODWORD(v14) + (*(int *)(v4 - 3) & 0xFF)) | ((v13 | ((v37 | ((LODWORD(v8) + v9) << 8)) << 8)) << 8); | |
4138 LABEL_9: | |
4139 //this = v35; | |
4140 v5 = (char *)&v30 + 4; | |
4141 goto LABEL_10; | |
4142 } | |
4143 LABEL_12: | |
1390 | 4144 return this->uNumVertices = v38; |
0 | 4145 } |
4146 | |
4147 //----- (00477C61) -------------------------------------------------------- | |
4148 int stru6_stru1_indoor_sw_billboard::sub_477C61() | |
4149 { | |
998 | 4150 //stru6_stru1_indoor_sw_billboard *v1; // ebx@1 |
0 | 4151 int v2; // ecx@2 |
4152 int v3; // eax@3 | |
4153 double v4; // st7@4 | |
4154 double v5; // st7@5 | |
4155 double v6; // st6@5 | |
4156 double v7; // st5@6 | |
4157 float v8; // ST30_4@8 | |
4158 float v9; // ST24_4@8 | |
4159 double v10; // st7@8 | |
4160 double v11; // st6@8 | |
4161 double v12; // st5@8 | |
4162 float v13; // ST24_4@13 | |
4163 int v14; // esi@13 | |
4164 char *v15; // esi@15 | |
4165 signed int v16; // eax@16 | |
4166 __int16 v17; // fps@16 | |
4167 unsigned __int8 v18; // c2@16 | |
4168 unsigned __int8 v19; // c3@16 | |
4169 double v20; // st6@16 | |
4170 float v21; // ST18_4@17 | |
4171 float v22; // ST2C_4@17 | |
4172 float v23; // ST34_4@17 | |
4173 float v24; // ST24_4@17 | |
4174 double v25; // st7@17 | |
4175 double v26; // st6@17 | |
4176 float v27; // ST34_4@18 | |
4177 float v28; // ST30_4@18 | |
4178 int v29; // eax@19 | |
4179 signed int v31; // [sp+8h] [bp-28h]@15 | |
4180 float v32; // [sp+Ch] [bp-24h]@16 | |
4181 float v33; // [sp+14h] [bp-1Ch]@16 | |
4182 float v34; // [sp+18h] [bp-18h]@16 | |
4183 float v35; // [sp+1Ch] [bp-14h]@17 | |
4184 float v36; // [sp+20h] [bp-10h]@4 | |
4185 float v37; // [sp+24h] [bp-Ch]@4 | |
4186 float v38; // [sp+24h] [bp-Ch]@16 | |
4187 float v39; // [sp+28h] [bp-8h]@9 | |
4188 float v40; // [sp+28h] [bp-8h]@16 | |
4189 float v41; // [sp+2Ch] [bp-4h]@6 | |
4190 float v42; // [sp+2Ch] [bp-4h]@9 | |
4191 | |
998 | 4192 //v1 = this; |
0 | 4193 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) |
4194 { | |
4195 v2 = 0; | |
1390 | 4196 if ( this->uNumVertices > 0 ) |
998 | 4197 { |
4198 v3 = (int)&this->field_14[1]; | |
0 | 4199 do |
4200 { | |
4201 v4 = *(float *)(v3 - 4); | |
4202 LODWORD(v37) = *(int *)v3; | |
4203 LODWORD(v36) = *(int *)(v3 + 4); | |
4204 if ( pBLVRenderParams->sPartyRotX ) | |
4205 { | |
4206 v5 = v4 - (double)pBLVRenderParams->vPartyPos.x; | |
4207 v6 = v37 - (double)pBLVRenderParams->vPartyPos.y; | |
4208 if ( pRenderer->pRenderD3D ) | |
4209 { | |
4210 v41 = pBLVRenderParams->fSineY * v6 + pBLVRenderParams->fCosineY * v5; | |
4211 v7 = pBLVRenderParams->fSineY * v5 - pBLVRenderParams->fCosineY * v6; | |
4212 } | |
4213 else | |
4214 { | |
4215 v41 = pBLVRenderParams->fCosineY * v5 - pBLVRenderParams->fSineY * v6; | |
4216 v7 = pBLVRenderParams->fSineY * v5 + pBLVRenderParams->fCosineY * v6; | |
4217 } | |
4218 v8 = v7; | |
4219 v9 = v36 - (double)pBLVRenderParams->vPartyPos.z; | |
4220 v10 = pBLVRenderParams->fCosineNegX * v41 - pBLVRenderParams->fSineNegX * v9; | |
4221 v11 = v8; | |
4222 v12 = pBLVRenderParams->fCosineNegX * v9 + pBLVRenderParams->fSineNegX * v41; | |
4223 } | |
4224 else | |
4225 { | |
4226 v42 = v4 - (double)pBLVRenderParams->vPartyPos.x; | |
4227 v39 = v37 - (double)pBLVRenderParams->vPartyPos.y; | |
4228 if ( pRenderer->pRenderD3D ) | |
4229 { | |
4230 v10 = pBLVRenderParams->fSineY * v39 + pBLVRenderParams->fCosineY * v42; | |
4231 v11 = pBLVRenderParams->fSineY * v42 - pBLVRenderParams->fCosineY * v39; | |
4232 } | |
4233 else | |
4234 { | |
4235 v10 = pBLVRenderParams->fCosineY * v42 - pBLVRenderParams->fSineY * v39; | |
4236 v11 = pBLVRenderParams->fSineY * v42 + pBLVRenderParams->fCosineY * v39; | |
4237 } | |
4238 v12 = v36 - (double)pBLVRenderParams->vPartyPos.z; | |
4239 } | |
4240 v13 = v12; | |
4241 ++v2; | |
4242 *(int *)(v3 + 84) = LODWORD(v13); | |
4243 v14 = *(int *)(v3 + 8); | |
4244 *(float *)(v3 + 76) = v10; | |
4245 *(int *)(v3 + 88) = v14; | |
4246 *(float *)(v3 + 80) = v11; | |
4247 v3 += 16; | |
4248 } | |
1390 | 4249 while ( v2 < this->uNumVertices ); |
0 | 4250 } |
4251 } | |
4252 else | |
4253 { | |
4254 v15 = (char *)&this->field_14[1]; | |
4255 v31 = 3; | |
4256 do | |
4257 { | |
323 | 4258 v40 = (double)stru_5C6E00->Cos(pIndoorCamera->sRotationX) * 0.0000152587890625; |
4259 v32 = (double)stru_5C6E00->Sin(pIndoorCamera->sRotationX) * 0.0000152587890625; | |
4260 v34 = (double)stru_5C6E00->Cos(pIndoorCamera->sRotationY) * 0.0000152587890625; | |
4261 v16 = stru_5C6E00->Sin(pIndoorCamera->sRotationY); | |
0 | 4262 LODWORD(v38) = *(int *)v15; |
4263 v33 = (double)v16 * 0.0000152587890625; | |
4264 //UNDEF(v17); | |
4265 v20 = *((float *)v15 - 1) - (double)pIndoorCamera->pos.x; | |
1090 | 4266 //if ( v19 | v18 ) |
4267 if(pIndoorCamera->pos.x == 0) | |
0 | 4268 { |
4269 v27 = v20; | |
4270 LODWORD(v35) = *((int *)v15 + 1); | |
4271 v28 = v38 - (double)pIndoorCamera->pos.y; | |
4272 v25 = v33 * v28 + v34 * v27; | |
4273 v26 = v34 * v28 - v33 * v27; | |
4274 } | |
4275 else | |
4276 { | |
4277 v21 = v20; | |
4278 v22 = v38 - (double)pIndoorCamera->pos.y; | |
4279 v23 = v33 * v22 + v34 * v21; | |
4280 v24 = *((float *)v15 + 1) - (double)pIndoorCamera->pos.z; | |
4281 v25 = v32 * v24 + v40 * v23; | |
4282 v26 = v34 * v22 - v33 * v21; | |
4283 v35 = v40 * v24 - v32 * v23; | |
4284 } | |
4285 *((int *)v15 + 21) = LODWORD(v35); | |
4286 v29 = *((int *)v15 + 2); | |
4287 *((float *)v15 + 19) = v25; | |
4288 *((int *)v15 + 22) = v29; | |
4289 *((float *)v15 + 20) = v26; | |
4290 v15 += 16; | |
4291 --v31; | |
4292 } | |
4293 while ( v31 ); | |
4294 } | |
1390 | 4295 this->uNumVertices = 3; |
0 | 4296 return 1; |
4297 } | |
4298 | |
4299 //----- (00477F63) -------------------------------------------------------- | |
4300 bool stru6_stru1_indoor_sw_billboard::sub_477F63() | |
4301 { | |
4302 signed int v1; // ebx@1 | |
4303 stru6_stru1_indoor_sw_billboard *v2; // esi@1 | |
4304 double v3; // st7@2 | |
4305 int v4; // edx@4 | |
4306 char *v5; // ecx@5 | |
4307 int v6; // edi@5 | |
4308 float v7; // ST08_4@13 | |
4309 signed int v9; // [sp+Ch] [bp-8h]@1 | |
4310 float v10; // [sp+10h] [bp-4h]@2 | |
4311 | |
4312 auto a1 = this; | |
4313 | |
4314 v1 = 0; | |
4315 v2 = a1; | |
4316 v9 = 0; | |
4317 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) | |
4318 { | |
4319 v10 = 16192.0; | |
4320 v3 = (double)pBLVRenderParams->field_40 * 0.000015258789; | |
4321 } | |
4322 else | |
4323 { | |
4324 v10 = (double)pOutdoorCamera->shading_dist_mist; | |
4325 v3 = 8.0; | |
4326 } | |
1390 | 4327 v4 = a1->uNumVertices; |
0 | 4328 if ( v4 <= 0 ) |
4329 goto LABEL_16; | |
4330 v5 = (char *)&a1->field_14[20]; | |
4331 v6 = v4; | |
4332 do | |
4333 { | |
4334 if ( v3 >= *(float *)v5 || *(float *)v5 >= (double)v10 ) | |
4335 { | |
4336 if ( v3 < *(float *)v5 ) | |
4337 v9 = 1; | |
4338 else | |
4339 v1 = 1; | |
4340 } | |
4341 v5 += 16; | |
4342 --v6; | |
4343 } | |
4344 while ( v6 ); | |
4345 if ( !v1 ) | |
4346 { | |
4347 if ( v9 ) | |
4348 { | |
4349 v2->_477927(v10); | |
1390 | 4350 return v2->uNumVertices != 0; |
0 | 4351 } |
4352 LABEL_16: | |
4353 memcpy(&v2->field_14[40], &v2->field_14[20], 16 * v4); | |
1390 | 4354 return v2->uNumVertices != 0; |
0 | 4355 } |
4356 v7 = v3; | |
4357 _4775ED(v7); | |
1390 | 4358 return v2->uNumVertices != 0; |
0 | 4359 } |
4360 | |
4361 //----- (0047802A) -------------------------------------------------------- | |
4362 int stru6_stru1_indoor_sw_billboard::sub_47802A() | |
4363 { | |
4364 double v6; // st7@4 | |
4365 double v12; // st7@16 | |
4366 signed int v16; // [sp+38h] [bp-Ch]@1 | |
4367 int a6; // [sp+3Ch] [bp-8h]@5 | |
4368 int a5; // [sp+40h] [bp-4h]@5 | |
4369 | |
4370 auto a1 = this; | |
4371 | |
4372 v16 = 0; | |
4373 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) | |
4374 { | |
1390 | 4375 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
|
4376 { |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4377 v6 = (double)pBLVRenderParams->field_40 * 0.000015258789 / a1->field_B4[i*4]; |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4378 if ( pRenderer->pRenderD3D ) |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4379 { |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4380 pGame->pIndoorCameraD3D->Project( |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4381 round(a1->field_B4[i*4]), |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4382 round(a1->field_B4[i*4+1]), |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4383 round(a1->field_B4[i*4+2]), |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4384 &a5, |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4385 &a6); |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4386 a1->field_B4[i*4+16] = (double)a5; |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4387 a1->field_B4[i*4+17] = (double)a6; |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4388 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
|
4389 } |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4390 else |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4391 { |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4392 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
|
4393 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
|
4394 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
|
4395 } |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4396 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
|
4397 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
|
4398 && (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
|
4399 && (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
|
4400 && (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
|
4401 v16 = 1; |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4402 } |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4403 } |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4404 else |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4405 { |
1390 | 4406 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
|
4407 { |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4408 v12 = (double)pOutdoorCamera->int_fov_rad / a1->field_B4[i*4]; |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
4409 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
|
4410 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
|
4411 *((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
|
4412 *((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
|
4413 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
|
4414 && (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
|
4415 && (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
|
4416 && (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
|
4417 v16 = 1; |
0 | 4418 } |
4419 } | |
4420 return v16; | |
4421 } | |
4422 | |
4423 //----- (004783FA) -------------------------------------------------------- | |
4424 void __cdecl sub_4783FA_construct_global_73D150() | |
4425 { | |
4426 char *v0; // eax@1 | |
4427 signed int v1; // ecx@1 | |
4428 | |
4429 v0 = (char *)&array_73D150[0].flt_2C; | |
4430 v1 = 20; | |
4431 do | |
4432 { | |
4433 *(float *)v0 = 0.0; | |
4434 v0 += 48; | |
4435 --v1; | |
4436 } | |
4437 while ( v1 ); | |
4438 } | |
4439 | |
4440 //----- (0047840D) -------------------------------------------------------- | |
4441 char Render::DrawBuildingsD3D() | |
4442 { | |
1395
8d4ec56416ef
Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents:
1391
diff
changeset
|
4443 //IndoorCameraD3D *v0; // eax@3 |
0 | 4444 char result; // al@3 |
79 | 4445 BSPModel *v2; // ebx@4 |
4446 int v3; // eax@6 | |
0 | 4447 ODMFace *pFace; // esi@6 |
79 | 4448 Vec3_int_ *v5; // ecx@8 |
0 | 4449 int v6; // eax@8 |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
4450 struct Polygon *v7; // ebx@8 |
0 | 4451 LightmapBuilder *v8; // eax@8 |
4452 int v9; // ecx@8 | |
4453 char v10; // zf@8 | |
4454 Texture *pFaceTexture; // eax@10 | |
4455 signed int v12; // ecx@10 | |
4456 unsigned int v13; // eax@14 | |
4457 unsigned int v14; // eax@18 | |
4458 unsigned int v15; // eax@22 | |
4459 unsigned int v16; // edi@22 | |
4460 int v17; // eax@24 | |
4461 int v18; // edi@34 | |
79 | 4462 RenderVertexSoft *v19; // eax@35 |
4463 unsigned short *v20; // ecx@35 | |
4464 unsigned short *v20b; // ecx@35 | |
4465 unsigned short *v20c; // ecx@35 | |
0 | 4466 Vec3_int_ *v21; // edx@36 |
4467 int v22; // edx@36 | |
79 | 4468 RenderVertexSoft *v23; // edi@37 |
0 | 4469 int v24; // eax@50 |
4470 int v25; // ecx@55 | |
4471 int v26; // eax@57 | |
4472 int v27; // eax@57 | |
4473 int v28; // eax@58 | |
1395
8d4ec56416ef
Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents:
1391
diff
changeset
|
4474 //int v29; // edx@58 |
8d4ec56416ef
Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents:
1391
diff
changeset
|
4475 //double v30; // st7@59 |
8d4ec56416ef
Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents:
1391
diff
changeset
|
4476 //LightmapBuilder *v31; // edi@63 |
0 | 4477 signed int v32; // eax@73 |
4478 int v33; // eax@78 | |
4479 unsigned int v34; // eax@80 | |
4480 std::string v35; // [sp-18h] [bp-70h]@2 | |
4481 int v36; // [sp-14h] [bp-6Ch]@69 | |
4482 RenderVertexSoft *v37; // [sp-10h] [bp-68h]@69 | |
4483 int v38; // [sp-Ch] [bp-64h]@69 | |
1395
8d4ec56416ef
Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents:
1391
diff
changeset
|
4484 //LightmapBuilder *v39; // [sp-8h] [bp-60h]@2 |
0 | 4485 int v40; // [sp-4h] [bp-5Ch]@2 |
1395
8d4ec56416ef
Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents:
1391
diff
changeset
|
4486 //std::string *v41; // [sp+Ch] [bp-4Ch]@2 |
79 | 4487 int v41b; |
4488 int v42; // [sp+10h] [bp-48h]@6 | |
0 | 4489 LightmapBuilder *pLightmapBuilder; // [sp+14h] [bp-44h]@8 |
4490 float v44; // [sp+18h] [bp-40h]@10 | |
4491 float v45; // [sp+1Ch] [bp-3Ch]@10 | |
4492 ODMFace *v46; // [sp+20h] [bp-38h]@6 | |
1395
8d4ec56416ef
Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents:
1391
diff
changeset
|
4493 //IndoorCameraD3D *v47; // [sp+24h] [bp-34h]@3 |
0 | 4494 unsigned int v48; // [sp+28h] [bp-30h]@8 |
4495 int v49; // [sp+2Ch] [bp-2Ch]@10 | |
4496 int v50; // [sp+30h] [bp-28h]@34 | |
4497 int v51; // [sp+34h] [bp-24h]@35 | |
4498 int v52; // [sp+38h] [bp-20h]@36 | |
4499 int v53; // [sp+3Ch] [bp-1Ch]@8 | |
4500 Vec3_int_ *v54; // [sp+40h] [bp-18h]@6 | |
4501 int a1; // [sp+44h] [bp-14h]@3 | |
79 | 4502 BSPModel *v56; // [sp+48h] [bp-10h]@4 |
0 | 4503 int uNumVertices; // [sp+4Ch] [bp-Ch]@34 |
4504 int unused; // [sp+50h] [bp-8h]@3 | |
4505 int a3; // [sp+57h] [bp-1h]@2 | |
4506 | |
4507 if ( !pRenderer->pRenderD3D ) | |
4508 { | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
4509 MessageBoxW(nullptr, L"D3D version of RenderBuildings called in software!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Odbuild.cpp:73", 0); |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
4510 } |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
4511 |
0 | 4512 unused = 0; |
4513 a1 = 0; | |
4514 result = LOBYTE(pOutdoor->pBModels); | |
79 | 4515 v41b = pOutdoor->uNumBModels; |
0 | 4516 if ( (signed int)pOutdoor->uNumBModels > 0 ) |
4517 { | |
79 | 4518 v2 = pOutdoor->pBModels; |
4519 v56 = pOutdoor->pBModels; | |
0 | 4520 while ( 1 ) |
4521 { | |
4522 if ( IsBModelVisible(a1, &unused) ) | |
4523 { | |
79 | 4524 v2->field_40 |= 1u; |
4525 v3 = v2->uNumFaces; | |
4526 pFace = v2->pFaces; | |
0 | 4527 v54 = 0; |
4528 v46 = pFace; | |
4529 v42 = v3; | |
79 | 4530 if ( v3 > 0 ) |
0 | 4531 break; |
4532 } | |
4533 LABEL_86: | |
4534 ++a1; | |
79 | 4535 ++v2;// += 47; |
0 | 4536 result = a1; |
4537 v56 = v2; | |
79 | 4538 if ( a1 >= v41b ) |
0 | 4539 return result; |
4540 } | |
4541 while ( 1 ) | |
4542 { | |
4543 if (pFace->Invisible()) | |
4544 goto LABEL_85; | |
79 | 4545 //v5 = (int)*(v2 - 1); |
4546 v5 = v2->pVertices.pVertices; | |
0 | 4547 v6 = pFace->pVertexIDs[0]; |
4548 v53 = 0; | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
4549 v7 = &array_77EC08[pOutdoorCamera->uNumPolygons]; |
79 | 4550 //v8 = *(LightmapBuilder **)(v5 + 12 * v6 + 8); |
4551 v8 = (LightmapBuilder *)v5[v6].z; | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
4552 v7->flags = 0; |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
4553 v7->field_32 = 0; |
0 | 4554 pLightmapBuilder = v8; |
4555 v9 = pFace->uTextureID; | |
4556 v10 = (BYTE1(pFace->uAttributes) & 0x40) == 0; | |
4557 v48 = pFace->uTextureID; | |
4558 if ( !v10 ) | |
4559 { | |
4560 v48 = pTextureFrameTable->GetFrameTexture(v9, pEventTimer->uTotalGameTimeElapsed); | |
4561 v9 = v48; | |
4562 } | |
945 | 4563 pFaceTexture = pBitmaps_LOD->GetTexture(v9); |
0 | 4564 v7->pTexture = pFaceTexture; |
945 | 4565 v12 = pFaceTexture->uTextureWidth; |
0 | 4566 v49 = v12; |
4567 v49 = pFaceTexture->uTextureHeight; | |
4568 v10 = (pFace->uAttributes & 0x10) == 0; | |
4569 v45 = 1.0 / (double)v12; | |
4570 v44 = 1.0 / (double)v49; | |
4571 if ( !v10 ) | |
4572 *(int *)&v7->flags |= 2u; | |
4573 if ( BYTE2(pFace->uAttributes) & 0x40 ) | |
4574 HIBYTE(v7->flags) |= 4u; | |
4575 v13 = pFace->uAttributes; | |
4576 if ( v13 & 4 ) | |
4577 { | |
4578 HIBYTE(v7->flags) |= 4u; | |
4579 } | |
4580 else | |
4581 { | |
4582 if ( v13 & 0x20 ) | |
4583 HIBYTE(v7->flags) |= 8u; | |
4584 } | |
4585 v14 = pFace->uAttributes; | |
4586 if ( BYTE1(v14) & 8 ) | |
4587 { | |
4588 *(int *)&v7->flags |= 0x2000u; | |
4589 } | |
4590 else | |
4591 { | |
4592 if ( v14 & 0x40 ) | |
4593 HIBYTE(v7->flags) |= 0x10u; | |
4594 } | |
4595 v15 = GetTickCount(); | |
4596 v7->sTextureDeltaU = pFace->sTextureDeltaU; | |
4597 v7->sTextureDeltaV = pFace->sTextureDeltaV; | |
4598 v16 = v15 >> 4; | |
4599 if ( pFace->pFacePlane.vNormal.z && (v40 = pFace->pFacePlane.vNormal.z, abs(v40) >= 59082) ) | |
4600 { | |
4601 v17 = *(int *)&v7->flags; | |
4602 if ( BYTE1(v17) & 4 ) | |
4603 goto LABEL_29; | |
4604 if ( BYTE1(v17) & 8 ) | |
4605 { | |
4606 LABEL_26: | |
4607 v7->sTextureDeltaV -= v16 & v7->pTexture->uHeightMinus1; | |
4608 goto LABEL_30; | |
4609 } | |
4610 } | |
4611 else | |
4612 { | |
4613 v17 = *(int *)&v7->flags; | |
4614 if ( BYTE1(v17) & 4 ) | |
4615 goto LABEL_26; | |
4616 if ( BYTE1(v17) & 8 ) | |
4617 { | |
4618 LABEL_29: | |
4619 v7->sTextureDeltaV += v16 & v7->pTexture->uHeightMinus1; | |
4620 goto LABEL_30; | |
4621 } | |
4622 } | |
4623 LABEL_30: | |
4624 if ( BYTE1(v17) & 0x10 ) | |
4625 { | |
4626 v7->sTextureDeltaU -= v16 & v7->pTexture->uWidthMinus1; | |
4627 } | |
4628 else | |
4629 { | |
4630 if ( BYTE1(v17) & 0x20 ) | |
4631 v7->sTextureDeltaU += v16 & v7->pTexture->uWidthMinus1; | |
4632 } | |
4633 v18 = pFace->uNumVertices; | |
4634 v50 = 0; | |
4635 v49 = 0; | |
4636 uNumVertices = v18; | |
4637 if ( v18 > 0 ) | |
4638 { | |
79 | 4639 //v19 = (char *)&array_73D150[0].vWorldPosition.z; |
4640 //v20 = (char *)pFace->pTextureUIDs; | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
4641 v19 = array_73D150; |
79 | 4642 v20 = pFace->pTextureUIDs; |
4643 v20b = pFace->pVertexIDs; | |
4644 v20c = pFace->pTextureVIDs; | |
0 | 4645 v51 = v18; |
4646 do | |
4647 { | |
79 | 4648 /* v21 = &(*(v56 - 1))[*((short *)v20 - 20)]; |
0 | 4649 *((float *)v19 - 2) = (double)v21->x; |
4650 *((float *)v19 - 1) = (double)v21->y; | |
4651 *(float *)v19 = (double)v21->z; | |
4652 v19 += 48; | |
4653 v52 = v7->sTextureDeltaU + *(short *)v20; | |
4654 *((float *)v19 - 5) = (double)v52 * v45; | |
4655 v22 = v7->sTextureDeltaV + *((short *)v20 + 20); | |
4656 v20 += 2; | |
4657 v10 = v51-- == 1; | |
4658 v52 = v22; | |
79 | 4659 *((float *)v19 - 4) = (double)v22 * v44;*/ |
4660 | |
4661 //v21 = (BSPVertexBuffer *)(*((_DWORD *)v56 - 1) + 12 * *(v20 - 20)); | |
4662 v21 = &v56->pVertices.pVertices[*v20b]; | |
4663 //*((float *)v19 - 2) = (double)v21->x; | |
4664 //*((float *)v19 - 1) = (double)v21->y; | |
4665 v19->vWorldPosition.x = (double)v21->x; | |
4666 v19->vWorldPosition.y = (double)v21->y; | |
4667 v19->vWorldPosition.z = (double)v21->z; | |
4668 ++v19; | |
4669 v52 = v7->sTextureDeltaU + (signed __int16)*v20; | |
4670 //*((float *)v19 - 5) = (double)v52 * v45; | |
4671 (v19-1)->u = (double)v52 * v45; | |
4672 v22 = v7->sTextureDeltaV + (signed __int16)*v20c; | |
4673 ++v20; | |
4674 ++v20b; | |
4675 ++v20c; | |
4676 v10 = v51-- == 1; | |
4677 v52 = v22; | |
4678 //*((float *)v19 - 4) = (double)v22 * v44; | |
4679 (v19-1)->v = (double)v22 * v44; | |
0 | 4680 } |
4681 while ( !v10 ); | |
79 | 4682 //v23 = (char *)&array_73D150[0].vWorldViewPosition; |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
4683 v23 = array_73D150; |
0 | 4684 v51 = uNumVertices; |
4685 *(float *)&pLightmapBuilder = (double)(signed int)pLightmapBuilder; | |
4686 do | |
4687 { | |
79 | 4688 //if ( *(float *)&pLightmapBuilder == *((float *)v23 - 1) ) |
4689 if ( *(float *)&pLightmapBuilder == v23->vWorldPosition.z ) | |
0 | 4690 ++v53; |
79 | 4691 //v47->ViewTransform((RenderVertexSoft *)(v23 - 12), 1u); |
1395
8d4ec56416ef
Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents:
1391
diff
changeset
|
4692 pGame->pIndoorCameraD3D->ViewTransform(v23, 1u); |
79 | 4693 if ( v23->vWorldViewPosition.x < 8.0 || (double)pOutdoorCamera->shading_dist_mist < v23->vWorldViewPosition.x ) |
4694 { | |
4695 if ( v23->vWorldViewPosition.x >= 8.0 ) | |
0 | 4696 v49 = 1; |
4697 else | |
4698 v50 = 1; | |
4699 } | |
4700 else | |
4701 { | |
1395
8d4ec56416ef
Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents:
1391
diff
changeset
|
4702 pGame->pIndoorCameraD3D->Project(v23, 1u, 0); |
79 | 4703 } |
4704 ++v23;// += 48; | |
0 | 4705 --v51; |
4706 } | |
4707 while ( v51 ); | |
4708 v18 = uNumVertices; | |
4709 } | |
4710 if ( v53 == v18 ) | |
4711 LOBYTE(v7->field_32) |= 1u; | |
4712 v24 = pOutdoor->vSunlight.x; | |
4713 v7->pODMFace = pFace; | |
4714 v7->uNumVertices = v18; | |
4715 v7->field_59 = 5; | |
4716 pLightmapBuilder = (LightmapBuilder *)-v24; | |
4717 v51 = pFace->pFacePlane.vNormal.x; | |
4718 v51 = (unsigned __int64)(-v24 * (signed __int64)v51) >> 16; | |
4719 v53 = pFace->pFacePlane.vNormal.y; | |
4720 pLightmapBuilder = (LightmapBuilder *)-pOutdoor->vSunlight.y; | |
4721 v53 = (unsigned __int64)(-pOutdoor->vSunlight.y * (signed __int64)v53) >> 16; | |
4722 v52 = pFace->pFacePlane.vNormal.z; | |
4723 v52 = (unsigned __int64)(-pOutdoor->vSunlight.z * (signed __int64)v52) >> 16; | |
4724 pLightmapBuilder = (LightmapBuilder *)(v51 + v53 + v52); | |
4725 v51 = 20 * (int)pLightmapBuilder; | |
4726 result = 20 - (20 * (signed int)pLightmapBuilder >> 16); | |
638 | 4727 v7->dimming_level = result; |
0 | 4728 if ( result < 0 ) |
638 | 4729 v7->dimming_level = 0; |
4730 if ( v7->dimming_level > 31 ) | |
4731 v7->dimming_level = 31; | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
4732 if ( pOutdoorCamera->uNumPolygons >= 1999 + 5000) |
0 | 4733 return result; |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
4734 ++pOutdoorCamera->uNumPolygons; |
0 | 4735 ++pOutdoorCamera->field_44; |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
4736 if ( ODMFace::IsBackfaceCulled(pFace, array_73D150, v7) ) |
0 | 4737 { |
4738 LOBYTE(v25) = (char)v54; | |
4739 v26 = a1; | |
4740 pFace->bVisible = 1; | |
4741 v7->uBModelFaceID = v25; | |
4742 LOWORD(v25) = (unsigned __int8)v25; | |
4743 v7->uBModelID = v26; | |
4744 v27 = 8 * (v25 | (v26 << 6)); | |
4745 LOBYTE(v27) = v27 | 6; | |
4746 v7->field_50 = v27; | |
1395
8d4ec56416ef
Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents:
1391
diff
changeset
|
4747 |
8d4ec56416ef
Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents:
1391
diff
changeset
|
4748 for (v28 = 0; v28 < v18; ++v28) |
0 | 4749 { |
4750 memcpy(&array_50AC10[v28], &array_73D150[v28], sizeof(array_50AC10[v28])); | |
1395
8d4ec56416ef
Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents:
1391
diff
changeset
|
4751 array_50AC10[v28]._rhw = 1.0 / (array_73D150[v28].vWorldViewPosition.x + 0.0000001); |
8d4ec56416ef
Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents:
1391
diff
changeset
|
4752 |
0 | 4753 pFace = v46; |
4754 } | |
4755 | |
4756 static stru154 static_RenderBuildingsD3D_stru_73C834; | |
4757 /*static bool __init_flag = false; | |
4758 if (!__init_flag) | |
4759 { | |
4760 __init_flag = true; | |
4761 | |
4762 static_RenderBuildingsD3D_byte_73C84C_init_flag |= 1u; | |
4763 stru154::stru154(&static_RenderBuildingsD3D_stru_73C834); | |
4764 atexit(loc_4789D4); | |
4765 }*/ | |
4766 | |
4767 v40 = (int)pFace; | |
1395
8d4ec56416ef
Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents:
1391
diff
changeset
|
4768 pGame->pLightmapBuilder->ApplyLights_OutdoorFace(pFace); |
0 | 4769 pDecalBuilder->ApplyDecals_OutdoorFace(pFace); |
1395
8d4ec56416ef
Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents:
1391
diff
changeset
|
4770 pGame->pLightmapBuilder->std__vector_000004_size = 0; |
8d4ec56416ef
Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents:
1391
diff
changeset
|
4771 |
8d4ec56416ef
Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents:
1391
diff
changeset
|
4772 int v31 = 0; |
0 | 4773 if ( stru_F8AD28.uNumLightsApplied > 0 || pDecalBuilder->uNumDecals > 0 ) |
4774 { | |
1395
8d4ec56416ef
Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents:
1391
diff
changeset
|
4775 v31 = v50 ? 3 : v49 != 0 ? 5 : 0; |
866 | 4776 static_RenderBuildingsD3D_stru_73C834.GetFacePlaneAndClassify(pFace, &v56->pVertices); |
0 | 4777 if ( pDecalBuilder->uNumDecals > 0 ) |
4778 { | |
4779 v40 = -1; | |
4780 v38 = 0; | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
4781 v37 = array_50AC10; |
0 | 4782 v36 = uNumVertices; |
638 | 4783 pDecalBuilder->ApplyDecals(31 - v7->dimming_level, |
0 | 4784 2, |
4785 &static_RenderBuildingsD3D_stru_73C834, | |
4786 uNumVertices, | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
4787 array_50AC10, |
0 | 4788 0, |
4789 (char)v31, | |
4790 -1); | |
4791 } | |
4792 } | |
4793 if ( stru_F8AD28.uNumLightsApplied > 0 ) | |
1395
8d4ec56416ef
Fix to ticket #69 array_50A2B0 being accessed outside of bounds
Nomad
parents:
1391
diff
changeset
|
4794 pGame->pLightmapBuilder->ApplyLights( |
0 | 4795 &stru_F8AD28, |
4796 &static_RenderBuildingsD3D_stru_73C834, | |
4797 uNumVertices, | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1206
diff
changeset
|
4798 array_50AC10, |
0 | 4799 0, |
4800 (char)v31); | |
4801 if ( v50 ) | |
4802 { | |
4803 v32 = sr_424CD7(uNumVertices); | |
4804 goto LABEL_76; | |
4805 } | |
4806 if ( v49 ) | |
4807 { | |
4808 v32 = sr_424EE0_MakeFanFromTriangle(uNumVertices); | |
4809 LABEL_76: | |
4810 v7->uNumVertices = v32; | |
4811 uNumVertices = v32; | |
4812 OutdoorCamera::Project(v32); | |
4813 } | |
4814 if ( uNumVertices ) | |
4815 { | |
4816 v33 = *(int *)&v7->flags; | |
4817 if ( v33 & 2 ) | |
4818 { | |
4819 if ( BYTE1(v33) & 0x3C ) | |
4820 v34 = pRenderer->pHDWaterBitmapIDs[0]; | |
4821 else | |
265 | 4822 v34 = pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_current_frame]; |
0 | 4823 v40 = (int)pBitmaps_LOD->pHardwareTextures[v34]; |
4824 } | |
4825 else | |
4826 { | |
4827 v40 = (int)pBitmaps_LOD->pHardwareTextures[v48]; | |
4828 } | |
4829 pRenderer->DrawPolygon(uNumVertices, v7, pFace, (IDirect3DTexture2 *)v40); | |
4830 } | |
4831 goto LABEL_85; | |
4832 } | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
4833 --pOutdoorCamera->uNumPolygons; |
0 | 4834 --pOutdoorCamera->field_44; |
4835 LABEL_85: | |
4836 v54 = (Vec3_int_ *)((char *)v54 + 1); | |
4837 v2 = v56; | |
4838 ++pFace; | |
4839 v46 = pFace; | |
4840 if ( (signed int)v54 >= (signed int)v42 ) | |
4841 goto LABEL_86; | |
4842 } | |
4843 } | |
4844 return result; | |
4845 } | |
4846 // 73C84C: using guessed type char static_RenderBuildingsD3D_byte_73C84C_init_flag; | |
4847 | |
4848 | |
4849 //----- (00479089) -------------------------------------------------------- | |
323 | 4850 bool __fastcall IsBModelVisible(unsigned int uModelID, int *reachable) |
0 | 4851 { |
4852 BSPModel *v2; // eax@1 | |
4853 int v3; // edi@1 | |
4854 int v4; // ebx@1 | |
4855 int v5; // ST28_4@1 | |
4856 int v6; // ecx@1 | |
4857 int v7; // ebx@3 | |
4858 int v8; // eax@3 | |
4859 int v9; // eax@3 | |
323 | 4860 //int v10; // ebx@3 |
0 | 4861 signed int v11; // esi@6 |
4862 int v12; // esi@8 | |
4863 bool result; // eax@9 | |
323 | 4864 //unsigned int v14; // [sp+Ch] [bp-20h]@1 |
0 | 4865 int v15; // [sp+Ch] [bp-20h]@5 |
323 | 4866 //int *v16; // [sp+10h] [bp-1Ch]@1 |
0 | 4867 int v17; // [sp+1Ch] [bp-10h]@1 |
4868 int v18; // [sp+20h] [bp-Ch]@1 | |
4869 int v19; // [sp+20h] [bp-Ch]@3 | |
4870 int angle; // [sp+24h] [bp-8h]@1 | |
4871 int v21; // [sp+28h] [bp-4h]@1 | |
323 | 4872 //int v22; // [sp+28h] [bp-4h]@3 |
4873 | |
4874 //v16 = unused; | |
0 | 4875 angle = (signed int)(pOutdoorCamera->uCameraFovInDegrees << 11) / 360 >> 1; |
323 | 4876 //v14 = uModelID; |
0 | 4877 v2 = &pOutdoor->pBModels[uModelID]; |
4878 v3 = v2->vBoundingCenter.x - pIndoorCamera->pos.x; | |
4879 v4 = v2->vBoundingCenter.y - pIndoorCamera->pos.y; | |
323 | 4880 v5 = stru_5C6E00->Cos(pIndoorCamera->sRotationY); |
4881 v21 = stru_5C6E00->Sin(pIndoorCamera->sRotationY); | |
4882 v18 = stru_5C6E00->Cos(pIndoorCamera->sRotationX); | |
4883 stru_5C6E00->Sin(pIndoorCamera->sRotationX); | |
0 | 4884 v6 = v5; |
4885 v17 = v3 * v5 + v4 * v21; | |
4886 if ( pIndoorCamera->sRotationX ) | |
4887 v17 = (unsigned __int64)(v17 * (signed __int64)v18) >> 16; | |
4888 v19 = v4 * v6 - v3 * v21; | |
4889 v7 = abs(v4); | |
4890 v8 = abs(v3); | |
322 | 4891 v9 = int_get_vector_length(v8, v7, 0); |
323 | 4892 //v10 = v14 * 188; |
4893 //v22 = v9; | |
4894 *reachable = false; | |
4895 if ( v9 < pOutdoor->pBModels[uModelID].sBoundingRadius + 256 ) | |
4896 *reachable = true; | |
4897 v15 = stru_5C6E00->Sin(angle); | |
0 | 4898 if ( v19 >= 0 ) |
323 | 4899 v11 = ((unsigned __int64)(v15 * (signed __int64)v17) >> 16) - ((unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)v19) >> 16); |
4900 else | |
4901 v11 = ((unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)v19) >> 16) + ((unsigned __int64)(v15 * (signed __int64)v17) >> 16); | |
0 | 4902 v12 = v11 >> 16; |
323 | 4903 if ( v9 <= pOutdoorCamera->shading_dist_mist + 2048 ) |
0 | 4904 { |
79 | 4905 //if ( abs(v12) > *(int *)((char *)&pOutdoor->pBModels->sBoundingRadius + v10) + 512 ) |
323 | 4906 if ( abs(v12) > pOutdoor->pBModels[uModelID].sBoundingRadius + 512 ) |
0 | 4907 { |
4908 result = v12 < 0; | |
4909 LOBYTE(result) = v12 >= 0; | |
323 | 4910 return result; |
4911 } | |
4912 else | |
4913 return true; | |
4914 } | |
4915 return false; | |
0 | 4916 } |
4917 | |
4918 //----- (00479295) -------------------------------------------------------- | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
4919 int Polygon::_479295() |
0 | 4920 { |
4921 ODMFace *v2; // esi@1 | |
4922 int v3; // ecx@4 | |
4923 int v4; // eax@4 | |
4924 int v5; // edx@4 | |
4925 int v6; // ST14_4@5 | |
4926 int v7; // ST04_4@5 | |
4927 stru149 *v8; // ecx@5 | |
4928 Vec3_int_ thisa; // [sp+Ch] [bp-10h]@8 | |
4929 int v11; // [sp+18h] [bp-4h]@4 | |
4930 | |
4931 v2 = this->pODMFace; | |
4932 if ( !v2->pFacePlane.vNormal.z ) | |
4933 { | |
4934 v3 = v2->pFacePlane.vNormal.x; | |
4935 v4 = -v2->pFacePlane.vNormal.y; | |
4936 LABEL_9: | |
4937 v5 = 0; | |
4938 v11 = 65536; | |
4939 goto LABEL_5; | |
4940 } | |
4941 if ( (v2->pFacePlane.vNormal.x || v2->pFacePlane.vNormal.y) && abs(v2->pFacePlane.vNormal.z) < 59082 ) | |
4942 { | |
4943 thisa.x = -v2->pFacePlane.vNormal.y; | |
4944 thisa.y = v2->pFacePlane.vNormal.x; | |
4945 thisa.z = 0; | |
4946 thisa.Normalize_float(); | |
4947 v4 = thisa.x; | |
4948 v3 = thisa.y; | |
4949 goto LABEL_9; | |
4950 } | |
4951 v3 = 0; | |
4952 v4 = 65536; | |
4953 v11 = 0; | |
4954 v5 = -65536; | |
4955 LABEL_5: | |
4956 v6 = v11; | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
4957 sTextureDeltaU = v2->sTextureDeltaU; |
0 | 4958 v7 = v3; |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
4959 v8 = ptr_38; |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
4960 sTextureDeltaV = v2->sTextureDeltaV; |
0 | 4961 v8->_48616B(v4, v7, 0, 0, v5, v6); |
4962 return 1; | |
4963 } | |
4964 | |
4965 | |
168 | 4966 unsigned short *LoadTgaTexture(const wchar_t *filename, int *out_width = nullptr, int *out_height = nullptr) |
4967 { | |
4968 #pragma pack(push, 1) | |
4969 struct TGAHeader | |
4970 { | |
4971 unsigned char tgaSkip; | |
4972 unsigned char colourmaptype; // type of colour map 0=none, 1=has palette | |
4973 unsigned char tgaType; // type of image 0=none,1=indexed,2=rgb,3=grey,+8=rle packed | |
4974 | |
4975 short colourmapstart; // first colour map entry in palette | |
4976 short colourmaplength; // number of colours in palette | |
4977 char colourmapbits; // number of bits per palette entry 15,16,24,32 | |
4978 | |
4979 //unsigned char tgaDontCare2[9]; | |
4980 short xstart; // image x origin | |
4981 short ystart; // image y origin | |
4982 | |
4983 unsigned short tgaWidth; | |
4984 unsigned short tgaHeight; | |
4985 unsigned char tgaBPP; | |
4986 | |
4987 char descriptor; // image descriptor bits: 00vhaaaa | |
4988 // h horizontal flip | |
4989 // v vertical flip | |
4990 // a alpha bits | |
4991 }; | |
4992 #pragma pack(pop) | |
4993 | |
4994 if (out_width) | |
4995 *out_width = 0; | |
4996 if (out_height) | |
4997 *out_height = 0; | |
4998 | |
4999 DWORD w; | |
5000 auto file = CreateFileW(filename, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr); | |
5001 if (file == INVALID_HANDLE_VALUE) | |
5002 return nullptr; | |
5003 | |
5004 TGAHeader header; | |
5005 ReadFile(file, &header, sizeof(header), &w, nullptr); | |
5006 SetFilePointer(file, header.tgaSkip, nullptr, FILE_CURRENT); | |
5007 | |
5008 if (header.tgaBPP != 24 || header.tgaType != 2) | |
5009 { | |
5010 CloseHandle(file); | |
5011 return nullptr; | |
5012 } | |
5013 | |
5014 int imgSize = header.tgaWidth * header.tgaHeight * 3; | |
5015 auto pixels = new unsigned char[imgSize]; | |
5016 ReadFile(file, pixels, imgSize, &w, nullptr); | |
5017 CloseHandle(file); | |
5018 | |
5019 if (w != imgSize) | |
5020 { | |
5021 delete [] pixels; | |
5022 return nullptr; | |
5023 } | |
5024 | |
5025 if (out_width) | |
5026 *out_width = header.tgaWidth; | |
5027 if (out_height) | |
5028 *out_height = header.tgaHeight; | |
5029 | |
5030 auto pixels_16bit = new unsigned short[imgSize / 3]; | |
5031 for (int i = 0; i < imgSize / 3; ++i) | |
5032 { | |
5033 pixels_16bit[i] = (pixels[i * 3] / 8 & 0x1F) | | |
5034 ((pixels[i * 3 + 1] / 4 & 0x3F) << 5) | | |
5035 ((pixels[i * 3 + 2] / 8 & 0x1F) << 11); | |
5036 } | |
5037 delete [] pixels; | |
5038 return pixels_16bit; | |
5039 } | |
5040 | |
5041 unsigned short *skybox_xn, *skybox_xp, | |
5042 *skybox_yn, *skybox_yp, | |
5043 *skybox_zn, *skybox_zp; | |
5044 int skybox_width, skybox_height; | |
781 | 5045 |
168 | 5046 IDirect3DTexture2 *skybox_texture; |
5047 IDirectDrawSurface4 *skybox_surface; | |
781 | 5048 |
168 | 5049 bool Skybox_Initialize(const wchar_t *skybox_name) |
5050 { | |
5051 wchar_t xn_filename[1024], xp_filename[1024], | |
5052 yn_filename[1024], yp_filename[1024], | |
5053 zn_filename[1024], zp_filename[1024]; | |
1165
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1160
diff
changeset
|
5054 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
|
5055 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
|
5056 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 | 5057 |
5058 int xn_width, xn_height; | |
5059 skybox_xn = LoadTgaTexture(xn_filename, &xn_width, &xn_height); | |
5060 if (!skybox_xn) | |
5061 return false; | |
5062 | |
5063 int xp_width, xp_height; | |
5064 skybox_xp = LoadTgaTexture(xp_filename, &xp_width, &xp_height); | |
5065 if (!skybox_xp || xp_width != xn_width || xp_height != xn_height) | |
5066 { | |
5067 delete [] skybox_xn; | |
5068 if (skybox_xp) delete [] skybox_xp; | |
5069 return false; | |
5070 } | |
5071 | |
5072 int yn_width, yn_height; | |
5073 skybox_yn = LoadTgaTexture(yn_filename, &yn_width, &yn_height); | |
5074 if (!skybox_yn || yn_width != xn_width || yn_height != xn_height) | |
5075 { | |
5076 delete [] skybox_xn; | |
5077 if (skybox_xp) delete [] skybox_xp; | |
5078 if (skybox_yn) delete [] skybox_yn; | |
5079 return false; | |
5080 } | |
5081 | |
5082 int yp_width, yp_height; | |
5083 skybox_yp = LoadTgaTexture(yp_filename, &yp_width, &yp_height); | |
5084 if (!skybox_yp || yp_width != xn_width || yp_height != xn_height) | |
5085 { | |
5086 delete [] skybox_xn; | |
5087 if (skybox_xp) delete [] skybox_xp; | |
5088 if (skybox_yn) delete [] skybox_yn; | |
5089 if (skybox_yp) delete [] skybox_yp; | |
5090 return false; | |
5091 } | |
5092 | |
5093 int zn_width, zn_height; | |
5094 skybox_zn = LoadTgaTexture(zn_filename, &zn_width, &zn_height); | |
5095 if (!skybox_zn || zn_width != xn_width || zn_height != xn_height) | |
5096 { | |
5097 delete [] skybox_xn; | |
5098 if (skybox_xp) delete [] skybox_xp; | |
5099 if (skybox_yn) delete [] skybox_yn; | |
5100 if (skybox_yp) delete [] skybox_yp; | |
5101 if (skybox_zn) delete [] skybox_zn; | |
5102 return false; | |
5103 } | |
5104 | |
5105 int zp_width, zp_height; | |
5106 skybox_zp = LoadTgaTexture(zp_filename, &zp_width, &zp_height); | |
5107 if (!skybox_zp || zp_width != xn_width || zp_height != xn_height) | |
5108 { | |
5109 delete [] skybox_xn; | |
5110 if (skybox_xp) delete [] skybox_xp; | |
5111 if (skybox_yn) delete [] skybox_yn; | |
5112 if (skybox_yp) delete [] skybox_yp; | |
5113 if (skybox_zn) delete [] skybox_zn; | |
5114 if (skybox_zp) delete [] skybox_zp; | |
5115 return false; | |
5116 } | |
5117 | |
5118 skybox_width = xn_width; | |
5119 skybox_height = xn_height; | |
5120 | |
5121 | |
5122 if (!pRenderer->pRenderD3D->CreateTexture(skybox_width, skybox_height, &skybox_surface, &skybox_texture, | |
5123 false, false, pRenderer->uMinDeviceTextureDim)) | |
5124 return false; | |
5125 | |
5126 return true; | |
5127 } | |
5128 | |
5129 struct vector | |
5130 { | |
5131 float x, y, z; | |
5132 }; | |
781 | 5133 |
168 | 5134 struct matrix |
5135 { | |
5136 float m[4][4]; | |
5137 }; | |
781 | 5138 |
168 | 5139 void VectorNormalize(vector *v) |
5140 { | |
5141 float invmag = 1.0f / sqrtf(v->x * v->x + v->y * v->y + v->z * v->z); | |
5142 v->x *= invmag; | |
5143 v->y *= invmag; | |
5144 v->z *= invmag; | |
5145 } | |
781 | 5146 |
168 | 5147 void MatrixRotationAxis(matrix *pout, CONST vector *pv, float angle) |
5148 { | |
5149 memset(pout, 0, sizeof(matrix)); | |
5150 pout->m[3][0] = 0; | |
5151 pout->m[3][1] = 0; | |
5152 pout->m[3][2] = 0; | |
5153 pout->m[3][3] = 1; | |
5154 | |
5155 vector v; | |
5156 v.x = pv->x; v.y = pv->y; v.z = pv->z; | |
5157 VectorNormalize(&v); | |
5158 | |
5159 pout->m[0][0] = (1.0f - cos(angle)) * v.x * v.x + cos(angle); | |
5160 pout->m[1][0] = (1.0f - cos(angle)) * v.x * v.y - sin(angle) * v.z; | |
5161 pout->m[2][0] = (1.0f - cos(angle)) * v.x * v.z + sin(angle) * v.y; | |
5162 pout->m[0][1] = (1.0f - cos(angle)) * v.y * v.x + sin(angle) * v.z; | |
5163 pout->m[1][1] = (1.0f - cos(angle)) * v.y * v.y + cos(angle); | |
5164 pout->m[2][1] = (1.0f - cos(angle)) * v.y * v.z - sin(angle) * v.x; | |
5165 pout->m[0][2] = (1.0f - cos(angle)) * v.z * v.x - sin(angle) * v.y; | |
5166 pout->m[1][2] = (1.0f - cos(angle)) * v.z * v.y + sin(angle) * v.x; | |
5167 pout->m[2][2] = (1.0f - cos(angle)) * v.z * v.z + cos(angle); | |
5168 } | |
781 | 5169 |
168 | 5170 void VectorTransform(const matrix *m, const vector *v, vector *out) |
5171 { | |
5172 out->x = m->m[0][0] * v->x + m->m[1][0] * v->y + m->m[2][0] * v->z + m->m[3][0]; | |
5173 out->y = m->m[0][1] * v->x + m->m[1][1] * v->y + m->m[2][1] * v->z + m->m[3][1]; | |
5174 out->z = m->m[0][2] * v->x + m->m[1][2] * v->y + m->m[2][2] * v->z + m->m[3][2]; | |
5175 } | |
5176 | |
5177 bool DrawSkyD3D_Skybox() | |
5178 { | |
5179 static bool initialized = false, | |
5180 initialization_failed = false; | |
5181 if (initialization_failed) | |
5182 return false; | |
5183 | |
5184 static int last_camera_rot_y, | |
5185 last_camera_rot_x; | |
5186 if (!initialized) | |
5187 { | |
5188 if (!Skybox_Initialize(L"data/skybox/stars")) | |
5189 { | |
5190 initialization_failed = true; | |
5191 return false; | |
5192 } | |
5193 initialized = true; | |
5194 | |
5195 last_camera_rot_y = pParty->sRotationY + 1; // force update for the first run | |
5196 last_camera_rot_x = pParty->sRotationX + 1; | |
5197 } | |
5198 | |
5199 /* | |
5200 r(y) = | |
5201 cos y 0 sin y 0 | |
5202 0 1 0 0 | |
5203 -sin y 0 cos y 0 | |
5204 0 0 0 1 | |
5205 | |
5206 x cos y - z sin y | |
5207 y | |
5208 x sin y + z cos y | |
5209 1 | |
5210 | |
5211 | |
5212 | |
5213 r(x) = // should be r(right) actually | |
5214 1 0 0 0 | |
5215 0 cos x -sin x 0 | |
5216 0 sin x cos x 0 | |
5217 0 0 0 1 | |
5218 | |
5219 | |
5220 x | |
5221 y cos x + z sin x | |
5222 -y sin x + z cos x | |
5223 1 | |
5224 | |
5225 */ | |
5226 | |
5227 if (last_camera_rot_y == pParty->sRotationY && | |
5228 last_camera_rot_x == pParty->sRotationX) | |
5229 { | |
5230 draw: | |
5231 struct RenderVertexD3D3 v[6]; | |
5232 | |
692 | 5233 v[0].pos.x = pViewport->uScreen_TL_X; |
5234 v[0].pos.y = pViewport->uScreen_TL_Y; | |
168 | 5235 v[0].pos.z = 0.99989998; |
5236 v[0].rhw = 1; | |
5237 v[0].diffuse = 0xFFFFFFFF; | |
5238 v[0].specular = 0; | |
5239 v[0].texcoord.x = 0; | |
5240 v[0].texcoord.y = 0; | |
5241 | |
692 | 5242 v[1].pos.x = pViewport->uScreen_TL_X + pViewport->uScreenWidth; |
5243 v[1].pos.y = pViewport->uScreen_TL_Y + pViewport->uScreenHeight; | |
168 | 5244 v[1].pos.z = 0.99989998; |
5245 v[1].rhw = 1; | |
5246 v[1].diffuse = 0xFFFFFFFF; | |
5247 v[1].specular = 0; | |
5248 v[1].texcoord.x = (float)pViewport->uScreenWidth / skybox_width; | |
5249 v[1].texcoord.y = (float)pViewport->uScreenHeight / skybox_height; | |
5250 | |
692 | 5251 v[2].pos.x = pViewport->uScreen_TL_X + pViewport->uScreenWidth; |
5252 v[2].pos.y = pViewport->uScreen_TL_Y; | |
168 | 5253 v[2].pos.z = 0.99989998; |
5254 v[2].rhw = 1; | |
5255 v[2].diffuse = 0xFFFFFFFF; | |
5256 v[2].specular = 0; | |
5257 v[2].texcoord.x = (float)pViewport->uScreenWidth / skybox_width; | |
5258 v[2].texcoord.y = 0; | |
5259 | |
5260 memcpy(&v[3], &v[0], sizeof(*v)); | |
5261 | |
692 | 5262 v[4].pos.x = pViewport->uScreen_TL_X; |
5263 v[4].pos.y = pViewport->uScreen_TL_Y + pViewport->uScreenHeight; | |
168 | 5264 v[4].pos.z = 0.99989998; |
5265 v[4].rhw = 1; | |
5266 v[4].diffuse = 0xFFFFFFFF; | |
5267 v[4].specular = 0; | |
5268 v[4].texcoord.x = 0; | |
5269 v[4].texcoord.y = (float)pViewport->uScreenHeight / skybox_height; | |
5270 | |
5271 memcpy(&v[5], &v[1], sizeof(*v)); | |
5272 | |
5273 pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE); | |
5274 pRenderer->pRenderD3D->pDevice->SetTexture(0, skybox_texture); | |
5275 pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLELIST, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, v, 6, D3DDP_DONOTUPDATEEXTENTS | D3DDP_DONOTLIGHT); | |
5276 //pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLELIST, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, v + 1, 3, D3DDP_DONOTUPDATEEXTENTS | D3DDP_DONOTLIGHT); | |
5277 | |
5278 return true; | |
5279 } | |
5280 | |
5281 | |
5282 DDSURFACEDESC2 desc; | |
5283 desc.dwSize = sizeof(desc); | |
5284 if (!pRenderer->LockSurface_DDraw4(skybox_surface, &desc, DDLOCK_WAIT | DDLOCK_WRITEONLY)) | |
5285 return false; | |
5286 | |
5287 last_camera_rot_y = pParty->sRotationY; | |
5288 last_camera_rot_x = pParty->sRotationX; | |
5289 | |
5290 float aspect = (float)pViewport->uScreenWidth / (float)pViewport->uScreenHeight; | |
5291 float fov_x = 3.141592f * (pOutdoorCamera->uCameraFovInDegrees + 0) / 360.0f; | |
5292 float fov_y = fov_x / aspect; | |
5293 | |
5294 float ray_dx = fov_x / (float)pViewport->uScreenWidth, | |
5295 ray_dy = fov_y / (float)pViewport->uScreenHeight; | |
5296 float party_angle_x = 2 * 3.141592653589 * pParty->sRotationX / 2048.0, | |
5297 party_angle_y = 2 * 3.141592653589 * pParty->sRotationY / 2048.0; | |
5298 for (int y = 0; y < pViewport->uScreenHeight; ++y) | |
5299 for (int x = 0; x < pViewport->uScreenWidth; ++x) | |
5300 { | |
5301 float angle_x = party_angle_x - (y - pViewport->uScreenHeight / 2) * ray_dy; | |
5302 float angle_y = party_angle_y - (x - pViewport->uScreenWidth / 2) * ray_dx; | |
5303 | |
5304 float _dir_x_ = 1, | |
5305 _dir_y_ = 0, | |
5306 _dir_z_ = 0; | |
5307 | |
5308 float dir_x_ = _dir_x_ * cosf(angle_y);// - _dir_z_ * sinf(angle_y); // rotation around y | |
5309 //float dir_y_ = _dir_y_; | |
5310 float dir_z_ = _dir_x_ * sinf(angle_y);// + _dir_z_ * cosf(angle_y); | |
5311 | |
5312 //float dir_x = dir_x_; // rotation around x | |
5313 //float dir_y = /*dir_y_ * cosf(angle_x)*/ + dir_z_ * sinf(angle_x); | |
5314 //float dir_z = /*-dir_y_ * sinf(angle_x)*/ + dir_z_ * cosf(angle_x); | |
5315 | |
5316 vector right; // rotate around right actually to avoid space distortion | |
5317 right.x = /*dir_y * 0*/ - dir_z_ * 1; | |
5318 right.y = /*dir_z_ * 0 - dir_x_ * */0; | |
5319 right.z = dir_x_ * 1/* - dir_y_ * 0*/; | |
5320 //VectorNormalize(&right); | |
5321 | |
5322 matrix rightMatrix; | |
5323 MatrixRotationAxis(&rightMatrix, &right, angle_x); | |
5324 | |
5325 vector v1, v2; | |
5326 v1.x = dir_x_; v1.y = 0; v1.z = dir_z_; | |
5327 VectorTransform(&rightMatrix, &v1, &v2); | |
5328 | |
5329 float dir_x = v2.x, | |
5330 dir_y = v2.y, | |
5331 dir_z = v2.z; | |
5332 | |
5333 float abs_dir_x = fabsf(dir_x), | |
5334 abs_dir_y = fabsf(dir_y), | |
5335 abs_dir_z = fabsf(dir_z); | |
5336 | |
5337 unsigned short color = (0x1F << 11) | (0x1F << 5) | (5); //default to orange | |
5338 if (abs_dir_x >= abs_dir_y) | |
5339 { | |
5340 if (abs_dir_x >= abs_dir_z) | |
5341 { | |
5342 if (dir_x >= 0) | |
5343 { | |
5344 float instersect_y = dir_y / (2.0f * dir_x); // plane equation for this side is x + 0.5 = 0 | |
5345 float instersect_z = dir_z / (2.0f * dir_x); | |
5346 | |
5347 float u = 1.0f - (instersect_z + 0.5f), | |
5348 v = 1.0f - (instersect_y + 0.5f); | |
5349 | |
5350 int tx = u * (skybox_width - 1), | |
5351 ty = v * (skybox_height - 1); | |
5352 | |
5353 color = skybox_xp[ty * skybox_width + tx]; | |
5354 //color = ty * 0x1F / skybox_height; | |
5355 } | |
5356 else | |
5357 { | |
5358 float instersect_y = dir_y / (2.0f * dir_x); | |
5359 float instersect_z = dir_z / (2.0f * dir_x); | |
5360 | |
5361 float u = 1.0f - (instersect_z + 0.5f), | |
5362 v = instersect_y + 0.5f; | |
5363 | |
5364 int tx = u * (skybox_width - 1), | |
5365 ty = v * (skybox_height - 1); | |
5366 | |
5367 color = skybox_xn[ty * skybox_width + tx]; | |
5368 //color = tx * 0x1F / skybox_height; | |
5369 } | |
5370 } | |
5371 else if (dir_z >= 0) | |
5372 goto DIR_ZP; | |
5373 else | |
5374 goto DIR_ZN; | |
5375 } | |
5376 else if (abs_dir_y >= abs_dir_z) | |
5377 { | |
5378 if (dir_y >= 0) | |
5379 { | |
5380 float instersect_x = dir_x / (2.0f * dir_y); | |
5381 float instersect_z = dir_z / (2.0f * dir_y); | |
5382 | |
5383 float u = instersect_x + 0.5f, | |
5384 v = instersect_z + 0.5f; | |
5385 | |
5386 int tx = u * (skybox_width - 1), | |
5387 ty = v * (skybox_height - 1); | |
5388 | |
5389 color = skybox_yp[ty * skybox_width + tx]; | |
5390 //color = tx * 0x1F / skybox_height; | |
5391 } | |
5392 /*else should never be seen i guess | |
5393 { | |
5394 __debugbreak(); | |
5395 // -y | |
5396 //Log::Warning(L"(%03u, %03u): -y", x, y); | |
5397 }*/ | |
5398 } | |
5399 else if (dir_z >= 0) | |
5400 { | |
5401 DIR_ZP: | |
5402 // +z | |
5403 float instersect_x = dir_x / (2.0f * dir_z); | |
5404 float instersect_y = dir_y / (2.0f * dir_z); | |
5405 //float intersect_z = 0.5f; | |
5406 | |
5407 float u = instersect_x + 0.5f, | |
5408 v = -instersect_y + 0.5f; | |
5409 | |
5410 int tx = u * (skybox_width - 1), | |
5411 ty = v * (skybox_height - 1); | |
5412 | |
5413 color = skybox_zp[ty * skybox_width + tx]; | |
5414 } | |
5415 else | |
5416 { | |
5417 DIR_ZN: | |
5418 // -z | |
5419 float instersect_x = -dir_x / (2.0f * dir_z); | |
5420 float instersect_y = -dir_y / (2.0f * dir_z); | |
5421 //float intersect_z = -0.5f; | |
5422 | |
5423 float u = 1.0f - instersect_x - 0.5f, | |
5424 v = -instersect_y + 0.5f; | |
5425 | |
5426 int tx = u * (skybox_width - 1), | |
5427 ty = v * (skybox_height - 1); | |
5428 | |
5429 color = skybox_zn[ty * skybox_width + tx]; | |
5430 } | |
5431 | |
5432 //pRenderer->pTargetSurface[(pViewport->uScreenY + y) * pRenderer->uTargetSurfacePitch + pViewport->uScreenX + x] = color; | |
5433 ((unsigned __int16 *)((char *)desc.lpSurface + y * desc.lPitch))[x] = color; | |
5434 } | |
5435 | |
5436 ErrD3D((skybox_surface)->Unlock(0)); | |
5437 goto draw; | |
5438 } | |
5439 | |
0 | 5440 //----- (00479543) -------------------------------------------------------- |
5441 void Render::DrawSkyD3D() | |
5442 { | |
5443 int v0; // esi@2 | |
5444 int v1; // eax@2 | |
5445 int v8; // eax@4 | |
5446 int v9; // eax@4 | |
5447 int v10; // ebx@4 | |
5448 signed __int64 v11; // qax@6 | |
1344 | 5449 //double v12; // st7@6 |
0 | 5450 int v13; // edi@6 |
5451 int v14; // ecx@6 | |
1344 | 5452 //int v15; // eax@8 |
0 | 5453 int v16; // eax@12 |
5454 signed __int64 v17; // qtt@13 | |
1344 | 5455 signed int pShading; // ecx@13 |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
5456 struct Polygon pSky; // [sp+14h] [bp-150h]@1 |
0 | 5457 float v28; // [sp+12Ch] [bp-38h]@2 |
5458 int v29; // [sp+130h] [bp-34h]@4 | |
5459 int v30; // [sp+134h] [bp-30h]@1 | |
5460 int v32; // [sp+13Ch] [bp-28h]@6 | |
5461 int v33; // [sp+140h] [bp-24h]@2 | |
67 | 5462 int v34; // [sp+144h] [bp-20h]@1 |
0 | 5463 int v35; // [sp+148h] [bp-1Ch]@4 |
67 | 5464 int v36; // [sp+14Ch] [bp-18h]@2 |
0 | 5465 int v37; // [sp+154h] [bp-10h]@8 |
5466 int v38; // [sp+158h] [bp-Ch]@1 | |
5467 int v39; // [sp+15Ch] [bp-8h]@4 | |
5468 int v40; // [sp+160h] [bp-4h]@7 | |
168 | 5469 |
5470 extern bool new_sky; | |
5471 if (new_sky) | |
5472 { | |
5473 if (DrawSkyD3D_Skybox()) | |
5474 return; | |
5475 } | |
0 | 5476 |
67 | 5477 v30 = ((double)(pOutdoorCamera->int_fov_rad * pIndoorCamera->pos.z) |
5478 / ((double)pOutdoorCamera->int_fov_rad + 8192.0) + pViewport->uScreenCenterY); | |
1344 | 5479 v38 = pViewport->uScreenCenterY - pOutdoorCamera->int_fov_rad / |
5480 (pOutdoorCamera->shading_dist_mist * cos(pIndoorCamera->sRotationX * 0.003066406352445483) + 0.0000001000000011686097) * | |
5481 (pOutdoorCamera->shading_dist_mist * -sin(pIndoorCamera->sRotationX * 0.003066406352445483) - pIndoorCamera->pos.z); | |
5482 | |
5483 pSky._48607B(&stru_8019C8); | |
5484 pSky.ptr_38->sky_48694B(); | |
5485 pSky.uTileBitmapID = pOutdoor->uSky_TextureID;//íîìåð òåêñòóðû | |
5486 pSky.pTexture = (Texture *)(pOutdoor->uSky_TextureID != -1 ? &pBitmaps_LOD->pTextures[pOutdoor->uSky_TextureID] : 0);//òåêñòóðà íåáà | |
67 | 5487 if (pOutdoor->uSky_TextureID == -1) |
5488 return; | |
168 | 5489 |
1344 | 5490 pSky.dimming_level = 0;//çàòåìíåíèå |
5491 pSky.uNumVertices = 4;//êîëè÷åñòâî âåðøèí | |
5492 | |
5493 //centering(öåíòðóåì)--------------------------------------------------------------- | |
5494 pSky.v_18.x = -stru_5C6E00->Sin(pIndoorCamera->sRotationX + 16);//-3216 | |
5495 pSky.v_18.y = 0; | |
5496 pSky.v_18.z = -stru_5C6E00->Cos(pIndoorCamera->sRotationX + 16);//-65457 | |
5497 //--------------------------------------------------------------------------- | |
5498 | |
5499 pSky.field_24 = 0x2000000; | |
5500 | |
5501 pSky.sTextureDeltaU = 224 * pMiscTimer->uTotalGameTimeElapsed; | |
5502 pSky.sTextureDeltaV = 224 * pMiscTimer->uTotalGameTimeElapsed; | |
5503 | |
5504 //sky position(ïîëîæåíèå íåáà)---------------------------------------------- | |
693 | 5505 array_50AC10[0].vWorldViewProjX = pViewport->uViewportTL_X; |
5506 array_50AC10[0].vWorldViewProjY = pViewport->uViewportTL_Y; | |
5507 | |
5508 array_50AC10[1].vWorldViewProjX = pViewport->uViewportTL_X; | |
67 | 5509 array_50AC10[1].vWorldViewProjY = v38; |
5510 | |
693 | 5511 array_50AC10[2].vWorldViewProjX = pViewport->uViewportBR_X; |
840 | 5512 array_50AC10[2].vWorldViewProjY = v38; |
693 | 5513 |
5514 array_50AC10[3].vWorldViewProjX = pViewport->uViewportBR_X; | |
840 | 5515 array_50AC10[3].vWorldViewProjY = pViewport->uViewportTL_Y; |
1344 | 5516 //-------------------------------------------------------------------------- |
840 | 5517 |
895 | 5518 //pParty->sRotationY / 2048.0f |
1344 | 5519 // move sky(äâèäåíèå íåáà)--------------include----------------------------- |
895 | 5520 float t = (GetTickCount() % 96000) / 96000.0f; |
5521 array_50AC10[0].u = t - pParty->sRotationY / 1024.0f; | |
5522 array_50AC10[0].v = t - pParty->sRotationX / 512.0f; | |
5523 | |
5524 array_50AC10[1].u = t - pParty->sRotationY / 1024.0f; | |
5525 array_50AC10[1].v = 1 + t - pParty->sRotationX / 512.0f; | |
5526 | |
5527 array_50AC10[2].u = 1 + t - pParty->sRotationY / 1024.0f; | |
5528 array_50AC10[2].v = 1 + t - pParty->sRotationX / 512.0f; | |
5529 | |
5530 array_50AC10[3].u = 1 + t - pParty->sRotationY / 1024.0f; | |
5531 array_50AC10[3].v = t - pParty->sRotationX / 512.0f; | |
1344 | 5532 //-------------------------------------------------------------------------- |
5533 | |
5534 //rotate skydome(âðàùåíèå êóïîëà íåáà)-------------------------------------- | |
5535 v36 = (pViewport->uViewportBR_X - pViewport->uViewportTL_X) * 0.5;//öåíòð ýêðàíà 230 | |
5536 v33 = 65536 / (signed int)(v36 / tan(0.6457717418670654) + 0.5);//214 | |
5537 | |
5538 for (uint i = 0; i < pSky.uNumVertices; ++i) | |
5539 { | |
5540 v29 = floorf(array_50AC10[i].vWorldViewProjY + 0.5f);//8 | |
5541 v39 = (unsigned __int64)(pSky.ptr_38->field_14 * v33 * (v30 - v29)) / 65536;//0 | |
5542 v8 = v39 + pSky.ptr_38->field_C;//0 | |
5543 | |
5544 v39 = (unsigned __int64)(pSky.ptr_38->field_20 * v33 * (v30 - v29)) / 65536;//0 | |
5545 v36 = v39 + pSky.ptr_38->field_18;//65536 | |
5546 | |
5547 v9 = (unsigned __int64)(pSky.v_18.z * v33 * (v30 - v29)) / 65536;//27917 | |
5548 v10 = pSky.v_18.x + v9;//24701 | |
5549 v39 = pSky.v_18.x + v9;//24701 | |
5550 if ( pSky.v_18.x + v9 > 0 ) | |
577 | 5551 { |
5552 v10 = 0; | |
5553 v39 = 0; | |
5554 } | |
840 | 5555 //v11 = (signed __int64)array_50AC10[i].vWorldViewProjX; |
577 | 5556 v38 = v10; |
1344 | 5557 //v12 = array_50AC10[i].vWorldViewProjY - 1.0; |
840 | 5558 v13 = v33 * (pViewport->uScreenCenterX - (signed __int64)array_50AC10[i].vWorldViewProjX); |
1344 | 5559 v34 = -pSky.field_24; |
5560 v32 = (signed __int64)array_50AC10[i].vWorldViewProjY - 1.0; | |
577 | 5561 v14 = v33 * (v30 - v32); |
1344 | 5562 |
577 | 5563 while ( 1 ) |
5564 { | |
1344 | 5565 v40 = v14; |
577 | 5566 if ( !v10 ) |
5567 { | |
1344 | 5568 v37 = pSky.v_18.z; |
5569 v16 = (unsigned __int64)(pSky.v_18.z * (signed __int64)v14) >> 16; | |
0 | 5570 --v32; |
5571 v14 += v33; | |
1344 | 5572 v10 = pSky.v_18.x + v16; |
5573 v39 = pSky.v_18.x + v16; | |
5574 v38 = pSky.v_18.x + v16; | |
67 | 5575 break; |
5576 } | |
577 | 5577 v37 = abs(v34 >> 14); |
1344 | 5578 if ( abs(v34 >> 14) <= abs(v10) || v32 <= pViewport->uViewportTL_Y ) |
577 | 5579 { |
5580 if ( v39 <= 0 ) | |
5581 break; | |
5582 } | |
1344 | 5583 v14 = v40; |
5584 v37 = pSky.v_18.z; | |
5585 v16 = (unsigned __int64)(pSky.v_18.z * v14) >> 16; | |
577 | 5586 --v32; |
5587 v14 += v33; | |
1344 | 5588 v10 = pSky.v_18.x + v16; |
5589 v39 = pSky.v_18.x + v16; | |
5590 v38 = pSky.v_18.x + v16; | |
577 | 5591 break; |
5592 } | |
1344 | 5593 |
577 | 5594 LODWORD(v17) = v34 << 16; |
5595 HIDWORD(v17) = v34 >> 16; | |
1344 | 5596 pShading = v17 / v38; |
5597 if ( pShading < 0 ) | |
5598 pShading = pOutdoorCamera->shading_dist_mist; | |
5599 | |
5600 v37 += ((unsigned __int64)(pSky.ptr_38->field_10 * v13) >> 16); | |
5601 v36 += ((unsigned __int64)(pSky.ptr_38->field_1C * v13) >> 16); | |
5602 v35 = 224 * pMiscTimer->uTotalGameTimeElapsed + fixpoint_sub0(v37, pShading) / 8; | |
5603 v36 = 224 * pMiscTimer->uTotalGameTimeElapsed + fixpoint_sub0(v36, pShading) / 8; | |
840 | 5604 |
579 | 5605 //array_50AC10[i].vWorldViewPosition.x = pOutdoorCamera->shading_dist_mist; |
1344 | 5606 //array_50AC10[i].vWorldPosition.x = v36 / (pSky.pTexture->uTextureHeight * 65536.0); |
840 | 5607 //array_50AC10[i].vWorldPosition.y = 1.0 / (pOutdoorCamera->shading_dist_mist >> 16); |
1344 | 5608 //array_50AC10[i].vWorldPosition.z = v35 / (pSky.pTexture->uTextureWidth * 65536.0); |
895 | 5609 //array_50AC10[i]._rhw = 1.0f / (v18 >> 16); |
1344 | 5610 //array_50AC10[i].u = (double)v35 / (65536.0 * pSky.pTexture->uTextureWidth); |
5611 //array_50AC10[i].v = (double)v36 / (65536.0 * pSky.pTexture->uTextureHeight); | |
5612 //----------------------------------------------------------------------------------------- | |
5613 | |
895 | 5614 array_50AC10[i]._rhw = 1.0f; |
1344 | 5615 } |
5616 //if ( i == _this.uNumVertices - 1 ) | |
5617 //{ | |
5618 pRenderer->DrawSkyPolygon(pSky.uNumVertices, &pSky, pBitmaps_LOD->pHardwareTextures[pSky.uTileBitmapID]); | |
5619 | |
5620 array_50AC10[0].vWorldViewProjY = v38; | |
5621 array_50AC10[1].vWorldViewProjY = array_50AC10[1].vWorldViewProjY + 30.0; | |
5622 array_50AC10[2].vWorldViewProjY = array_50AC10[2].vWorldViewProjY + 30.0; | |
5623 array_50AC10[3].vWorldViewProjY = v38; | |
5624 | |
5625 pRenderer->DrawSkyPolygon(pSky.uNumVertices, &pSky, pBitmaps_LOD->pHardwareTextures[pSky.uTileBitmapID]); | |
5626 //} | |
0 | 5627 } |
5628 | |
5629 //----- (0047A384) -------------------------------------------------------- | |
5630 void ODM_LoadAndInitialize(const char *pLevelFilename, OutdoorCamera *thisa) | |
5631 { | |
5632 int v2; // ebx@3 | |
5633 unsigned int v3; // eax@3 | |
5634 MapInfo *v4; // edi@4 | |
5635 //int v5; // eax@8 | |
5636 //SpawnPointMM7 *v6; // edx@14 | |
5637 size_t v7; // eax@19 | |
5638 char *v8; // eax@19 | |
5639 char *v9; // eax@21 | |
5640 char Source[120]; // [sp+Ch] [bp-84h]@19 | |
5641 const char *pFilename; // [sp+84h] [bp-Ch]@1 | |
5642 //unsigned int v12; // [sp+88h] [bp-8h]@12 | |
5643 //int v13; // [sp+8Ch] [bp-4h]@11 | |
5644 | |
5645 pFilename = pLevelFilename; | |
5646 thisa->AllocSoftwareDrawBuffers(); | |
5647 pOutdoorCamera->_485F64(); | |
5648 pWeather->bRenderSnow = 0; | |
5649 pRenderer->ClearZBuffer(0, 479); | |
5650 thisa = (OutdoorCamera *)1; | |
5651 GetAlertStatus(); | |
5652 if ( qword_A750D8 ) | |
5653 qword_A750D8 = 0i64; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
5654 v2 = pMapStats->GetMapInfo(pCurrentMapName.data()); |
0 | 5655 v3 = 0; |
5656 if ( v2 ) | |
5657 { | |
5658 v4 = &pMapStats->pInfos[v2]; | |
5659 v3 = v4->uRespawnIntervalDays; | |
5660 } | |
5661 else | |
5662 { | |
5663 v4 = (MapInfo *)thisa; | |
5664 } | |
767 | 5665 day_attrib &= ~DAY_ATTRIB_FOG; |
0 | 5666 dword_6BE13C_uCurrentlyLoadedLocationID = v2; |
5667 pOutdoor->Initialize( | |
5668 pFilename, | |
5669 (unsigned int)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 0x3C / 0x3C / 0x18 + 1, | |
5670 v3, | |
5671 (int)&thisa); | |
5672 if ( !(BYTE1(dword_6BE364_game_settings_1) & 0x20) ) | |
5673 { | |
5674 InitializeActors(); | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
5675 InitializeSpriteObjects(); |
0 | 5676 } |
5677 BYTE1(dword_6BE364_game_settings_1) &= 0xDFu; | |
5678 //v5 = 0; | |
5679 if ( !v2 ) | |
5680 thisa = 0; | |
5681 if ( thisa == (OutdoorCamera *)1 ) | |
5682 { | |
5683 //v13 = 0; | |
5684 for (uint i = 0; i < pOutdoor->uNumSpawnPoints; ++i) | |
5685 { | |
5686 //v12 = 0; | |
5687 //while ( 1 ) | |
5688 //{ | |
5689 auto spawn = pOutdoor->pSpawnPoints + i; | |
5690 //v6 = &pOutdoor->pSpawnPoints[v12 / 0x18]; | |
5691 if (spawn->uKind == 3 ) | |
5692 SpawnEncounter(v4, spawn, 0, 0, 0); | |
5693 else | |
5694 v4->SpawnRandomTreasure(spawn); | |
5695 //++v13; | |
5696 //v12 += 24; | |
5697 //if ( v13 >= (signed int)pOutdoor->uNumSpawnPoints ) | |
5698 // break; | |
5699 //v5 = 0; | |
5700 //} | |
5701 } | |
5702 RespawnGlobalDecorations(); | |
5703 } | |
5704 pOutdoor->PrepareDecorations(); | |
5705 pOutdoor->_47F223_LooksLikeGenerateMonsterLoot(); | |
5706 pOutdoor->InitalizeActors(v2); | |
5707 pOutdoor->MessWithLUN(); | |
5708 v7 = strlen("levels\\"); | |
5709 strcpy(Source, &pFilename[v7]); | |
5710 strcpy(pOutdoor->pLevelFilename, Source); | |
5711 pWeather->Initialize(); | |
5712 pIndoorCamera->sRotationY = pParty->sRotationY; | |
5713 pIndoorCamera->sRotationX = pParty->sRotationX; | |
5714 pOutdoorCamera->RotationToInts(); | |
5715 pOutdoor->UpdateSunlightVectors(); | |
5716 pOutdoorCamera->int_fov_rad = (signed __int64)pIndoorCamera->flt_1C_fov; | |
5717 pOutdoorCamera->int_fov_rad_inv = (signed __int64)pIndoorCamera->flt_20_inv_1C; | |
5718 v8 = (char *)&array_77EC08[0].ptr_38; | |
5719 do | |
5720 { | |
5721 *(int *)v8 = (int)&stru_8019C8; | |
5722 v8 += 268; | |
5723 } | |
5724 while ( (signed int)v8 < (signed int)&unk_801A00 ); | |
5725 v9 = (char *)&array_77EC08[0].prolly_tail; | |
5726 do | |
5727 { | |
5728 *((int *)v9 - 1) = 0; | |
5729 *(int *)v9 = 0; | |
5730 *((int *)v9 - 5) = 0; | |
5731 v9 += 268; | |
5732 } | |
5733 while ( (signed int)v9 < (signed int)&unk_801A0C ); | |
5734 MM7Initialization(); | |
5735 } | |
5736 | |
5737 //----- (0047A825) -------------------------------------------------------- | |
5738 bool LevelDecoration::_47A825() | |
5739 { | |
5740 bool v1; // ebx@1 | |
5741 LevelDecoration *v2; // edi@1 | |
5742 | |
5743 v1 = 0; | |
5744 v2 = this; | |
484 | 5745 if ( pParty->uCurrentHour >= 1 || (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 178) ) |
0 | 5746 { |
5747 v1 = 0; | |
5748 } | |
5749 else | |
5750 { | |
484 | 5751 if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 164) |
5752 && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 165) | |
5753 && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 166) | |
5754 && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 167) | |
5755 && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 168) | |
5756 && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 169) | |
5757 && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 170) | |
5758 && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 171) | |
5759 && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 172) | |
5760 && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 173) | |
5761 && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 174) | |
5762 && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 175) | |
5763 && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 176) | |
5764 && (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 177) ) | |
0 | 5765 { |
5766 v1 = 1; | |
5767 LOBYTE(v2->field_2) &= 0xDFu; | |
5768 return v1; | |
5769 } | |
5770 } | |
5771 LOBYTE(v2->field_2) |= 0x20u; | |
5772 return v1; | |
5773 } | |
5774 | |
5775 //----- (0047BC6F) -------------------------------------------------------- | |
5776 unsigned __int16 *__fastcall GetBillboardPalette(RenderBillboard *a1, int a2, signed int a3, int a4) | |
5777 { | |
5778 int v4; // ebx@1 | |
5779 int v6; // edx@4 | |
5780 int v7; // ecx@5 | |
5781 signed int v8; // eax@6 | |
5782 signed __int64 v9; // qtt@11 | |
5783 signed int v10; // eax@12 | |
5784 int v11; // esi@17 | |
5785 signed __int64 v12; // qtt@19 | |
5786 double v13; // ST10_8@19 | |
5787 int v14; // edi@25 | |
5788 signed int v15; // edx@26 | |
5789 signed __int64 v16; // qtt@29 | |
5790 signed int v17; // eax@30 | |
5791 int v18; // [sp+10h] [bp-8h]@1 | |
5792 float a3a; // [sp+20h] [bp+8h]@19 | |
5793 | |
5794 v4 = a2; | |
5795 v18 = a2; | |
349 | 5796 if ( pParty->armageddon_timer ) |
0 | 5797 return PaletteManager::Get(a2); |
750 | 5798 if ( !pWeather->bNight ) |
0 | 5799 { |
767 | 5800 if (day_attrib & DAY_ATTRIB_FOG) |
0 | 5801 { |
5802 v14 = day_fogrange_1 << 16; | |
5803 if ( a3 >= day_fogrange_1 << 16 ) | |
5804 { | |
5805 if ( a3 <= day_fogrange_2 << 16 ) | |
5806 { | |
5807 LODWORD(v16) = (a3 - v14) << 16; | |
5808 HIDWORD(v16) = (a3 - v14) >> 16; | |
5809 v15 = (unsigned __int64)(27 * v16 / ((day_fogrange_2 - day_fogrange_1) << 16)) >> 16; | |
5810 } | |
5811 else | |
5812 { | |
5813 v15 = 27; | |
5814 } | |
5815 } | |
5816 else | |
5817 { | |
5818 v15 = 0; | |
5819 } | |
5820 v17 = _43F55F_get_billboard_light_level(a1, v15); | |
5821 if ( v17 > 27 ) | |
5822 v17 = 27; | |
5823 if ( !a3 ) | |
5824 v17 = 27; | |
5825 v7 = v18; | |
5826 v6 = v17; | |
5827 return (unsigned __int16 *)PaletteManager::Get_Mist_or_Red_LUT(v7, v6, 1); | |
5828 } | |
5829 v11 = a4; | |
5830 if ( a4 < 0 ) | |
5831 v11 = 0; | |
5832 LODWORD(v12) = a3 << 16; | |
5833 HIDWORD(v12) = a3 >> 16; | |
5834 a3a = (double)(signed int)(((unsigned __int64)(11 * v12 / (pOutdoorCamera->shading_dist_shade << 16)) >> 16) + 20) | |
5835 * pOutdoor->fFogDensity; | |
5836 v13 = a3a + 6.7553994e15; | |
5837 v10 = _43F55F_get_billboard_light_level(a1, LODWORD(v13) + v11); | |
5838 if ( v10 > 27 ) | |
5839 v10 = 27; | |
5840 if ( v10 < a4 ) | |
5841 v10 = a4; | |
638 | 5842 if ( v10 > pOutdoor->max_terrain_dimming_level ) |
5843 v10 = pOutdoor->max_terrain_dimming_level; | |
0 | 5844 return PaletteManager::Get_Dark_or_Red_LUT(v4, v10, 1); |
5845 } | |
5846 v6 = 0; | |
750 | 5847 if (pWeather->bNight) |
0 | 5848 { |
5849 v8 = 67108864; | |
1167 | 5850 if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uExpireTime > 0 ) |
5851 v8 = pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uPower << 26; | |
0 | 5852 if ( a3 <= v8 ) |
5853 { | |
5854 if ( a3 > 0 ) | |
5855 { | |
5856 LODWORD(v9) = a3 << 16; | |
5857 HIDWORD(v9) = a3 >> 16; | |
5858 v6 = (unsigned __int64)(27 * v9 / v8) >> 16; | |
5859 } | |
5860 } | |
5861 else | |
5862 { | |
5863 v6 = 27; | |
5864 } | |
5865 v10 = _43F55F_get_billboard_light_level(a1, v6); | |
5866 if ( v10 > 27 || !a3 ) | |
5867 v10 = 27; | |
5868 return PaletteManager::Get_Dark_or_Red_LUT(v4, v10, 1); | |
5869 } | |
5870 v7 = 0; | |
5871 return (unsigned __int16 *)PaletteManager::Get_Mist_or_Red_LUT(v7, v6, 1); | |
5872 } | |
5873 | |
5874 //----- (0047C370) -------------------------------------------------------- | |
5875 unsigned int __cdecl GetLevelFogColor() | |
5876 { | |
5877 unsigned int result; // eax@2 | |
5878 signed __int64 v1; // qax@5 | |
5879 int v2; // eax@6 | |
5880 | |
5881 if ( bUnderwater ) | |
5882 { | |
767 | 5883 result = 0xFF258F5C; |
5884 } | |
5885 else | |
5886 { | |
5887 if (day_attrib & DAY_ATTRIB_FOG) | |
5888 { | |
5889 if ( pWeather->bNight ) // night-time fog | |
750 | 5890 { |
5891 __debugbreak(); // decompilation can be inaccurate, please send savegame to Nomad | |
5892 v2 = -(pWeather->bNight != 1); | |
0 | 5893 result = (v2 & 0xE0E0E1) - 0xE0E0E1; |
5894 } | |
5895 else | |
5896 { | |
5897 v1 = (signed __int64)((1.0 - pOutdoor->fFogDensity) * 200.0 + pOutdoor->fFogDensity * 31.0); | |
5898 result = v1 | (((unsigned int)v1 | (((unsigned int)v1 | 0xFFFFFF00) << 8)) << 8); | |
5899 } | |
5900 } | |
5901 else | |
767 | 5902 return 0; |
0 | 5903 } |
5904 return result; | |
5905 } | |
5906 // 6BE030: using guessed type int day_attrib; | |
5907 // 6BE3C4: using guessed type char bUnderwater; | |
5908 | |
5909 //----- (0047C3D7) -------------------------------------------------------- | |
5910 int __fastcall sub_47C3D7_get_fog_related_stuff(int a1, int a2, float a3) | |
5911 { | |
5912 int v3; // ecx@1 | |
5913 double v5; // st7@10 | |
5914 signed int v6; // esi@10 | |
5915 signed int v7; // ecx@11 | |
5916 double v8; // st6@12 | |
5917 double v9; // st7@15 | |
5918 double v10; // st6@16 | |
5919 float v11; // ST14_4@17 | |
5920 double v12; // ST08_8@17 | |
5921 | |
750 | 5922 v3 = pWeather->bNight; |
0 | 5923 if ( bUnderwater == 1 ) |
5924 v3 = 0; | |
767 | 5925 if ( pParty->armageddon_timer || !(day_attrib & DAY_ATTRIB_FOG) && !bUnderwater ) |
349 | 5926 return 0xFF000000; |
0 | 5927 if ( v3 ) |
5928 { | |
5929 v5 = (double)day_fogrange_1; | |
5930 v6 = 216; | |
5931 if ( a3 < v5 ) | |
5932 goto LABEL_11; | |
5933 v8 = (double)day_fogrange_2; | |
5934 if ( a3 > v8 ) | |
5935 { | |
5936 LABEL_13: | |
5937 v7 = v6; | |
5938 goto LABEL_19; | |
5939 } | |
5940 v7 = (signed __int64)((a3 - v5) / (v8 - v5) * 216.0); | |
5941 } | |
5942 else | |
5943 { | |
5944 v9 = (double)day_fogrange_1; | |
5945 v6 = 216; | |
5946 if ( a3 < v9 ) | |
5947 { | |
5948 LABEL_11: | |
5949 v7 = 0; | |
5950 goto LABEL_19; | |
5951 } | |
5952 v10 = (double)day_fogrange_2; | |
5953 if ( a3 > v10 ) | |
5954 goto LABEL_13; | |
5955 v11 = (a3 - v9) * 216.0 / (v10 - v9); | |
5956 v12 = v11 + 6.7553994e15; | |
5957 v7 = LODWORD(v12); | |
5958 } | |
5959 if ( v7 > v6 ) | |
5960 { | |
5961 LABEL_20: | |
5962 v7 = v6; | |
5963 goto LABEL_21; | |
5964 } | |
5965 LABEL_19: | |
5966 if ( a3 == 0.0 ) | |
5967 goto LABEL_20; | |
5968 LABEL_21: | |
5969 if ( a2 ) | |
5970 v7 = 248; | |
5971 return (-1 - v7) << 24; | |
5972 } | |
349 | 5973 |
0 | 5974 //----- (0047C4FC) -------------------------------------------------------- |
638 | 5975 signed int __fastcall GetActorTintColor(int max_dimm, int min_dimm, float distance, int a4, RenderBillboard *a5) |
349 | 5976 { |
5977 //int v5; // esi@1 | |
0 | 5978 signed int v6; // edx@1 |
349 | 5979 //signed int result; // eax@2 |
0 | 5980 int v8; // eax@3 |
5981 double v9; // st7@12 | |
750 | 5982 //double v10; // ST0C_8@18 |
0 | 5983 int v11; // ecx@28 |
349 | 5984 //signed int v12; // edi@28 |
5985 //double v13; // ST0C_8@33 | |
5986 //double v14; // ST0C_8@34 | |
0 | 5987 double v15; // st7@44 |
349 | 5988 //double v16; // ST0C_8@44 |
5989 //double v17; // ST0C_8@44 | |
0 | 5990 int v18; // ST14_4@44 |
349 | 5991 //double v19; // ST0C_8@44 |
0 | 5992 signed int v20; // [sp+10h] [bp-4h]@10 |
5993 float a3a; // [sp+1Ch] [bp+8h]@33 | |
638 | 5994 //float a3b; // [sp+1Ch] [bp+8h]@34 |
0 | 5995 float a3c; // [sp+1Ch] [bp+8h]@44 |
349 | 5996 //float a3d; // [sp+1Ch] [bp+8h]@44 |
750 | 5997 //float a4b; // [sp+20h] [bp+Ch]@18 |
638 | 5998 //int a4a; // [sp+20h] [bp+Ch]@33 |
349 | 5999 //float a4c; // [sp+20h] [bp+Ch]@44 |
6000 //float a4d; // [sp+20h] [bp+Ch]@44 | |
0 | 6001 int a5a; // [sp+24h] [bp+10h]@44 |
6002 | |
349 | 6003 //v5 = a2; |
0 | 6004 v6 = 0; |
349 | 6005 |
6006 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
638 | 6007 return 8 * (31 - max_dimm) | ((8 * (31 - max_dimm) | ((31 - max_dimm) << 11)) << 8); |
6008 | |
349 | 6009 if (pParty->armageddon_timer) |
6010 return 0xFFFF0000; | |
6011 | |
750 | 6012 v8 = pWeather->bNight; |
638 | 6013 if (bUnderwater) |
0 | 6014 v8 = 0; |
6015 if ( v8 ) | |
6016 { | |
6017 v20 = 1; | |
349 | 6018 if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uExpireTime > 0 ) |
6019 v20 = pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uPower; | |
0 | 6020 v9 = (double)v20 * 1024.0; |
6021 if ( a4 ) | |
6022 goto LABEL_19; | |
638 | 6023 if ( distance <= v9 ) |
6024 { | |
6025 if ( distance > 0.0 ) | |
6026 { | |
750 | 6027 //a4b = distance * 216.0 / v9; |
6028 //v10 = a4b + 6.7553994e15; | |
6029 //v6 = LODWORD(v10); | |
6030 v6 = floorf(0.5f + distance * 216.0 / v9); | |
6031 if (v6 > 216 ) | |
0 | 6032 goto LABEL_19; |
6033 } | |
6034 } | |
6035 else | |
6036 { | |
6037 v6 = 216; | |
6038 } | |
638 | 6039 if ( distance != 0.0 ) |
0 | 6040 { |
6041 LABEL_20: | |
6042 if ( a5 ) | |
6043 v6 = 8 * _43F55F_get_billboard_light_level(a5, v6 >> 3); | |
6044 if ( v6 > 216 ) | |
6045 v6 = 216; | |
6046 return (255 - v6) | ((255 - v6) << 16) | ((255 - v6) << 8); | |
6047 } | |
6048 LABEL_19: | |
6049 v6 = 216; | |
6050 goto LABEL_20; | |
6051 } | |
349 | 6052 |
6053 | |
6054 | |
638 | 6055 if (fabsf(distance) < 1.0e-6f) |
349 | 6056 return 0xFFF8F8F8; |
6057 | |
638 | 6058 // dim in measured in 8-steps |
6059 v11 = 8 * (max_dimm - min_dimm); | |
349 | 6060 //v12 = v11; |
0 | 6061 if ( v11 >= 0 ) |
6062 { | |
6063 if ( v11 > 216 ) | |
349 | 6064 v11 = 216; |
6065 } | |
6066 else | |
6067 v11 = 0; | |
6068 | |
638 | 6069 float fog_density_mult = 216.0f; |
6070 if (a4) | |
6071 fog_density_mult += distance / (double)pOutdoorCamera->shading_dist_shade * 32.0; | |
6072 | |
6073 v6 = v11 + floorf(pOutdoor->fFogDensity * fog_density_mult + 0.5f); | |
6074 /*if ( a4 ) | |
6075 { | |
6076 //a3b = pOutdoor->fFogDensity * 216.0; | |
349 | 6077 //v14 = a3b + 6.7553994e15; |
638 | 6078 //a4a = floorf(a3b + 0.5f);//LODWORD(v14); |
6079 } | |
6080 else | |
6081 { | |
6082 //a3a = (distance / (double)pOutdoorCamera->shading_dist_shade * 32.0 + 216.0) * pOutdoor->fFogDensity; | |
349 | 6083 //v13 = a3a + 6.7553994e15; |
638 | 6084 //a4a = floorf(a3a + 0.5f);//LODWORD(v13); |
6085 } | |
6086 v6 = a4a + v11;*/ | |
0 | 6087 if ( a5 ) |
6088 v6 = 8 * _43F55F_get_billboard_light_level(a5, v6 >> 3); | |
6089 if ( v6 > 216 ) | |
6090 v6 = 216; | |
349 | 6091 if ( v6 < v11 ) |
6092 v6 = v11; | |
638 | 6093 if ( v6 > 8 * pOutdoor->max_terrain_dimming_level ) |
6094 v6 = 8 * pOutdoor->max_terrain_dimming_level; | |
0 | 6095 if ( !bUnderwater ) |
6096 return (255 - v6) | ((255 - v6) << 16) | ((255 - v6) << 8); | |
349 | 6097 else |
6098 { | |
0 | 6099 v15 = (double)(255 - v6) * 0.0039215689; |
6100 a3c = v15; | |
349 | 6101 //a4c = v15 * 16.0; |
6102 //v16 = a4c + 6.7553994e15; | |
6103 a5a = floorf(v15 * 16.0 + 0.5f);//LODWORD(v16); | |
6104 //a4d = a3c * 194.0; | |
6105 //v17 = a4d + 6.7553994e15; | |
6106 v18 = floorf(a3c * 194.0 + 0.5f);//LODWORD(v17); | |
6107 //a3d = a3c * 153.0; | |
6108 //v19 = a3d + 6.7553994e15; | |
6109 return (int)floorf(a3c * 153.0 + 0.5f)/*LODWORD(v19)*/ | ((v18 | (a5a << 8)) << 8); | |
6110 } | |
0 | 6111 } |
6112 // 6BE3C4: using guessed type char bUnderwater; | |
6113 | |
6114 //----- (0047F44B) -------------------------------------------------------- | |
67 | 6115 unsigned int __stdcall WorldPosToGridCellX(signed int sWorldPosX) |
6116 { | |
6117 return (sWorldPosX / 512) + 64; | |
0 | 6118 } |
6119 // 47F44B: using guessed type int __stdcall WorldPosToGridCellX(int); | |
6120 | |
6121 //----- (0047F458) -------------------------------------------------------- | |
67 | 6122 unsigned int __stdcall WorldPosToGridCellZ(signed int sWorldPosZ) |
6123 { | |
6124 return 64 - (sWorldPosZ / 512); | |
0 | 6125 } |
6126 | |
6127 //----- (0047F469) -------------------------------------------------------- | |
6128 int __stdcall GridCellToWorldPosX(int a1) | |
6129 { | |
6130 return (a1 - 64) << 9; | |
6131 } | |
6132 | |
6133 //----- (0047F476) -------------------------------------------------------- | |
6134 int __stdcall GridCellToWorldPosZ(int a1) | |
6135 { | |
6136 return (64 - a1) << 9; | |
6137 } | |
6138 | |
6139 //----- (0047F4D3) -------------------------------------------------------- | |
6140 void __fastcall sub_47F4D3(int band1, int band2, int band3) | |
6141 { | |
6142 int v3; // edi@1 | |
6143 //stru220 *v4; // esi@1 | |
6144 double v5; // ST2C_8@3 | |
6145 double v6; // st7@3 | |
6146 //double v7; // [sp+18h] [bp-28h]@3 | |
6147 //double v8; // [sp+20h] [bp-20h]@2 | |
6148 int v9; // [sp+34h] [bp-Ch]@1 | |
6149 int v10; // [sp+38h] [bp-8h]@1 | |
6150 //signed int band3a; // [sp+48h] [bp+8h]@2 | |
6151 | |
6152 v9 = band2 * 512; | |
6153 pOutdoorCamera->outdoor_grid_band_3 = band3; | |
6154 v10 = band1 * 512; | |
6155 v3 = band3 * 512; | |
6156 pOutdoorCamera->uPickDepth = band3 * 512; | |
6157 //v4 = stru_76E5C8; // v4: 0 -> 65536 | |
6158 for (uint i = 0; i < 16384; ++i) | |
6159 //do | |
6160 { | |
226 | 6161 auto v4 = stru_76E5C8[i]; |
0 | 6162 //band3a = 256; |
6163 //v8 = (double)(signed int)((char *)v4 + 256 - (int)stru_76E5C8); | |
6164 for (uint j = 0; j < 128; ++j) // band3a: 0 -> 128 | |
6165 { | |
6166 v5 = pow(j * 512 + 256, 2.0); | |
6167 v6 = pow(i * 4 + 256, 2.0); | |
6168 //*((float *)&v5 + 1) = sqrt(v6 + v5); | |
6169 int v7 = floorf(sqrtf(v5 + v6) + 0.5f);//*((float *)&v5 + 1) + 6.7553994e15; | |
6170 if (v7 >= v10) | |
6171 { | |
6172 if (v7 >= v9) | |
226 | 6173 v4.field_0 = ((v7 >= v3) - 1) & 2; |
6174 else | |
6175 v4.field_0 = 2; | |
6176 } | |
6177 else | |
6178 { | |
6179 v4.field_0 = 1; | |
0 | 6180 } |
6181 //band3a += 512; | |
226 | 6182 v4.distance = v7; |
6183 //++v4; | |
0 | 6184 } |
6185 //while ( band3a < 65792 ); | |
6186 } | |
6187 //while ( (signed int)v4 < (signed int)arary_77E5C8 ); | |
6188 } | |
6189 | |
6190 //----- (004811A3) -------------------------------------------------------- | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
6191 void Polygon::DrawBorderTiles() |
1338 | 6192 { |
6193 //__debugbreak(); | |
6194 | |
6195 pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, false); | |
0 | 6196 pRenderer->DrawTerrainPolygon(uNumVertices, this, |
1338 | 6197 pBitmaps_LOD->pHardwareTextures[pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_current_frame]], false, true); |
6198 | |
6199 pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, true); | |
6200 //pRenderer->DrawTerrainPolygon(uNumVertices, this, pBitmaps_LOD->pHardwareTextures[uTileBitmapID], true, true); | |
0 | 6201 } |
6202 | |
6203 | |
6204 //----- (00481EB7) -------------------------------------------------------- | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
6205 void __cdecl ResetPolygons() |
0 | 6206 { |
6207 int v0; // ecx@1 | |
6208 char *v1; // eax@2 | |
6209 | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
6210 v0 = pOutdoorCamera->uNumPolygons; |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
6211 if ( pOutdoorCamera->uNumPolygons > 0 ) |
0 | 6212 { |
6213 v1 = (char *)&array_77EC08[0].prolly_tail; | |
6214 do | |
6215 { | |
6216 *((int *)v1 - 1) = 0; | |
6217 *(int *)v1 = 0; | |
6218 *((int *)v1 - 5) = 0; | |
6219 v1 += 268; | |
6220 --v0; | |
6221 } | |
6222 while ( v0 ); | |
6223 } | |
6224 } | |
6225 | |
6226 //----- (00481ED9) -------------------------------------------------------- | |
6227 void __cdecl sub_481ED9_MessWithOutdoorCamera() | |
6228 { | |
6229 stru_8019C8._48616B(65536, 0, 0, 0, 65536, 0); | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
6230 pOutdoorCamera->uNumPolygons = 0; |
0 | 6231 pOutdoorCamera->uNumEdges = 0; |
6232 pOutdoorCamera->uNumSpans = 0; | |
6233 pOutdoorCamera->uNumSurfs = 0; | |
6234 pOutdoorCamera->uNumBillboards = 0; | |
6235 pOutdoorCamera->field_44 = 0; | |
6236 } | |
6237 | |
6238 //----- (00481EFA) -------------------------------------------------------- | |
6239 bool __fastcall sub_481EFA(RenderVertexSoft *a1, RenderVertexSoft *a2, RenderVertexSoft *a3, RenderVertexSoft *a4, int a5) | |
6240 { | |
6241 RenderVertexSoft *v5; // esi@1 | |
6242 RenderVertexSoft *v6; // edx@1 | |
6243 bool v7; // edi@2 | |
6244 bool v8; // ecx@5 | |
6245 bool v9; // esi@8 | |
6246 bool v10; // eax@11 | |
6247 double v11; // st7@14 | |
6248 signed int v12; // esi@15 | |
6249 signed int v13; // edx@18 | |
6250 signed int v14; // ecx@21 | |
6251 signed int v15; // eax@24 | |
6252 RenderVertexSoft *v17; // [sp+Ch] [bp-8h]@1 | |
6253 | |
6254 v5 = a2; | |
6255 v6 = a1; | |
6256 v17 = v5; | |
6257 v7 = a1->vWorldViewPosition.x < 8.0; | |
6258 v8 = v5->vWorldViewPosition.x < 8.0; | |
6259 v9 = a3->vWorldViewPosition.x < 8.0; | |
6260 v10 = a4->vWorldViewPosition.x < 8.0; | |
6261 return !(v8 & v9 & v10 & v7) | |
6262 && ((v11 = (double)pOutdoorCamera->shading_dist_mist, v11 > v6->vWorldViewPosition.x) ? (v12 = 0) : (v12 = 1), | |
6263 v11 > v17->vWorldViewPosition.x ? (v13 = 0) : (v13 = 1), | |
6264 v11 > a3->vWorldViewPosition.x ? (v14 = 0) : (v14 = 1), | |
6265 v11 > a4->vWorldViewPosition.x ? (v15 = 0) : (v15 = 1), | |
6266 !(v13 & v14 & v15 & v12)); | |
6267 } | |
6268 | |
6269 //----- (00481FC9) -------------------------------------------------------- | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
6270 int __fastcall sub_481FC9(RenderVertexSoft *a1, RenderVertexSoft *a2, RenderVertexSoft *a3, struct Polygon *a4)//Rotate camera |
63 | 6271 { |
6272 float arg_0, arg_4, var_4, var_8, var_c, var_10, var_14; | |
6273 | |
6274 if (a1->vWorldPosition.y == a2->vWorldPosition.y && a2->vWorldPosition.y == a3->vWorldPosition.y) | |
6275 a4->flags |= 0x10; | |
6276 var_c = a1->vWorldViewPosition.x - a2->vWorldViewPosition.x; | |
6277 var_14 = a1->vWorldViewPosition.y - a2->vWorldViewPosition.y; | |
6278 arg_0 = a1->vWorldViewPosition.z - a2->vWorldViewPosition.z; | |
6279 var_10 = a3->vWorldViewPosition.x - a2->vWorldViewPosition.x; | |
6280 var_8 = a3->vWorldViewPosition.y - a2->vWorldViewPosition.y; | |
6281 var_4 = a3->vWorldViewPosition.z - a2->vWorldViewPosition.z; | |
6282 arg_4 = a3->vWorldPosition.y - a2->vWorldPosition.y; | |
6283 if (((a3->vWorldPosition.y - a2->vWorldPosition.y) * (a1->vWorldPosition.x - a2->vWorldPosition.x) - (a3->vWorldPosition.x - a2->vWorldPosition.x) * (a1->vWorldPosition.y - a2->vWorldPosition.y)) * (pIndoorCamera->pos.y - a2->vWorldPosition.z) + | |
6284 ((a3->vWorldPosition.z - a2->vWorldPosition.z) * (a1->vWorldPosition.y - a2->vWorldPosition.y) - (a3->vWorldPosition.y - a2->vWorldPosition.y) * (a1->vWorldPosition.z - a2->vWorldPosition.z)) * (pIndoorCamera->pos.x - a2->vWorldPosition.x) + | |
6285 ((a3->vWorldPosition.x - a2->vWorldPosition.x) * (a1->vWorldPosition.z - a2->vWorldPosition.z) - (a3->vWorldPosition.z - a2->vWorldPosition.z) * (a1->vWorldPosition.x - a2->vWorldPosition.x)) * (pIndoorCamera->pos.z - a2->vWorldPosition.y) < 0) | |
6286 { | |
6287 arg_4 = var_4 * var_14 - var_8 * arg_0; | |
6288 a4->v_18.x = floorf(arg_4 + 0.5f); | |
6289 arg_4 = var_10 * arg_0 - var_4 * var_c; | |
6290 a4->v_18.y = floorf(arg_4 + 0.5f); | |
6291 arg_4 = var_8 * var_c - var_10 * var_14; | |
6292 a4->v_18.z = floorf(arg_4 + 0.5f); | |
6293 a4->_486089_normalize_v_18(); | |
6294 arg_4 = -(a4->v_18.x * a2->vWorldViewPosition.x) - a4->v_18.y * a2->vWorldViewPosition.y - a4->v_18.z * a2->vWorldViewPosition.z; | |
6295 a4->field_24 = floorf(arg_4 + 0.5f); | |
6296 return true; | |
6297 } | |
6298 else | |
6299 return false; | |
0 | 6300 } |
6301 | |
6302 //----- (004823F4) -------------------------------------------------------- | |
138 | 6303 bool IsTerrainSlopeTooHigh(int pos_x, int pos_z) |
6304 { | |
6305 //unsigned int v2; // ebx@1 | |
6306 //unsigned int v3; // edi@1 | |
6307 //int v4; // eax@1 | |
6308 //int v6; // esi@5 | |
6309 //int v7; // ecx@6 | |
6310 //int v8; // edx@6 | |
6311 //int v9; // eax@6 | |
6312 //int v10; // esi@10 | |
6313 //int v11; // [sp+14h] [bp-8h]@1 | |
6314 //int v12; // [sp+18h] [bp-4h]@1 | |
6315 | |
6316 //v12 = a1; | |
6317 //v11 = a2; | |
6318 auto grid_x = WorldPosToGridCellX(pos_x); | |
6319 auto grid_z = WorldPosToGridCellZ(pos_z) - 1; | |
6320 | |
6321 auto party_grid_x1 = GridCellToWorldPosX(grid_x); | |
6322 //dword_76D56C_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(grid_x + 1); | |
6323 //dword_76D570_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(grid_x + 1); | |
6324 //dword_76D574_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(grid_x); | |
6325 auto party_grid_z1 = GridCellToWorldPosZ(grid_z); | |
6326 //dword_76D55C_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(grid_z); | |
6327 //dword_76D560_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(grid_z + 1); | |
6328 //dword_76D564_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(grid_z + 1); | |
6329 auto party_x1z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z); | |
6330 auto party_x2z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z); | |
6331 auto party_x2z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z + 1); | |
6332 auto party_x1z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z + 1); | |
6333 //dword_76D554_terrain_cell_world_pos_around_party_y = v4; | |
6334 if (party_x1z1_y == party_x2z1_y && | |
6335 party_x2z1_y == party_x2z2_y && | |
6336 party_x2z2_y == party_x1z2_y ) | |
6337 return false; | |
6338 | |
6339 auto dx = abs(pos_x - party_grid_x1), | |
6340 dz = abs(party_grid_z1 - pos_z); | |
6341 | |
6342 int y1, y2, y3; | |
6343 if (dz >= dx) | |
6344 { | |
6345 y1 = party_x1z2_y; // lower-left triangle | |
6346 y2 = party_x2z2_y; // y3 | \ | |
6347 y3 = party_x1z1_y; // | \ | |
6348 /* | \ | |
6349 |______ \ | |
6350 y1 y2 */ | |
6351 } | |
6352 else | |
6353 { | |
6354 y1 = party_x2z1_y; // upper-right | |
6355 y2 = party_x1z1_y; // y2_______ y1 | |
6356 y3 = party_x2z2_y; // \ | | |
6357 /* \ | | |
6358 \ | | |
6359 y3 */ | |
6360 } | |
6361 | |
6362 int y_min = min(y1, min(y2, y3)), | |
6363 y_max = max(y1, max(y2, y3)); | |
6364 return y_max - y_min > 512; | |
6365 | |
6366 /*if ( y1 >= y2 ) | |
6367 { | |
6368 y_min = y2; | |
6369 if ( y2 < y3 ) | |
0 | 6370 goto LABEL_13; |
6371 LABEL_12: | |
138 | 6372 y_min = y3; |
0 | 6373 goto LABEL_13; |
6374 } | |
138 | 6375 else if ( y1 >= y3 ) |
0 | 6376 goto LABEL_12; |
138 | 6377 else |
6378 y_min = y1; | |
6379 | |
0 | 6380 LABEL_13: |
138 | 6381 if ( y1 <= y2 ) |
6382 { | |
6383 if ( y2 > y3 ) | |
6384 y3 = y2; | |
6385 } | |
6386 else | |
6387 { | |
6388 if ( y1 > y3 ) | |
6389 y3 = y1; | |
6390 } | |
6391 return y3 - v10 > 512;*/ | |
0 | 6392 } |
6393 | |
6394 //----- (0048257A) -------------------------------------------------------- | |
812 | 6395 int __fastcall GetTerrainHeightsAroundParty2(int a1, int a2, int *pIsOnWater, int bFloatAboveWater) |
6396 { | |
6397 //unsigned int v4; // ebx@1 | |
6398 //unsigned int v5; // edi@1 | |
0 | 6399 int result; // eax@9 |
812 | 6400 //int v7; // ebx@10 |
0 | 6401 int v8; // ebx@11 |
6402 int v9; // eax@11 | |
6403 int v10; // ecx@11 | |
812 | 6404 //int v11; // [sp+Ch] [bp-Ch]@1 |
6405 //int v12; // [sp+10h] [bp-8h]@1 | |
0 | 6406 int v13; // [sp+10h] [bp-8h]@11 |
6407 signed int v14; // [sp+14h] [bp-4h]@3 | |
6408 int v15; // [sp+24h] [bp+Ch]@11 | |
6409 | |
812 | 6410 //v11 = a1; |
6411 //v12 = a2; | |
6412 auto grid_x = WorldPosToGridCellX(a1); | |
6413 auto grid_z = WorldPosToGridCellZ(a2) - 1; | |
6414 | |
6415 auto grid_x1 = GridCellToWorldPosX(grid_x), | |
6416 grid_x2 = GridCellToWorldPosX(grid_x + 1); | |
6417 auto grid_z1 = GridCellToWorldPosZ(grid_z), | |
6418 grid_z2 = GridCellToWorldPosZ(grid_z + 1); | |
6419 | |
6420 auto y_x1z1 = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z), | |
6421 y_x2z1 = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z), | |
6422 y_x2z2 = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z + 1), | |
6423 y_x1z2 = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z + 1); | |
6424 //v4 = WorldPosToGridCellX(a1); | |
6425 //v5 = WorldPosToGridCellZ(v12) - 1; | |
6426 //dword_76D538_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v4); | |
6427 //dword_76D53C_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v4 + 1); | |
6428 //dword_76D540_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v4 + 1); | |
6429 //dword_76D544_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v4); | |
6430 //dword_76D528_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v5); | |
6431 //dword_76D52C_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v5); | |
6432 //dword_76D530_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v5 + 1); | |
6433 //dword_76D534_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v5 + 1); | |
6434 //dword_76D518_terrain_cell_world_pos_around_party_y = pOutdoor->DoGetHeightOnTerrain(v4, v5); | |
6435 //dword_76D51C_terrain_cell_world_pos_around_party_y = pOutdoor->DoGetHeightOnTerrain(v4 + 1, v5); | |
6436 //dword_76D520_terrain_cell_world_pos_around_party_y = pOutdoor->DoGetHeightOnTerrain(v4 + 1, v5 + 1); | |
6437 //dword_76D524_terrain_cell_world_pos_around_party_y = pOutdoor->DoGetHeightOnTerrain(v4, v5 + 1); | |
791 | 6438 *pIsOnWater = false; |
812 | 6439 if ( pOutdoor->ActuallyGetSomeOtherTileInfo(grid_x, grid_z) & 2 ) |
791 | 6440 *pIsOnWater = true; |
0 | 6441 v14 = 0; |
812 | 6442 if ( !bFloatAboveWater && *pIsOnWater ) |
0 | 6443 v14 = -60; |
812 | 6444 if ( y_x1z1 != y_x2z1 || |
6445 y_x2z1 != y_x2z2 || | |
6446 y_x2z2 != y_x1z2 ) | |
6447 { | |
6448 if ( abs(grid_z1 - a2) >= abs(a1 - grid_x1) ) | |
6449 { | |
6450 v8 = y_x1z2; | |
6451 v9 = y_x2z2; | |
6452 v10 = y_x1z1; | |
6453 v15 = a1 - grid_x1; | |
6454 v13 = a2 - grid_z2; | |
0 | 6455 } |
6456 else | |
6457 { | |
812 | 6458 v8 = y_x2z1; |
6459 v9 = y_x1z1; | |
6460 v10 = y_x2z2; | |
6461 v15 = grid_x2 - a1; | |
6462 v13 = grid_z1 - a2; | |
6463 } | |
871 | 6464 return v14 + v8 + fixpoint_sub0(v13, (v10 - v8) * 128) + fixpoint_sub0(v15, (v9 - v8) * 128); |
812 | 6465 } |
6466 else | |
6467 return y_x1z1; | |
0 | 6468 } |
6469 | |
6470 //----- (00482A90) -------------------------------------------------------- | |
6471 signed int __cdecl const_1_0() | |
6472 { | |
6473 return 1; | |
6474 } | |
6475 | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
6476 |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
6477 |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
6478 |
0 | 6479 |
6480 //----- (00485F53) -------------------------------------------------------- | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
6481 void __thiscall sr_485F53(Vec2_int_ *v) |
0 | 6482 { |
6483 ++v->y; | |
6484 if ( v->y > 1000 ) | |
6485 v->y = 0; | |
6486 } | |
6487 | |
6488 //----- (0048607B) -------------------------------------------------------- | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
6489 void Polygon::_48607B(stru149 *a2) |
0 | 6490 { |
6491 this->pTexture = 0; | |
6492 this->ptr_38 = a2; | |
6493 } | |
6494 | |
6495 //----- (00486089) -------------------------------------------------------- | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
6496 void Polygon::_486089_normalize_v_18() |
0 | 6497 { |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
6498 //Polygon *v1; // esi@1 |
0 | 6499 double v2; // st7@1 |
6500 double v3; // st6@1 | |
6501 float v4; // ST18_4@2 | |
6502 double v5; // st5@1 | |
6503 float v6; // ST14_4@2 | |
6504 double v7; // st7@1 | |
6505 float v8; // ST24_4@2 | |
6506 float v9; // ST20_4@2 | |
6507 double v10; // ST0C_8@2 | |
6508 float v11; // ST18_4@2 | |
6509 double v12; // ST0C_8@2 | |
6510 float v13; // ST14_4@2 | |
6511 double v14; // ST0C_8@2 | |
6512 float v15; // [sp+20h] [bp-8h]@1 | |
6513 | |
1025 | 6514 //v1 = this; |
0 | 6515 v2 = (double)this->v_18.x; |
6516 v15 = v2; | |
6517 v3 = (double)this->v_18.y; | |
6518 v5 = (double)this->v_18.z; | |
6519 v7 = sqrt(v5 * v5 + v3 * v3 + v2 * v2); | |
6520 if ( v7 == 0.0 ) | |
6521 { | |
1025 | 6522 this->v_18.x = 0; |
6523 this->v_18.y = 0; | |
6524 this->v_18.z = 65536; | |
0 | 6525 } |
6526 else | |
6527 { | |
6528 v8 = 1.0 / v7; | |
6529 v9 = v8 * v15 * 65536.0; | |
6530 v10 = v9 + 6.7553994e15; | |
1025 | 6531 this->v_18.x = LODWORD(v10); |
0 | 6532 v4 = v3; |
6533 v11 = v8 * v4 * 65536.0; | |
6534 v12 = v11 + 6.7553994e15; | |
1025 | 6535 this->v_18.y = LODWORD(v12); |
0 | 6536 v6 = v5; |
6537 v13 = v8 * v6 * 65536.0; | |
6538 v14 = v13 + 6.7553994e15; | |
1025 | 6539 this->v_18.z = LODWORD(v14); |
0 | 6540 } |
6541 } | |
6542 | |
6543 //----- (0048616B) -------------------------------------------------------- | |
6544 int stru149::_48616B(int a2, int a3, int a4, int a5, int a6, int a7) | |
6545 { | |
6546 int v7; // ebx@1 | |
6547 int v8; // esi@1 | |
6548 int v9; // edi@1 | |
6549 int v10; // eax@1 | |
6550 int v11; // edx@1 | |
6551 int v12; // esi@2 | |
6552 int v13; // eax@2 | |
6553 int v14; // ST10_4@3 | |
6554 int v15; // esi@3 | |
6555 int v16; // eax@5 | |
6556 int v17; // ST0C_4@6 | |
6557 int v18; // eax@8 | |
6558 int v19; // ST0C_4@9 | |
6559 int v20; // eax@10 | |
6560 int v21; // edx@10 | |
6561 int v22; // eax@10 | |
6562 int result; // eax@10 | |
6563 int v24; // [sp+14h] [bp-14h]@1 | |
6564 int v25; // [sp+18h] [bp-10h]@1 | |
6565 int v26; // [sp+1Ch] [bp-Ch]@1 | |
6566 int v27; // [sp+24h] [bp-4h]@1 | |
6567 int v28; // [sp+30h] [bp+8h]@10 | |
6568 int v29; // [sp+3Ch] [bp+14h]@10 | |
6569 | |
6570 v25 = pOutdoorCamera->camera_rotation_x_int_cosine; | |
6571 v7 = pOutdoorCamera->camera_rotation_y_int_sine; | |
6572 v27 = pOutdoorCamera->camera_rotation_x_int_sine; | |
6573 v8 = -pIndoorCamera->pos.y; | |
6574 v9 = pOutdoorCamera->camera_rotation_y_int_cosine; | |
6575 v26 = -pIndoorCamera->pos.z; | |
6576 v24 = -pIndoorCamera->pos.x; | |
6577 v10 = pOutdoorCamera->camera_rotation_y_int_cosine * -pIndoorCamera->pos.x; | |
6578 v11 = v10 + pOutdoorCamera->camera_rotation_y_int_sine * -pIndoorCamera->pos.y; | |
6579 if ( pIndoorCamera->sRotationX ) | |
6580 { | |
6581 v14 = v10 + pOutdoorCamera->camera_rotation_y_int_sine * -pIndoorCamera->pos.y; | |
6582 v15 = pOutdoorCamera->camera_rotation_y_int_cosine * v8 - pOutdoorCamera->camera_rotation_y_int_sine * v24; | |
755 | 6583 this->field_0_party_dir_x = ((unsigned __int64)(v11 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_cosine) >> 16) |
0 | 6584 + ((unsigned __int64)(-65536 |
6585 * pIndoorCamera->pos.z | |
6586 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16); | |
755 | 6587 this->field_4_party_dir_y = v15; |
0 | 6588 v12 = v25; |
6589 v13 = ((unsigned __int64)((v26 << 16) * (signed __int64)v25) >> 16) | |
6590 - ((unsigned __int64)(v14 * (signed __int64)v27) >> 16); | |
6591 } | |
6592 else | |
6593 { | |
755 | 6594 this->field_4_party_dir_y = pOutdoorCamera->camera_rotation_y_int_cosine * v8 - pOutdoorCamera->camera_rotation_y_int_sine * v24; |
0 | 6595 v12 = v25; |
755 | 6596 this->field_0_party_dir_x = v11; |
0 | 6597 v13 = v26 << 16; |
6598 } | |
6599 this->field_8 = v13; | |
6600 if ( pIndoorCamera->sRotationX ) | |
6601 { | |
6602 v17 = ((unsigned __int64)(a2 * (signed __int64)v9) >> 16) + ((unsigned __int64)(a3 * (signed __int64)v7) >> 16); | |
6603 this->field_C = ((unsigned __int64)(v17 * (signed __int64)v12) >> 16) | |
6604 + ((unsigned __int64)(a4 * (signed __int64)v27) >> 16); | |
6605 this->field_10 = ((unsigned __int64)(a3 * (signed __int64)v9) >> 16) | |
6606 - ((unsigned __int64)(a2 * (signed __int64)v7) >> 16); | |
6607 v16 = ((unsigned __int64)(a4 * (signed __int64)v12) >> 16) - ((unsigned __int64)(v17 * (signed __int64)v27) >> 16); | |
6608 } | |
6609 else | |
6610 { | |
6611 this->field_C = ((unsigned __int64)(a2 * (signed __int64)v9) >> 16) | |
6612 + ((unsigned __int64)(a3 * (signed __int64)v7) >> 16); | |
6613 this->field_10 = ((unsigned __int64)(a3 * (signed __int64)v9) >> 16) | |
6614 - ((unsigned __int64)(a2 * (signed __int64)v7) >> 16); | |
6615 v16 = a4; | |
6616 } | |
6617 this->field_14 = v16; | |
6618 if ( pIndoorCamera->sRotationX ) | |
6619 { | |
6620 v19 = ((unsigned __int64)(a5 * (signed __int64)v9) >> 16) + ((unsigned __int64)(a6 * (signed __int64)v7) >> 16); | |
6621 this->field_18 = ((unsigned __int64)(v19 * (signed __int64)v12) >> 16) | |
6622 + ((unsigned __int64)(a7 * (signed __int64)v27) >> 16); | |
6623 this->field_1C = ((unsigned __int64)(a6 * (signed __int64)v9) >> 16) | |
6624 - ((unsigned __int64)(a5 * (signed __int64)v7) >> 16); | |
6625 v18 = ((unsigned __int64)(a7 * (signed __int64)v12) >> 16) - ((unsigned __int64)(v19 * (signed __int64)v27) >> 16); | |
6626 } | |
6627 else | |
6628 { | |
6629 this->field_18 = ((unsigned __int64)(a5 * (signed __int64)v9) >> 16) | |
6630 + ((unsigned __int64)(a6 * (signed __int64)v7) >> 16); | |
6631 this->field_1C = ((unsigned __int64)(a6 * (signed __int64)v9) >> 16) | |
6632 - ((unsigned __int64)(a5 * (signed __int64)v7) >> 16); | |
6633 v18 = a7; | |
6634 } | |
6635 this->field_18 = -this->field_18; | |
6636 this->field_1C = -this->field_1C; | |
6637 this->field_20 = v18; | |
6638 v20 = this->field_C; | |
6639 this->field_20 = -this->field_20; | |
755 | 6640 v21 = ((unsigned __int64)(v20 * (signed __int64)this->field_0_party_dir_x) >> 16) |
6641 + ((unsigned __int64)(this->field_10 * (signed __int64)this->field_4_party_dir_y) >> 16) | |
0 | 6642 + ((unsigned __int64)(this->field_14 * (signed __int64)this->field_8) >> 16); |
6643 v28 = this->field_18; | |
755 | 6644 v22 = this->field_0_party_dir_x; |
0 | 6645 this->field_24 = v21; |
6646 v29 = (unsigned __int64)(v28 * (signed __int64)v22) >> 16; | |
755 | 6647 result = (unsigned __int64)(this->field_1C * (signed __int64)this->field_4_party_dir_y) >> 16; |
0 | 6648 this->field_28 = v29 + result + ((unsigned __int64)(this->field_20 * (signed __int64)this->field_8) >> 16); |
6649 return result; | |
6650 } | |
6651 | |
6652 //----- (0048694B) -------------------------------------------------------- | |
1344 | 6653 int stru149::sky_48694B() |
0 | 6654 { |
6655 int v1; // eax@1 | |
6656 int v2; // ST04_4@1 | |
6657 int v3; // ST00_4@1 | |
6658 int v4; // eax@1 | |
6659 int v5; // ST0C_4@1 | |
6660 int result; // eax@1 | |
6661 | |
6662 v1 = this->field_C; | |
6663 this->field_18 = -this->field_18; | |
6664 this->field_1C = -this->field_1C; | |
6665 this->field_20 = -this->field_20; | |
755 | 6666 v2 = (unsigned __int64)(v1 * (signed __int64)this->field_0_party_dir_x) >> 16; |
0 | 6667 v3 = this->field_18; |
755 | 6668 v4 = this->field_0_party_dir_x; |
0 | 6669 this->field_24 = v2 |
755 | 6670 + ((unsigned __int64)(this->field_10 * (signed __int64)this->field_4_party_dir_y) >> 16) |
0 | 6671 + ((unsigned __int64)(this->field_14 * (signed __int64)this->field_8) >> 16); |
6672 v5 = (unsigned __int64)(v3 * (signed __int64)v4) >> 16; | |
755 | 6673 result = (unsigned __int64)(this->field_1C * (signed __int64)this->field_4_party_dir_y) >> 16; |
0 | 6674 this->field_28 = v5 + result + ((unsigned __int64)(this->field_20 * (signed __int64)this->field_8) >> 16); |
6675 return result; | |
6676 } | |
6677 | |
6678 | |
6679 //----- (00440DF5) -------------------------------------------------------- | |
6680 int stru167_wrap::Push(__int16 a2, __int16 a3, __int16 a4, int a5, __int16 bgr) | |
6681 { | |
6682 int result; // eax@1 | |
6683 | |
6684 pElements[uNumElements].field_6_rnd_value = a2; | |
6685 pElements[uNumElements].field_8_rnd_value = a3; | |
6686 pElements[uNumElements].field_A_rnd_value = a4; | |
6687 pElements[uNumElements].field_C_time_left = rand() % 64 + 256; | |
6688 pElements[uNumElements].field_E_time_to_live = pElements[uNumElements].field_C_time_left; | |
6689 result = 3 * uNumElements; | |
6690 pElements[uNumElements++].bgr16 = bgr; | |
6691 if (uNumElements >= 100 ) | |
6692 uNumElements = 0; | |
6693 return result; | |
6694 } | |
6695 | |
6696 //----- (00440E91) -------------------------------------------------------- | |
6697 void stru167_wrap::_440E91(__int16 x, int y, int z, int a5, __int16 bgr) | |
6698 { | |
6699 stru167_wrap *v6; // edi@1 | |
6700 int i; // esi@1 | |
6701 int v8; // ST08_4@2 | |
6702 int v9; // ST04_4@2 | |
6703 int v10; // eax@2 | |
6704 | |
6705 v6 = this; | |
6706 for ( i = 0; i < rand() % 6 + 5; ++i ) | |
6707 { | |
6708 v8 = z + rand() % 33; | |
6709 v9 = rand() % 33 + y - 16; | |
6710 v10 = rand(); | |
6711 Push(v10 % 33 + x - 16, v9, v8, a5, bgr); | |
6712 } | |
6713 } | |
6714 | |
6715 //----- (00440F07) -------------------------------------------------------- | |
6716 void stru167_wrap::_440F07() | |
6717 { | |
6718 for (uint i = 0; i < 100; ++i) | |
6719 { | |
6720 if (pElements[i].field_C_time_left > 0) | |
6721 { | |
6722 pElements[i].field_A_rnd_value += rand() % 5 + 4; | |
6723 pElements[i].field_6_rnd_value += rand() % 5 - 2; | |
6724 pElements[i].field_8_rnd_value += rand() % 5 - 2; | |
6725 pElements[i].field_C_time_left -= (short)pEventTimer->uTimeElapsed; | |
6726 } | |
6727 } | |
6728 } | |
6729 | |
6730 //----- (0044100D) -------------------------------------------------------- | |
994 | 6731 bool sub_44100D() |
0 | 6732 { |
569 | 6733 return pCurrentScreen == SCREEN_NPC_DIALOGUE || pCurrentScreen == SCREEN_CHARACTERS || |
6734 pCurrentScreen > SCREEN_LOADGAME && pCurrentScreen <= SCREEN_E || | |
6735 pCurrentScreen > SCREEN_VIDEO && pCurrentScreen <= SCREEN_INPUT_BLV || pCurrentScreen == SCREEN_CASTING; | |
0 | 6736 } |
6737 // 4E28F8: using guessed type int pCurrentScreen; | |
6738 | |
6739 //----- (00441A4E) -------------------------------------------------------- | |
910 | 6740 __int16 __fastcall sub_441A4E(int a1)//for blessing |
0 | 6741 { |
6742 __int16 result; // ax@1 | |
6743 int v2; // ebx@1 | |
6744 char *v3; // esi@1 | |
6745 int v4; // edi@4 | |
1110 | 6746 bool v5; // ecx@4 |
0 | 6747 SpriteFrame *v6; // eax@6 |
6748 SpriteFrame *v7; // edi@6 | |
6749 int v8; // eax@6 | |
6750 unsigned __int16 v9; // ax@6 | |
6751 RenderBillboardTransform_local0 v10; // [sp+Ch] [bp-5Ch]@1 | |
6752 int v11; // [sp+5Ch] [bp-Ch]@6 | |
6753 int v12; // [sp+60h] [bp-8h]@1 | |
6754 int v13; // [sp+64h] [bp-4h]@6 | |
6755 | |
6756 v10.uParentBillboardID = -1; | |
6757 v10.pTarget = pRenderer->pTargetSurface; | |
6758 v10.pTargetZ = pRenderer->pActiveZBuffer; | |
6759 v10.uTargetPitch = pRenderer->field_10; | |
6760 result = 0; | |
6761 v2 = a1; | |
6762 v10.uViewportX = 0; | |
6763 v10.uViewportY = 0; | |
6764 v10.uViewportZ = 639; | |
6765 v10.uViewportW = 479; | |
6766 v12 = 0; | |
921 | 6767 //v3 = (char *)&pOtherOverlayList->pOverlays[0].field_C; |
6768 //do | |
6769 for ( uint i = 0; i < 50; ++i ) | |
6770 { | |
6771 if ( pOtherOverlayList->pOverlays[i].field_6 > 0 ) | |
6772 { | |
6773 result = pOtherOverlayList->pOverlays[i].field_0; | |
6774 if ( pOtherOverlayList->pOverlays[i].field_0 >= 300 ) | |
6775 { | |
6776 //v4 = result; | |
6777 v5 = pOtherOverlayList->pOverlays[i].field_0 == v2 + 320 | |
1110 | 6778 || pOtherOverlayList->pOverlays[i].field_0 == v2 + 330 |
6779 || pOtherOverlayList->pOverlays[i].field_0 == v2 + 340 | |
6780 || pOtherOverlayList->pOverlays[i].field_0 == v2 + 350; | |
921 | 6781 pOtherOverlayList->pOverlays[i].field_0 = v2 + 310; |
1110 | 6782 if ( pOtherOverlayList->pOverlays[i].field_0 == v2 + 310 || v5 ) |
921 | 6783 { |
6784 if ( !pOtherOverlayList->pOverlays[i].field_0 ) | |
6785 { | |
6786 v6 = pSpriteFrameTable->GetFrame(pOverlayList->pOverlays[pOtherOverlayList->pOverlays[i].field_2].uSpriteFramesetID, | |
6787 pOtherOverlayList->pOverlays[i].field_4); | |
0 | 6788 v7 = v6; |
921 | 6789 v11 = pOtherOverlayList->pOverlays[i].field_E; |
0 | 6790 v13 = v6->scale; |
6791 v13 = (unsigned __int64)(v11 * (signed __int64)v13) >> 16; | |
921 | 6792 v10.uScreenSpaceX = pOtherOverlayList->pOverlays[i].field_8; |
6793 v10.uScreenSpaceY = pOtherOverlayList->pOverlays[i].field_A; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
142
diff
changeset
|
6794 v10._screenspace_x_scaler_packedfloat = v13; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
142
diff
changeset
|
6795 v10._screenspace_y_scaler_packedfloat = v13; |
0 | 6796 v10.pPalette = PaletteManager::Get_Dark_or_Red_LUT(v6->uPaletteIndex, 0, 1); |
921 | 6797 v8 = pOtherOverlayList->pOverlays[i].field_2; |
0 | 6798 v10.sZValue = 0; |
6799 v10.uFlags = 0; | |
6800 v9 = pOverlayList->pOverlays[v8].uOverlayType; | |
6801 if ( !v9 || v9 == 2 ) | |
6802 v10.uScreenSpaceY += pSprites_LOD->pSpriteHeaders[v7->pHwSpriteIDs[0]].uHeight >> 1; | |
6803 result = pSprites_LOD->pSpriteHeaders[v7->pHwSpriteIDs[0]]._4AD2D1(&v10, 0); | |
6804 ++v12; | |
6805 if ( v12 == 5 ) | |
6806 break; | |
6807 } | |
6808 } | |
6809 } | |
6810 } | |
921 | 6811 //v3 += 20; |
6812 } | |
6813 //while ( (signed int)v3 < (signed int)&pOverlayList->pOverlays ); | |
0 | 6814 return result; |
6815 } | |
6816 | |
6817 //----- (00443801) -------------------------------------------------------- | |
237 | 6818 void Initialize2DA() |
6819 { | |
6820 | |
6821 int i; | |
6822 char* test_string; | |
6823 unsigned char c; | |
6824 bool break_loop; | |
6825 unsigned int temp_str_len; | |
6826 char* tmp_pos; | |
6827 int decode_step; | |
6828 | |
6829 if ( p2DEventsTXT_Raw ) | |
6830 pAllocator->FreeChunk(p2DEventsTXT_Raw); | |
6831 p2DEventsTXT_Raw = NULL; | |
6832 p2DEventsTXT_Raw = (char *)pEvents_LOD->LoadRaw("2dEvents.txt", 0); | |
6833 strtok(p2DEventsTXT_Raw, "\r"); | |
6834 strtok(NULL, "\r"); | |
6835 | |
6836 for (i=0;i<525;++i) | |
6837 { | |
6838 test_string = strtok(NULL, "\r") + 1; | |
6839 break_loop = false; | |
6840 decode_step=0; | |
6841 do | |
6842 { | |
6843 c = *(unsigned char*)test_string; | |
6844 temp_str_len = 0; | |
6845 while((c!='\t')&&(c>0)) | |
6846 { | |
6847 ++temp_str_len; | |
6848 c=test_string[temp_str_len]; | |
6849 } | |
6850 tmp_pos=test_string+temp_str_len; | |
6851 if (*tmp_pos == 0) | |
6852 break_loop = true; | |
6853 *tmp_pos = 0; | |
6854 if (temp_str_len) | |
6855 { | |
6856 switch (decode_step) | |
6857 { | |
6858 case 2: | |
6859 { | |
6860 if ( !_strnicmp(test_string, "wea", 3) ) | |
6861 { | |
495 | 6862 p2DEvents[i].uType = BildingType_WeaponShop; |
237 | 6863 break; |
6864 } | |
6865 if ( !_strnicmp(test_string, "arm", 3) ) | |
6866 { | |
495 | 6867 p2DEvents[i].uType = BildingType_ArmorShop; |
237 | 6868 break; |
6869 } | |
6870 if ( !_strnicmp(test_string, "mag", 3) ) | |
6871 { | |
495 | 6872 p2DEvents[i].uType = BildingType_MagicShop; |
237 | 6873 break; |
6874 } | |
6875 if ( !_strnicmp(test_string, "alc", 3) ) | |
6876 { | |
495 | 6877 p2DEvents[i].uType = BildingType_AlchemistShop; |
237 | 6878 break; |
6879 } | |
6880 if ( !_strnicmp(test_string, "sta", 3) ) | |
6881 { | |
495 | 6882 p2DEvents[i].uType = BildingType_Stables; |
237 | 6883 break; |
6884 } | |
6885 if ( !_strnicmp(test_string, "boa", 3) ) | |
6886 { | |
495 | 6887 p2DEvents[i].uType = BildingType_Boats; |
237 | 6888 break; |
6889 } | |
6890 if ( !_strnicmp(test_string, "tem", 3) ) | |
6891 { | |
495 | 6892 p2DEvents[i].uType = BildingType_Temple; |
237 | 6893 break; |
6894 } | |
6895 if ( !_strnicmp(test_string, "tra", 3) ) | |
6896 { | |
495 | 6897 p2DEvents[i].uType = BildingType_Training; |
237 | 6898 break; |
6899 } | |
6900 if ( !_strnicmp(test_string, "tow", 3) ) | |
6901 { | |
495 | 6902 p2DEvents[i].uType = BildingType_TownHall; |
237 | 6903 break; |
6904 } | |
6905 | |
6906 if ( !_strnicmp(test_string, "tav", 3) ) | |
6907 { | |
495 | 6908 p2DEvents[i].uType = BildingType_Tavern; |
237 | 6909 break; |
6910 } | |
6911 if ( !_strnicmp(test_string, "ban", 3) ) | |
6912 { | |
495 | 6913 p2DEvents[i].uType = BildingType_Bank; |
237 | 6914 break; |
6915 } | |
6916 if ( !_strnicmp(test_string, "fir", 3) ) | |
6917 { | |
495 | 6918 p2DEvents[i].uType = BildingType_FireGuild; |
237 | 6919 break; |
6920 } | |
6921 if ( !_strnicmp(test_string, "air", 3) ) | |
6922 { | |
495 | 6923 p2DEvents[i].uType = BildingType_AirGuild; |
237 | 6924 break; |
6925 } | |
6926 if ( !_strnicmp(test_string, "wat", 3) ) | |
6927 { | |
495 | 6928 p2DEvents[i].uType = BildingType_WaterGuild; |
237 | 6929 break; |
6930 } | |
6931 if ( !_strnicmp(test_string, "ear", 3) ) | |
6932 { | |
495 | 6933 p2DEvents[i].uType = BildingType_EarthGuild; |
237 | 6934 break; |
6935 } | |
6936 if ( !_strnicmp(test_string, "spi", 3) ) | |
6937 { | |
495 | 6938 p2DEvents[i].uType = BildingType_SpiritGuild; |
237 | 6939 break; |
6940 } | |
6941 if ( !_strnicmp(test_string, "min", 3) ) | |
6942 { | |
495 | 6943 p2DEvents[i].uType = BildingType_MindGuild; |
237 | 6944 break; |
6945 } | |
6946 if ( !_strnicmp(test_string, "bod", 3) ) | |
6947 { | |
495 | 6948 p2DEvents[i].uType = BildingType_BodyGuild; |
237 | 6949 break; |
6950 } | |
6951 if ( !_strnicmp(test_string, "lig", 3) ) | |
6952 { | |
495 | 6953 p2DEvents[i].uType = BildingType_LightGuild; |
237 | 6954 break; |
6955 } | |
6956 if ( !_strnicmp(test_string, "dar", 3) ) | |
6957 { | |
495 | 6958 p2DEvents[i].uType = BildingType_DarkGuild; |
237 | 6959 break; |
6960 } | |
6961 if ( !_strnicmp(test_string, "ele", 3) ) | |
6962 { | |
495 | 6963 p2DEvents[i].uType = BildingType_14; |
237 | 6964 break; |
6965 } | |
6966 if ( !_strnicmp(test_string, "sel", 3) ) | |
6967 { | |
495 | 6968 p2DEvents[i].uType = BildingType_15; |
237 | 6969 break; |
6970 } | |
6971 if ( !_strnicmp(test_string, "mir", 3) ) | |
6972 { | |
495 | 6973 p2DEvents[i].uType = BildingType_16; |
237 | 6974 break; |
6975 } | |
6976 if ( !_strnicmp(test_string, "mer", 3) ) | |
6977 { | |
495 | 6978 p2DEvents[i].uType = BildingType_TownHall; |
237 | 6979 break; |
6980 } | |
495 | 6981 p2DEvents[i].uType = BildingType_18; |
237 | 6982 } |
6983 break; | |
6984 | |
6985 case 4: | |
6986 p2DEvents[i].uAnimationID = atoi(test_string); | |
6987 break; | |
6988 case 5: | |
6989 p2DEvents[i].pName = RemoveQuotes(test_string); | |
6990 break; | |
6991 case 6: | |
6992 p2DEvents[i].pProprieterName = RemoveQuotes(test_string); | |
6993 break; | |
6994 case 7: | |
6995 p2DEvents[i].pProprieterTitle = RemoveQuotes(test_string); | |
6996 break; | |
6997 case 8: | |
6998 p2DEvents[i].field_14 = atoi(test_string); | |
6999 break; | |
7000 case 9: | |
7001 p2DEvents[i]._state = atoi(test_string); | |
7002 break; | |
7003 case 10: | |
7004 p2DEvents[i]._rep = atoi(test_string); | |
7005 break; | |
7006 case 11: | |
7007 p2DEvents[i]._per = atoi(test_string); | |
7008 break; | |
7009 case 12: | |
7010 p2DEvents[i].fPriceMultiplier = atof(test_string); | |
7011 break; | |
7012 case 13: | |
7013 p2DEvents[i].flt_24 = atof(test_string); | |
7014 break; | |
7015 case 15: | |
7016 p2DEvents[i].field_1C = atoi(test_string); | |
7017 break; | |
7018 case 18: | |
7019 p2DEvents[i].uOpenTime = atoi(test_string); | |
7020 break; | |
7021 case 19: | |
7022 p2DEvents[i].uCloseTime = atoi(test_string); | |
7023 break; | |
7024 case 20: | |
7025 p2DEvents[i].uExitPicID = atoi(test_string); | |
7026 break; | |
7027 case 21: | |
7028 p2DEvents[i].uExitMapID = atoi(test_string); | |
7029 break; | |
7030 case 22: | |
7031 p2DEvents[i]._quest_related = atoi(test_string); | |
7032 break; | |
7033 case 23: | |
7034 p2DEvents[i].pEnterText = RemoveQuotes(test_string); | |
7035 break; | |
7036 } | |
7037 } | |
7038 ++decode_step; | |
7039 test_string=tmp_pos+1; | |
7040 } while ((decode_step<24)&&!break_loop); | |
7041 } | |
7042 | |
0 | 7043 } |
7044 | |
7045 //----- (00443E31) -------------------------------------------------------- | |
601 | 7046 void LoadLevel_InitializeLevelStr() |
7047 { | |
329 | 7048 |
7049 char Args[100]; | |
7050 int string_num; | |
7051 int max_string_length; | |
7052 int current_string_length; | |
7053 int prev_string_offset; | |
7054 | |
7055 if (sizeof(pLevelStrOffsets) != 2000) | |
0 | 7056 Log::Warning(L"pLevelStrOffsets: deserialization warning"); |
1202 | 7057 memset(pLevelStrOffsets.data(), 0, 2000); |
0 | 7058 |
329 | 7059 max_string_length = 0; |
7060 string_num = 1; | |
7061 prev_string_offset = 0; | |
336 | 7062 pLevelStrOffsets[0]=0; |
0 | 7063 for (uint i = 0; i < uLevelStrFileSize; ++i) |
7064 { | |
7065 if ( !pLevelStr[i] ) | |
7066 { | |
329 | 7067 pLevelStrOffsets[string_num] = i + 1; |
7068 ++string_num; | |
7069 if ( i - prev_string_offset > max_string_length ) | |
7070 max_string_length = i - prev_string_offset; | |
7071 prev_string_offset = i; | |
7072 } | |
7073 } | |
7074 | |
7075 uLevelStrNumStrings = string_num - 1; | |
7076 if ( max_string_length > 800 ) | |
7077 { | |
7078 sprintf(Args, "MAX_EVENT_TEXT_LENGTH needs to be increased to %lu", max_string_length+1); | |
0 | 7079 Abortf(Args); |
7080 } | |
329 | 7081 |
7082 if ( uLevelStrNumStrings > 0 ) | |
7083 { | |
336 | 7084 for(uint i = 0; i <uLevelStrNumStrings ; ++i) |
329 | 7085 { |
7086 if ( RemoveQuotes(&pLevelStr[pLevelStrOffsets[i]]) != &pLevelStr[pLevelStrOffsets[i]] ) | |
7087 ++pLevelStrOffsets[i]; | |
7088 } | |
0 | 7089 } |
7090 } | |
7091 | |
7092 //----- (00443F95) -------------------------------------------------------- | |
7093 void __cdecl OnMapLeave() | |
7094 { | |
336 | 7095 _evt_raw *test_event; |
7096 if ( uLevelEVT_NumEvents > 0 ) | |
7097 { | |
7098 for (uint i = 0; i < uLevelEVT_NumEvents; ++i) | |
7099 { | |
7100 test_event=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[i].uEventOffsetInEVT]; | |
1052 | 7101 if ( test_event->_e_type == EVENT_OnMapLeave ) |
7102 { | |
7103 EventProcessor(pLevelEVT_Index[i].uEventID, 0, 1, pLevelEVT_Index[i].event_sequence_num); | |
336 | 7104 } |
7105 } | |
0 | 7106 } |
7107 } | |
7108 | |
7109 //----- (00443FDC) -------------------------------------------------------- | |
7110 void OnMapLoad() | |
781 | 7111 { |
363 | 7112 stru176 *v3; // esi@7 |
7113 __int16 v4; // cx@9 | |
7114 __int16 v5; // di@9 | |
7115 int v6; // eax@9 | |
7116 signed __int64 v8; // qax@26 | |
7117 unsigned int v9; // ecx@26 | |
7118 signed __int64 v10; // qax@26 | |
7119 signed __int64 v11; // qax@26 | |
7120 int v12; // ST50_4@26 | |
7121 signed __int64 v13; // qax@26 | |
7122 signed __int64 v14; // qax@26 | |
7123 int v15; // ST58_4@26 | |
7124 signed __int64 v16; // qax@26 | |
7125 int hours; // ebx@26 | |
7126 unsigned __int64 v18; // [sp+Ch] [bp-44h]@12 | |
7127 signed __int64 seconds; // [sp+14h] [bp-3Ch]@26 | |
7128 unsigned __int64 v20; // [sp+1Ch] [bp-34h]@7 | |
7129 int minutes; // [sp+2Ch] [bp-24h]@26 | |
7130 int years; // [sp+34h] [bp-1Ch]@26 | |
7131 int weeks; // [sp+38h] [bp-18h]@26 | |
7132 int v26; // [sp+3Ch] [bp-14h]@15 | |
7133 int days; // [sp+3Ch] [bp-14h]@26 | |
7134 int months; // [sp+40h] [bp-10h]@26 | |
7135 __int16 v29; // [sp+46h] [bp-Ah]@9 | |
7136 __int16 v30; // [sp+48h] [bp-8h]@9 | |
7137 __int16 v31; // [sp+4Ah] [bp-6h]@9 | |
7138 __int16 v32; // [sp+4Ch] [bp-4h]@9 | |
7139 __int16 v33; // [sp+4Eh] [bp-2h]@9 | |
7140 | |
7141 for (uint i = 0; i < uLevelEVT_NumEvents; ++i) | |
781 | 7142 { |
363 | 7143 auto pEvent = pLevelEVT_Index[i]; |
7144 | |
1202 | 7145 auto _evt = (_evt_raw *)(&pLevelEVT[pEvent.uEventOffsetInEVT]); |
363 | 7146 |
7147 if (_evt->_e_type == EVENT_PlaySound) | |
781 | 7148 { |
601 | 7149 pSoundList->LoadSound(EVT_DWORD(_evt->v5), 0); |
781 | 7150 } |
363 | 7151 else if (_evt->_e_type == EVENT_OnMapReload) |
781 | 7152 { |
1052 | 7153 EventProcessor(pEvent.uEventID, 0, 0, pEvent.event_sequence_num); |
781 | 7154 } |
1052 | 7155 else if (_evt->_e_type == EVENT_OnTimer || _evt->_e_type == EVENT_Initialize) |
781 | 7156 { |
363 | 7157 v3 = &array_5B5928_timers[dword_5B65C8_timers_count]; |
810 | 7158 v20 = pOutdoor->loc_time.uLastVisitDay; |
363 | 7159 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) |
7160 v20 = pIndoor->stru1.uLastVisitDay; | |
7161 | |
7162 v3->timer_evt_type = _evt->_e_type; | |
7163 v3->timer_evt_ID = pEvent.uEventID; | |
7164 v3->timer_evt_seq_num = pEvent.event_sequence_num; | |
7165 | |
7166 v3->field_10 = _evt->v5; | |
7167 v3->field_12 = _evt->v6; | |
7168 v3->field_14 = _evt->v7; | |
7169 v3->field_16 = _evt->v8; | |
7170 v3->field_18 = _evt->v9; | |
7171 v3->field_1A = _evt->v10; | |
7172 | |
7173 | |
7174 v6 = ((unsigned short)_evt->v12 << 8) + _evt->v11; | |
7175 | |
789 | 7176 v3->time_left_to_fire = ((unsigned short)_evt->v12 << 8) + _evt->v11; |
7177 v3->fire_interval = ((unsigned short)_evt->v12 << 8) + _evt->v11; | |
1052 | 7178 if (v3->timer_evt_type == EVENT_Initialize && !(short)v6 ) |
781 | 7179 { |
363 | 7180 if ( v20 ) |
7181 v18 = pParty->uTimePlayed - v20; | |
7182 else | |
7183 v18 = 0i64; | |
7184 v26 = (signed int)(signed __int64)((double)(signed __int64)v18 * 0.234375) / 60 / 60 / 24; | |
7185 | |
7186 if ( v26 / 7 / 4 / 12 ) | |
781 | 7187 { |
363 | 7188 if ( v3->field_10 ) |
781 | 7189 { |
363 | 7190 ++dword_5B65C8_timers_count; |
789 | 7191 v3->next_fire_time = 0; |
363 | 7192 continue; |
7193 } | |
781 | 7194 } |
363 | 7195 if (v26 / 7 / 4 != 0 && v3->field_12 != 0 || |
7196 v26 / 7 != 0 && v3->field_14 != 0 || | |
7197 v26 != 0 || !v20) | |
781 | 7198 { |
363 | 7199 ++dword_5B65C8_timers_count; |
789 | 7200 v3->next_fire_time = 0; |
363 | 7201 continue; |
7202 } | |
781 | 7203 } |
363 | 7204 else |
781 | 7205 { |
363 | 7206 v8 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375); |
7207 v9 = v8; | |
7208 v10 = (signed int)v8 / 60; | |
7209 minutes = v10 % 60; | |
7210 v11 = (signed int)(v10 / 60); | |
7211 v12 = v11 % 24; | |
7212 v13 = (signed int)(v11 / 24); | |
7213 days = v13 % 7; | |
7214 v14 = (signed int)(v13 / 7); | |
7215 v15 = v14 % 4; | |
7216 v16 = (signed int)(v14 / 4); | |
7217 years = v16 / 12; | |
7218 | |
7219 auto _1 = (unsigned __int64)((double)pParty->uTimePlayed * 0.234375) >> 32; | |
7220 auto _2 = ((__int64)v9 << 32) | _1; | |
7221 | |
7222 seconds = _2 % 60; | |
7223 //v19 = (signed __int64)__PAIR__((unsigned __int64)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) >> 32, | |
7224 // v9) | |
7225 // % 60; | |
7226 | |
7227 hours = v12; | |
7228 weeks = v15; | |
7229 months = v16 % 12; | |
7230 if ( v3->field_10 ) | |
781 | 7231 { |
363 | 7232 ++years; |
781 | 7233 } |
363 | 7234 else |
781 | 7235 { |
363 | 7236 if ( v3->field_12 ) |
781 | 7237 { |
7238 ++months; | |
7239 } | |
7240 else | |
7241 { | |
7242 if ( v3->field_14 ) | |
363 | 7243 { |
781 | 7244 ++weeks; |
363 | 7245 } |
781 | 7246 else |
363 | 7247 { |
7248 ++days; | |
7249 minutes = v3->field_18; | |
7250 hours = v3->field_16; | |
7251 seconds = v3->field_1A; | |
7252 } | |
7253 } | |
781 | 7254 } |
789 | 7255 v3->next_fire_time = (signed __int64)((double)((seconds |
363 | 7256 + 60 * minutes |
7257 + 3600 * hours | |
7258 + 0x93A80 * weeks | |
7259 + 0x15180 * days | |
7260 + 0x24EA00 * (months + 12i64 * years)) << 7) | |
7261 * 0.033333335); | |
7262 | |
7263 ++dword_5B65C8_timers_count; | |
7264 } | |
7265 } | |
7266 } | |
781 | 7267 } |
0 | 7268 |
7269 //----- (00444360) -------------------------------------------------------- | |
7270 void __thiscall Level_LoadEvtAndStr(const char *pLevelName) | |
7271 { | |
7272 char pContainerName[120]; // [sp+8h] [bp-98h]@1 | |
7273 | |
7274 sprintf(pContainerName, "%s.evt", pLevelName); | |
1202 | 7275 uLevelEVT_Size = LoadEventsToBuffer(pContainerName, pLevelEVT.data(), 0x2400u); |
0 | 7276 |
7277 sprintf(pContainerName, "%s.str", pLevelName); | |
1202 | 7278 uLevelStrFileSize = LoadEventsToBuffer(pContainerName, pLevelStr.data(), 0x2400u); |
0 | 7279 if (uLevelStrFileSize) |
7280 LoadLevel_InitializeLevelStr(); | |
7281 } | |
7282 | |
7283 //----- (00444564) -------------------------------------------------------- | |
7284 const char *__cdecl sub_444564() | |
7285 { | |
7286 double v0; // st7@3 | |
7287 int v1; // ebx@3 | |
7288 int v2; // edi@3 | |
7289 int v3; // eax@3 | |
7290 int v5; // edi@6 | |
7291 int v6; // eax@6 | |
7292 int v7; // eax@6 | |
7293 unsigned __int8 v9; // zf@7 | |
7294 unsigned __int8 v10; // sf@7 | |
7295 ODMFace *v11; // eax@9 | |
7296 __int16 v12; // cx@9 | |
7297 const char *v13; // eax@11 | |
7298 const char *v14; // edi@11 | |
7299 const char *result; // eax@15 | |
7300 unsigned int v16; // [sp+0h] [bp-20h]@3 | |
7301 const char *v17; // [sp+4h] [bp-1Ch]@3 | |
7302 unsigned int pY; // [sp+8h] [bp-18h]@3 | |
7303 float v19; // [sp+Ch] [bp-14h]@1 | |
695 | 7304 int v20; |
0 | 7305 int v21; // [sp+14h] [bp-Ch]@1 |
7306 unsigned int v22; // [sp+18h] [bp-8h]@8 | |
7307 int pX; // [sp+1Ch] [bp-4h]@3 | |
7308 | |
693 | 7309 v20 = viewparams->sViewCenterX; |
7310 v21 = viewparams->sViewCenterY; | |
0 | 7311 v19 = (double)viewparams->field_2C * 0.000015258789; |
7312 if ( viewparams->field_2C == 384 ) | |
7313 { | |
711 | 7314 v20 = viewparams->indoor_center_x; |
7315 v21 = viewparams->indoor_center_y; | |
0 | 7316 } |
7317 v17 = 0; | |
7318 v16 = pOutdoor->uNumBModels; | |
7319 pMouse->GetClickPos((unsigned int *)&pX, &pY); | |
7320 v0 = 1.0 / v19; | |
7321 v1 = (signed __int64)((double)(pX - 229) * v0 + (double)v20); | |
7322 LODWORD(v19) = (signed __int64)((double)v21 - (double)(signed int)(pY - 181) * v0); | |
7323 v2 = abs(v1 + 22528) / 512; | |
7324 v3 = abs((signed)LODWORD(v19) - 22528); | |
695 | 7325 result = 0; |
0 | 7326 if ( pOutdoor->_47F04C(v2, v3 / 512) |
7327 && uCurrentlyLoadedLevelType == LEVEL_Outdoor | |
695 | 7328 && (signed int)v16 > 0 ) |
7329 { | |
7330 for(int i = 0; i < pOutdoor->uNumBModels && !v17; i++) | |
7331 { | |
7332 pX = pOutdoor->pBModels[i].vBoundingCenter.x - v1; | |
7333 pY = pOutdoor->pBModels[i].vBoundingCenter.y - LODWORD(v19); | |
0 | 7334 v5 = abs((signed)pY); |
7335 v6 = abs((signed)pX); | |
322 | 7336 v7 = int_get_vector_length(v6, v5, 0); |
695 | 7337 if ( v7 < pOutdoor->pBModels[i].sBoundingRadius ) |
7338 { | |
7339 if ( pOutdoor->pBModels[i].uNumFaces > 0 ) | |
7340 { | |
7341 for(int j = 0; j < pOutdoor->pBModels[i].uNumFaces; j++) | |
7342 { | |
7343 v11 = &pOutdoor->pBModels[i].pFaces[j];//&v8[v4]->pFaces[v22 / 0x134]; | |
0 | 7344 v12 = v11->sCogTriggeredID; |
7345 if ( v12 ) | |
7346 { | |
7347 if ( !(BYTE2(v11->uAttributes) & 0x10) ) | |
7348 { | |
428 | 7349 v13 = GetEventHintString(v12); |
0 | 7350 v14 = v13; |
7351 if ( v13 ) | |
7352 { | |
1104 | 7353 if ( _stricmp(v13, "") ) |
0 | 7354 v17 = v14; |
7355 } | |
7356 } | |
7357 } | |
695 | 7358 } |
0 | 7359 } |
7360 result = v17; | |
695 | 7361 } |
7362 } | |
0 | 7363 } |
7364 return result; | |
7365 } | |
7366 | |
7367 //----- (00444D80) -------------------------------------------------------- | |
7368 signed int __cdecl GetTravelTime() | |
7369 { | |
7370 signed int v0; // esi@1 | |
7371 | |
7372 v0 = uDefaultTravelTime_ByFoot; | |
652 | 7373 if ( CheckHiredNPCSpeciality(Guide) ) |
0 | 7374 --v0; |
652 | 7375 if ( CheckHiredNPCSpeciality(Tracker) ) |
0 | 7376 v0 -= 2; |
652 | 7377 if ( CheckHiredNPCSpeciality(Pathfinder) ) |
0 | 7378 v0 -= 3; |
652 | 7379 if ( CheckHiredNPCSpeciality(Explorer) ) |
0 | 7380 --v0; |
7381 if ( v0 < 1 ) | |
7382 v0 = 1; | |
7383 return v0; | |
7384 } | |
7385 // 6BD07C: using guessed type int uDefaultTravelTime_ByFoot; | |
7386 | |
7387 //----- (004451A8) -------------------------------------------------------- | |
7388 void __fastcall sub_4451A8_press_any_key(int a1, int a2, int a4) | |
7389 { | |
7390 int v3; // esi@1 | |
7391 int v4; // edi@1 | |
7392 | |
7393 v3 = a2; | |
7394 v4 = a1; | |
7395 if ( !pGUIWindow2 ) | |
7396 { | |
7397 if ( pParty->uFlags & 2 ) | |
7398 pGame->Draw(); | |
1052 | 7399 pAudioPlayer->StopChannels(-1, -1); |
0 | 7400 pMiscTimer->Pause(); |
7401 pEventTimer->Pause(); | |
7402 dword_5C3418 = v4; | |
7403 dword_5C341C = v3; | |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
515
diff
changeset
|
7404 _591094_decoration = activeLevelDecoration; |
948 | 7405 pGUIWindow2 = GUIWindow::Create(0, 0, 640, 480, WINDOW_GreetingNPC, a4, 0); |
7406 pGUIWindow2->CreateButton( 61, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0); | |
7407 pGUIWindow2->CreateButton(177, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0); | |
7408 pGUIWindow2->CreateButton(292, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0); | |
7409 pGUIWindow2->CreateButton(407, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0); | |
0 | 7410 } |
7411 } | |
7412 | |
7413 //----- (004452BB) -------------------------------------------------------- | |
7414 void __cdecl sub_4452BB() | |
7415 { | |
7416 pGUIWindow2->Release(); | |
7417 pGUIWindow2 = 0; | |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
515
diff
changeset
|
7418 activeLevelDecoration = _591094_decoration; |
1052 | 7419 EventProcessor(dword_5C3418, 0, 1, dword_5C341C); |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
515
diff
changeset
|
7420 activeLevelDecoration = NULL; |
0 | 7421 pEventTimer->Resume(); |
7422 } | |
7423 | |
7424 //----- (004465DF) -------------------------------------------------------- | |
7425 int sub_4465DF_check_season(int a1) | |
7426 { | |
7427 unsigned int v1; // eax@1 | |
7428 unsigned int v2; // edx@1 | |
7429 int v3; // ecx@2 | |
7430 int v4; // ecx@3 | |
7431 char v6; // zf@9 | |
7432 | |
7433 v1 = pParty->uCurrentMonth + 1; | |
7434 v2 = pParty->uDaysPlayed + 1; | |
7435 if ( a1 ) | |
7436 { | |
7437 v3 = a1 - 1; | |
7438 if ( v3 ) | |
7439 { | |
7440 v4 = v3 - 1; | |
7441 if ( v4 ) | |
7442 { | |
7443 if ( v4 != 1 ) | |
7444 return 0; | |
7445 if ( v1 != 12 ) | |
7446 { | |
7447 if ( (signed int)v1 >= 1 && (signed int)v1 <= 2 ) | |
7448 return 1; | |
7449 v6 = v1 == 3; | |
7450 LABEL_24: | |
7451 if ( !v6 || (signed int)v2 >= 21 ) | |
7452 return 0; | |
7453 return 1; | |
7454 } | |
7455 } | |
7456 else | |
7457 { | |
7458 if ( v1 != 9 ) | |
7459 { | |
7460 if ( (signed int)v1 >= 10 && (signed int)v1 <= 11 ) | |
7461 return 1; | |
7462 v6 = v1 == 12; | |
7463 goto LABEL_24; | |
7464 } | |
7465 } | |
7466 } | |
7467 else | |
7468 { | |
7469 if ( v1 != 6 ) | |
7470 { | |
7471 if ( (signed int)v1 >= 7 && (signed int)v1 <= 8 ) | |
7472 return 1; | |
7473 v6 = v1 == 9; | |
7474 goto LABEL_24; | |
7475 } | |
7476 } | |
7477 } | |
7478 else | |
7479 { | |
7480 if ( v1 != 3 ) | |
7481 { | |
7482 if ( (signed int)v1 >= 4 && (signed int)v1 <= 5 ) | |
7483 return 1; | |
7484 v6 = v1 == 6; | |
7485 goto LABEL_24; | |
7486 } | |
7487 } | |
7488 if ( (signed int)v2 >= 21 ) | |
7489 return 1; | |
7490 return 0; | |
7491 } | |
7492 | |
7493 //----- (0044861E) -------------------------------------------------------- | |
7494 void __fastcall sub_44861E_set_texture(unsigned int uFaceCog, const char *pFilename) | |
7495 { | |
7496 unsigned int v2; // eax@2 | |
7497 unsigned __int16 v3; // di@2 | |
7498 signed int v4; // esi@5 | |
7499 BLVFace *v5; // eax@7 | |
7500 unsigned int *v6; // eax@8 | |
7501 char *v7; // eax@9 | |
7502 int v8; // edi@16 | |
7503 char *v9; // esi@16 | |
7504 ODMFace *v10; // eax@17 | |
7505 unsigned int *v11; // eax@19 | |
7506 unsigned __int16 v12; // [sp+Ch] [bp-18h]@2 | |
7507 const char *Str2; // [sp+10h] [bp-14h]@1 | |
7508 unsigned int v14; // [sp+14h] [bp-10h]@1 | |
7509 signed int v15; // [sp+18h] [bp-Ch]@14 | |
7510 int v16; // [sp+1Ch] [bp-8h]@15 | |
7511 signed int v17; // [sp+20h] [bp-4h]@4 | |
7512 signed int v18; // [sp+20h] [bp-4h]@16 | |
7513 | |
7514 Str2 = pFilename; | |
7515 v14 = uFaceCog; | |
7516 if ( uFaceCog ) | |
7517 { | |
7518 v2 = pBitmaps_LOD->LoadTexture(pFilename); | |
7519 v3 = v2; | |
7520 v12 = v2; | |
7521 if ( v2 != -1 ? (int)&pBitmaps_LOD->pTextures[v2] : 0 ) | |
7522 { | |
7523 pBitmaps_LOD->pTextures[v2].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[v2].palette_id1); | |
7524 | |
7525 if ( uCurrentlyLoadedLevelType == 1 ) | |
7526 { | |
7527 v17 = 1; | |
7528 if ( (signed int)pIndoor->uNumFaceExtras > 1 ) | |
7529 { | |
7530 v4 = 1; | |
7531 do | |
7532 { | |
7533 if ( pIndoor->pFaceExtras[v4].sCogNumber == v14 ) | |
7534 { | |
7535 v5 = &pIndoor->pFaces[pIndoor->pFaceExtras[v4].field_C]; | |
7536 if ( BYTE1(v5->uAttributes) & 0x40 ) | |
7537 { | |
7538 pIndoor->pFaces[pIndoor->pFaceExtras[v4].field_C].uBitmapID = pTextureFrameTable->FindTextureByName( | |
7539 Str2); | |
7540 v6 = (unsigned int *)&pIndoor->pFaces[pIndoor->pFaceExtras[v4].field_C].uBitmapID; | |
7541 if ( *(_WORD *)v6 ) | |
7542 { | |
7543 pTextureFrameTable->LoadAnimationSequenceAndPalettes(*(_WORD *)v6); | |
7544 } | |
7545 else | |
7546 { | |
7547 *(_WORD *)v6 = v3; | |
7548 v7 = (char *)&pIndoor->pFaces[pIndoor->pFaceExtras[v4].field_C].uAttributes; | |
7549 v7[1] &= 0xBFu; | |
7550 } | |
7551 } | |
7552 else | |
7553 { | |
7554 v5->uBitmapID = v3; | |
7555 } | |
7556 } | |
7557 ++v17; | |
7558 ++v4; | |
7559 } | |
7560 while ( v17 < (signed int)pIndoor->uNumFaceExtras ); | |
7561 } | |
7562 pParty->uFlags |= 2u; | |
7563 } | |
7564 else | |
7565 { | |
7566 v15 = 0; | |
7567 if ( (signed int)pOutdoor->uNumBModels > 0 ) | |
7568 { | |
7569 v16 = 0; | |
7570 do | |
7571 { | |
7572 v8 = 0; | |
7573 v9 = (char *)&pOutdoor->pBModels[v16].pVertices; | |
7574 v18 = 0; | |
7575 if ( (signed int)pOutdoor->pBModels[v16].uNumFaces > 0 ) | |
7576 { | |
7577 do | |
7578 { | |
7579 v10 = (ODMFace *)(v8 + *((_DWORD *)v9 + 4)); | |
7580 if ( v10->sCogNumber == v14 ) | |
7581 { | |
7582 if ( BYTE1(v10->uAttributes) & 0x40 ) | |
7583 { | |
7584 *(_WORD *)(*((_DWORD *)v9 + 4) + v8 + 272) = pTextureFrameTable->FindTextureByName( | |
7585 Str2); | |
7586 v11 = (unsigned int *)(*((_DWORD *)v9 + 4) + v8 + 272); | |
7587 if ( *(_WORD *)v11 ) | |
7588 { | |
7589 pTextureFrameTable->LoadAnimationSequenceAndPalettes(*(_WORD *)v11); | |
7590 } | |
7591 else | |
7592 { | |
7593 *(_WORD *)v11 = v12; | |
7594 *(_BYTE *)(*((_DWORD *)v9 + 4) + v8 + 29) &= 0xBFu; | |
7595 } | |
7596 } | |
7597 else | |
7598 { | |
7599 v10->uTextureID = v12; | |
7600 } | |
7601 } | |
7602 ++v18; | |
7603 v8 += 308; | |
7604 } | |
7605 while ( v18 < *((_DWORD *)v9 + 2) ); | |
7606 } | |
7607 ++v15; | |
7608 ++v16; | |
7609 } | |
7610 while ( v15 < (signed int)pOutdoor->uNumBModels ); | |
7611 } | |
7612 } | |
7613 pParty->uFlags |= 2u; | |
7614 } | |
7615 } | |
7616 } | |
7617 | |
7618 //----- (0044882F) -------------------------------------------------------- | |
7619 void __fastcall SetDecorationSprite(unsigned int uCog, int a2, const char *pFileName) | |
7620 { | |
7621 signed int v3; // ebp@1 | |
7622 char *v4; // esi@2 | |
7623 unsigned __int16 v5; // ax@6 | |
7624 unsigned int v6; // [sp+4h] [bp-8h]@1 | |
7625 int v7; // [sp+8h] [bp-4h]@1 | |
7626 | |
7627 v3 = 0; | |
7628 v7 = a2; | |
7629 v6 = uCog; | |
7630 if ( (signed int)uNumLevelDecorations > 0 ) | |
7631 { | |
7632 v4 = (char *)&pLevelDecorations[0].field_2; | |
7633 do | |
7634 { | |
7635 if ( *((_WORD *)v4 + 9) == v6 ) | |
7636 { | |
1104 | 7637 if ( pFileName && _stricmp(pFileName, "0") ) |
0 | 7638 { |
7639 v5 = pDecorationList->GetDecorIdByName(pFileName); | |
7640 *((_WORD *)v4 - 1) = v5; | |
7641 pDecorationList->InitializeDecorationSprite((signed __int16)v5); | |
7642 } | |
7643 if ( v7 ) | |
7644 *v4 &= 0xDFu; | |
7645 else | |
7646 *v4 |= 0x20u; | |
7647 pParty->uFlags |= 2u; | |
7648 } | |
7649 ++v3; | |
7650 v4 += 32; | |
7651 } | |
7652 while ( v3 < (signed int)uNumLevelDecorations ); | |
7653 } | |
7654 } | |
7655 | |
7656 //----- (0044892E) -------------------------------------------------------- | |
7657 void __fastcall sub_44892E_set_faces_bit(int sCogNumber, int bit, int on) | |
7658 { | |
7659 signed int v3; // esi@2 | |
7660 signed int v4; // ecx@4 | |
7661 char *v5; // eax@6 | |
7662 int v6; // edi@13 | |
7663 char *v7; // esi@13 | |
7664 signed int v8; // ecx@13 | |
7665 ODMFace *v9; // eax@14 | |
7666 int v10; // [sp+0h] [bp-Ch]@1 | |
7667 signed int v11; // [sp+4h] [bp-8h]@11 | |
7668 int v12; // [sp+8h] [bp-4h]@12 | |
7669 | |
7670 v10 = sCogNumber; | |
7671 if ( sCogNumber ) | |
7672 { | |
7673 v3 = 1; | |
7674 if ( uCurrentlyLoadedLevelType == 1 ) | |
7675 { | |
7676 if ( (signed int)pIndoor->uNumFaceExtras > 1 ) | |
7677 { | |
7678 v4 = 1; | |
7679 do | |
7680 { | |
7681 if ( pIndoor->pFaceExtras[v4].sCogNumber == v10 ) | |
7682 { | |
7683 v5 = (char *)&pIndoor->pFaces[pIndoor->pFaceExtras[v4].field_C].uAttributes; | |
7684 if ( on ) | |
7685 *(_DWORD *)v5 |= bit; | |
7686 else | |
7687 *(_DWORD *)v5 &= ~bit; | |
7688 } | |
7689 ++v3; | |
7690 ++v4; | |
7691 } | |
7692 while ( v3 < (signed int)pIndoor->uNumFaceExtras ); | |
7693 } | |
7694 pParty->uFlags |= 2u; | |
7695 } | |
7696 else | |
7697 { | |
7698 v11 = 0; | |
7699 if ( (signed int)pOutdoor->uNumBModels > 0 ) | |
7700 { | |
7701 v12 = 0; | |
7702 do | |
7703 { | |
7704 v6 = 0; | |
7705 v7 = (char *)&pOutdoor->pBModels[v12].pVertices; | |
7706 v8 = 0; | |
7707 if ( (signed int)pOutdoor->pBModels[v12].uNumFaces > 0 ) | |
7708 { | |
7709 do | |
7710 { | |
7711 v9 = (ODMFace *)(v6 + *((_DWORD *)v7 + 4)); | |
7712 if ( v9->sCogNumber == v10 ) | |
7713 { | |
7714 if ( on ) | |
7715 v9->uAttributes |= bit; | |
7716 else | |
7717 v9->uAttributes &= ~bit; | |
7718 } | |
7719 ++v8; | |
7720 v6 += 308; | |
7721 } | |
7722 while ( v8 < *((_DWORD *)v7 + 2) ); | |
7723 } | |
7724 ++v11; | |
7725 ++v12; | |
7726 } | |
7727 while ( v11 < (signed int)pOutdoor->uNumBModels ); | |
7728 } | |
7729 } | |
7730 pParty->uFlags |= 2u; | |
7731 } | |
7732 } | |
7733 | |
7734 //----- (00448A98) -------------------------------------------------------- | |
7735 void __fastcall ToggleActorGroupFlag(unsigned int uGroupID, unsigned int uFlag, unsigned int bToggle) | |
7736 { | |
7737 unsigned int v3; // ebx@1 | |
7738 unsigned int v4; // ebp@1 | |
7739 signed int v5; // edi@1 | |
82 | 7740 Actor *v6; // esi@4 |
0 | 7741 size_t v7; // ecx@10 |
82 | 7742 Actor *v8; // eax@11 |
0 | 7743 unsigned __int16 v9; // dx@14 |
7744 | |
7745 v4 = uGroupID; | |
7746 v5 = Standing; | |
7747 v3 = uFlag; | |
7748 if ( uGroupID ) | |
7749 { | |
7750 if ( bToggle ) | |
7751 { | |
7752 if ( (signed int)uNumActors > Standing ) | |
7753 { | |
1202 | 7754 v6 = pActors.data();//[0].uAttributes; |
0 | 7755 do |
7756 { | |
82 | 7757 if ( v6->uGroup == v4 ) |
7758 { | |
7759 v6->uAttributes |= v3; | |
0 | 7760 if ( v3 == 0x10000 ) |
7761 { | |
82 | 7762 v6->uAIState = Disabled; |
7763 v6->UpdateAnimation(); | |
0 | 7764 } |
7765 } | |
7766 ++v5; | |
82 | 7767 ++v6; |
0 | 7768 } |
7769 while ( v5 < (signed int)uNumActors ); | |
7770 } | |
7771 } | |
7772 else | |
7773 { | |
7774 v7 = uNumActors; | |
7775 if ( (signed int)uNumActors > Standing ) | |
7776 { | |
1202 | 7777 v8 = pActors.data();//[0].uAIState; |
0 | 7778 do |
7779 { | |
82 | 7780 if ( v8->uGroup == v4 ) |
0 | 7781 { |
7782 if ( v3 == 0x10000 ) | |
7783 { | |
82 | 7784 v9 = v8->uAIState; |
7785 if ( v8->uAIState != Dead ) | |
0 | 7786 { |
7787 if ( v9 != 4 && v9 != 11 ) | |
82 | 7788 v8->uAIState = Standing; |
7789 } | |
7790 } | |
7791 LODWORD(v8->uAttributes) &= ~v3; | |
7792 } | |
7793 ++v8; | |
0 | 7794 --v7; |
7795 } | |
7796 while ( v7 ); | |
7797 } | |
7798 } | |
7799 } | |
7800 } | |
7801 | |
7802 //----- (00448B45) -------------------------------------------------------- | |
7803 void __thiscall GameUI_StatusBar_UpdateTimedString(unsigned int bForceHide) | |
7804 { | |
783 | 7805 if ( bForceHide || GameUI_Footer_TimeLeft && GetTickCount() >= GameUI_Footer_TimeLeft ) |
7806 GameUI_Footer_TimeLeft = 0; | |
0 | 7807 } |
7808 | |
7809 //----- (00448B67) -------------------------------------------------------- | |
790 | 7810 void OnTimer(int __unused) |
7811 { | |
789 | 7812 if (pEventTimer->bPaused) |
7813 return; | |
7814 | |
790 | 7815 if (__unused) |
7816 _5773C0_unused = 0; | |
789 | 7817 |
790 | 7818 auto v13 = (signed __int64)(pParty->uTimePlayed - _5773B8_event_timer) / 128; |
789 | 7819 if (!v13) |
7820 return; | |
7821 | |
7822 //uint _v2v3 = pParty->uTimePlayed; | |
7823 //v3 = HIDWORD(pParty->uTimePlayed); | |
7824 //v2 = LODWORD(pParty->uTimePlayed); | |
7825 | |
7826 _5773B8_event_timer = pParty->uTimePlayed; | |
7827 | |
7828 for (uint i = 0; i < dword_5B65C8_timers_count; ++i) | |
7829 { | |
7830 //v4 = (char *)&array_5B5928_timers[0].field_C; | |
7831 auto timer = array_5B5928_timers + i; | |
7832 //while ( 1 ) | |
7833 //{ | |
7834 //v5 = *(short *)v4; | |
7835 if (timer->time_left_to_fire) | |
7836 { | |
7837 if (v13 < timer->time_left_to_fire) | |
7838 timer->time_left_to_fire -= v13; | |
7839 else | |
7840 { | |
7841 timer->time_left_to_fire = timer->fire_interval; | |
1052 | 7842 EventProcessor(timer->timer_evt_ID, 0, 1, timer->timer_evt_seq_num); |
789 | 7843 } |
7844 } | |
7845 else | |
7846 { | |
7847 if (timer->next_fire_time < pParty->uTimePlayed) | |
7848 { | |
7849 uint next_trigger_time = 1 * 60 * 60 * 24; // 1 day | |
7850 if (timer->field_10) | |
7851 next_trigger_time = 336 * 60 * 60 * 24; // 1 year | |
7852 else if (timer->field_12) | |
7853 next_trigger_time = 28 * 60 * 60 * 24; // 1 month | |
7854 else if (timer->field_14) | |
7855 next_trigger_time = 7 * 60 * 60 * 24; // 1 week | |
7856 | |
7857 timer->next_fire_time += (next_trigger_time * 128) / 3.0f; | |
1052 | 7858 if (timer->next_fire_time < pParty->uTimePlayed) // make sure in wont fire several times in a row if big time interval has lapsed |
789 | 7859 timer->next_fire_time = pParty->uTimePlayed; |
7860 | |
1052 | 7861 EventProcessor(timer->timer_evt_ID, 0, 1, timer->timer_evt_seq_num); |
0 | 7862 } |
7863 } | |
7864 } | |
7865 } | |
7866 | |
7867 //----- (00481D77) -------------------------------------------------------- | |
7868 void _outdoor_project(RenderVertexSoft *v) | |
7869 { | |
7870 double v1; // st7@1 | |
7871 double v2; // st7@1 | |
7872 | |
7873 v1 = 1.0 / (v->vWorldViewPosition.x + 0.0000001); | |
168 | 7874 v->_rhw = v1; |
0 | 7875 v2 = v1 * (double)pOutdoorCamera->int_fov_rad; |
7876 v->vWorldViewProjX = (double)pViewport->uScreenCenterX - v2 * v->vWorldViewPosition.y; | |
7877 v->vWorldViewProjY = (double)pViewport->uScreenCenterY - v2 * v->vWorldViewPosition.z; | |
7878 } | |
7879 | |
7880 //----- (00448CF4) -------------------------------------------------------- | |
7881 void __fastcall sub_448CF4_spawn_monsters(__int16 typeindex, __int16 level, int count, int x, int y, int z, int group, unsigned int uUniqueName) | |
7882 { | |
7883 __int16 v8; // di@1 | |
7884 __int16 v9; // si@1 | |
7885 unsigned int v10; // eax@1 | |
7886 size_t v11; // ebx@2 | |
7887 signed int v12; // esi@2 | |
35 | 7888 Actor *pActor;//Actor_uYawAngle_cr *v13; // ebx@3 |
0 | 7889 AIDirection a3; // [sp+Ch] [bp-50h]@2 |
7890 AIDirection v15; // [sp+28h] [bp-34h]@2 | |
7891 //SpawnPointMM7 v16; // [sp+44h] [bp-18h]@1 | |
7892 | |
7893 v8 = typeindex; | |
7894 v9 = level; | |
7895 | |
7896 SpawnPointMM7 v16; // [sp+44h] [bp-18h]@1 | |
7897 //SpawnPointMM7::SpawnPointMM7(&v16); | |
7898 | |
7899 v16.vPosition.x = x; | |
7900 v16.vPosition.y = y; | |
7901 v16.vPosition.z = z; | |
7902 v16.uGroup = group; | |
7903 v16.uRadius = 32; | |
7904 v16.uKind = 3; | |
7905 v16.uIndex = v8 + 2 * v9 + v9; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
7906 v10 = pMapStats->GetMapInfo(pCurrentMapName.data()); |
0 | 7907 if ( v10 ) |
7908 { | |
7909 v11 = uNumActors; | |
7910 SpawnEncounter((MapInfo *)&pMapStats->pInfos[v10], &v16, 0, count, 0); | |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
7911 memcpy(&v15, Actor::GetDirectionInfo(PID(OBJECT_Actor, v11), 4u, &a3, 1), sizeof(v15)); |
0 | 7912 v12 = v11; |
7913 if ( (signed int)v11 < (signed int)uNumActors ) | |
7914 { | |
35 | 7915 for ( pActor = &pActors[v11]; v12 < (signed int)uNumActors; ++pActor ) |
7916 { | |
7917 pActor->PrepareSprites(0); | |
0 | 7918 ++v12; |
35 | 7919 pActor->uYawAngle = v15.uYawAngle; |
7920 pActor->dword_000334_unique_name = uUniqueName; | |
7921 } | |
0 | 7922 } |
7923 } | |
7924 } | |
7925 | |
7926 // 4EE088: using guessed type __int16 word_4EE088_sound_ids[]; | |
7927 | |
7928 //----- (0044987B) -------------------------------------------------------- | |
783 | 7929 void sub_44987B(const char *pMapName, MapStartPoint start_point) |
0 | 7930 { |
7931 const char *v2; // edi@1 | |
7932 | |
7933 v2 = pMapName; | |
7934 pAudioPlayer->StopChannels(-1, -1); | |
434 | 7935 pGameLoadingUI_ProgressBar->Initialize(GUIProgressBar::TYPE_None); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
7936 if ( _stricmp(pCurrentMapName.data(), v2) ) |
0 | 7937 SaveGame(1, 0); |
783 | 7938 |
978 | 7939 uGameState = GAME_STATE_2; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
7940 strcpy(pCurrentMapName.data(), v2); |
783 | 7941 uLevel_StartingPointType = start_point; |
0 | 7942 } |
7943 // 6BE35C: using guessed type int uLevel_StartingPointType; | |
7944 | |
7945 //----- (004498D5) -------------------------------------------------------- | |
783 | 7946 void TeleportToStartingPoint(MapStartPoint point) |
7947 { | |
7948 //unsigned int v1; // ecx@2 | |
7949 //int v2; // ecx@3 | |
7950 //int v3; // ecx@4 | |
0 | 7951 unsigned __int16 v4; // ax@11 |
7952 signed int v5; // ecx@12 | |
7953 LevelDecoration *v6; // edx@13 | |
7954 signed int v7; // ecx@17 | |
7955 int v8; // eax@17 | |
7956 int v9; // ecx@17 | |
7957 const char *v10; // [sp-4h] [bp-84h]@6 | |
7958 char pName[128]; // [sp+8h] [bp-78h]@11 | |
7959 | |
783 | 7960 switch (point) |
7961 { | |
7962 case MapStartPoint_Party: v10 = "Party Start"; break; | |
7963 case MapStartPoint_North: v10 = "North Start"; break; | |
7964 case MapStartPoint_South: v10 = "South Start"; break; | |
7965 case MapStartPoint_East: v10 = "East Start"; break; | |
7966 case MapStartPoint_West: v10 = "West Start"; break; | |
7967 } | |
7968 | |
0 | 7969 strcpy(pName, v10); |
7970 v4 = pDecorationList->GetDecorIdByName(pName); | |
7971 if ( v4 ) | |
7972 { | |
7973 v5 = 0; | |
7974 if ( (signed int)uNumLevelDecorations > 0 ) | |
7975 { | |
1202 | 7976 v6 = pLevelDecorations.data(); |
0 | 7977 while ( v6->uDecorationDescID != (signed __int16)v4 ) |
7978 { | |
7979 ++v5; | |
7980 ++v6; | |
7981 if ( v5 >= (signed int)uNumLevelDecorations ) | |
7982 goto LABEL_20; | |
7983 } | |
7984 v7 = v5; | |
7985 pParty->vPosition.x = pLevelDecorations[v7].vPosition.x; | |
7986 pParty->vPosition.y = pLevelDecorations[v7].vPosition.y; | |
7987 pParty->vPosition.z = pLevelDecorations[v7].vPosition.z; | |
7988 pParty->uFallStartY = pParty->vPosition.z; | |
7989 v8 = (signed int)(stru_5C6E00->uIntegerHalfPi * pLevelDecorations[v7].field_1A) / 90; | |
7990 v9 = pLevelDecorations[v7].field_10_y_rot; | |
7991 pParty->sRotationY = v8; | |
7992 if ( v9 ) | |
7993 pParty->sRotationY = v9; | |
7994 pParty->sRotationX = 0; | |
7995 pParty->uFallSpeed = 0; | |
7996 } | |
7997 LABEL_20: | |
7998 if ( dword_5B65C0 ) | |
7999 { | |
8000 if ( _5B65A8_npcdata_uflags_or_other ) | |
8001 pParty->vPosition.x = _5B65A8_npcdata_uflags_or_other; | |
8002 if ( _5B65AC_npcdata_fame_or_other ) | |
8003 pParty->vPosition.y = _5B65AC_npcdata_fame_or_other; | |
8004 if ( _5B65B0_npcdata_rep_or_other ) | |
8005 { | |
8006 pParty->vPosition.z = _5B65B0_npcdata_rep_or_other; | |
8007 pParty->uFallStartY = _5B65B0_npcdata_rep_or_other; | |
8008 } | |
8009 if ( _5B65B4_npcdata_loword_house_or_other ) | |
8010 pParty->sRotationY = _5B65B4_npcdata_loword_house_or_other; | |
8011 if ( _5B65B8_npcdata_hiword_house_or_other ) | |
8012 pParty->sRotationX = _5B65B8_npcdata_hiword_house_or_other; | |
8013 if ( dword_5B65BC ) | |
8014 pParty->uFallSpeed = dword_5B65BC; | |
8015 } | |
8016 _5B65B4_npcdata_loword_house_or_other = -1; | |
8017 dword_5B65C0 = 0; | |
8018 dword_5B65BC = 0; | |
8019 _5B65B8_npcdata_hiword_house_or_other = 0; | |
8020 _5B65B0_npcdata_rep_or_other = 0; | |
8021 _5B65AC_npcdata_fame_or_other = 0; | |
8022 _5B65A8_npcdata_uflags_or_other = 0; | |
8023 } | |
8024 } | |
1035 | 8025 |
8026 | |
0 | 8027 |
8028 //----- (00449A49) -------------------------------------------------------- | |
8029 __int16 __fastcall sub_449A49_door_switch_animation(unsigned int uDoorID, int a2) | |
8030 { | |
8031 int v2; // eax@1 | |
8032 int v3; // ebx@1 | |
8033 signed int v4; // esi@2 | |
8034 int v5; // edx@2 | |
8035 BLVDoor *v6; // ecx@8 | |
8036 unsigned int v7; // edx@18 | |
8037 signed int v8; // esi@19 | |
8038 int v9; // eax@19 | |
8039 char Args; // [sp+Ch] [bp-78h]@6 | |
8040 | |
8041 LOWORD(v2) = LOWORD(pIndoor->pDoors); | |
8042 v3 = a2; | |
8043 if ( !pIndoor->pDoors ) | |
8044 return v2; | |
8045 v4 = 0; | |
8046 v5 = (int)&pIndoor->pDoors->uDoorID; | |
8047 do | |
8048 { | |
8049 if ( *(int *)v5 == uDoorID ) | |
8050 break; | |
8051 ++v4; | |
8052 v5 += 80; | |
8053 } | |
8054 while ( v4 < 200 ); | |
8055 if ( v4 >= 200 ) | |
8056 { | |
8057 sprintf(&Args, "Unable to find Door ID: %i!", uDoorID); | |
8058 Abortf(&Args); | |
8059 } | |
8060 v6 = &pIndoor->pDoors[v4]; | |
8061 if ( v3 == 2 ) | |
8062 { | |
8063 LOWORD(v2) = v6->uState; | |
8064 if ( (short)v2 == 3 || (short)v2 == 1 ) | |
8065 return v2; | |
8066 if ( (short)v2 ) | |
8067 goto LABEL_14; | |
8068 } | |
8069 else | |
8070 { | |
8071 if ( !v3 ) | |
8072 { | |
8073 LABEL_14: | |
8074 LOWORD(v2) = v6->uState; | |
8075 if ( (short)v2 && (short)v2 != 3 ) | |
8076 { | |
8077 v6->uState = BLVDoor::Closing; | |
8078 if ( (short)v2 == 2 ) | |
8079 { | |
8080 LABEL_17: | |
8081 v6->uTimeSinceTriggered = 0; | |
8082 return v2; | |
8083 } | |
8084 v7 = v6->uTimeSinceTriggered; | |
8085 v2 = 15360; | |
8086 if ( v7 != 15360 ) | |
8087 { | |
8088 v8 = v6->uOpenSpeed; | |
8089 v9 = v6->uCloseSpeed; | |
8090 LABEL_26: | |
8091 v2 = (v6->uMoveLength << 7) / v8 - ((signed int)(v7 * v9) / 128 << 7) / v8; | |
8092 goto LABEL_27; | |
8093 } | |
8094 goto LABEL_27; | |
8095 } | |
8096 return v2; | |
8097 } | |
8098 if ( v3 != 1 ) | |
8099 return v2; | |
8100 } | |
8101 LOWORD(v2) = v6->uState; | |
8102 if ( (short)v2 != 2 && (short)v2 != 1 ) | |
8103 { | |
8104 v6->uState = BLVDoor::Opening; | |
8105 if ( !(short)v2 ) | |
8106 goto LABEL_17; | |
8107 v7 = v6->uTimeSinceTriggered; | |
8108 v2 = 15360; | |
8109 if ( v7 != 15360 ) | |
8110 { | |
8111 v8 = v6->uCloseSpeed; | |
8112 v9 = v6->uOpenSpeed; | |
8113 goto LABEL_26; | |
8114 } | |
8115 LABEL_27: | |
8116 v6->uTimeSinceTriggered = v2; | |
8117 } | |
8118 return v2; | |
8119 } | |
8120 | |
8121 //----- (00449B57) -------------------------------------------------------- | |
521 | 8122 bool _449B57_test_bit( unsigned __int8 *a1, __int16 a2 ) |
1035 | 8123 { |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1112
diff
changeset
|
8124 return (a1[(a2 - 1) >> 3] & (0x80u >> (a2 - 1) % 8)) != 0; |
0 | 8125 } |
8126 | |
8127 //----- (00449B7E) -------------------------------------------------------- | |
501 | 8128 void _449B7E_toggle_bit(unsigned char *pArray, __int16 a2, unsigned __int16 bToggle) |
0 | 8129 { |
8130 signed int v3; // esi@1 | |
501 | 8131 unsigned char set_bit; // edx@1 |
0 | 8132 |
8133 v3 = a2 - 1; | |
501 | 8134 set_bit = 0x80 >> v3 % 8; |
0 | 8135 if ( bToggle ) |
501 | 8136 pArray[v3 / 8] |= set_bit; |
8137 else | |
8138 pArray[v3 / 8] &= ~set_bit; | |
0 | 8139 } |
8140 | |
8141 //----- (0044C175) -------------------------------------------------------- | |
1160 | 8142 void ShowStatusBarString( const char *pString, unsigned int uNumSeconds ) |
8143 { | |
0 | 8144 unsigned int v2; // esi@1 |
8145 int i; // eax@1 | |
8146 | |
8147 v2 = uNumSeconds; | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
8148 strcpy(GameUI_Footer_TimedString.data(), pString); |
783 | 8149 GameUI_Footer_TimeLeft = 1000 * v2 + GetTickCount(); |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
8150 for ( i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()); |
0 | 8151 i > 450; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
8152 i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()) ) |
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
8153 byte_5C3427[strlen(GameUI_Footer_TimedString.data())] = 0; |
0 | 8154 } |
8155 | |
8156 //----- (0044C1D0) -------------------------------------------------------- | |
1035 | 8157 void ShowNothingHereStatus() |
0 | 8158 { |
783 | 8159 if ( !GameUI_Footer_TimeLeft ) |
0 | 8160 ShowStatusBarString(pGlobalTXT_LocalizationStrings[521], 2u);// Nothing here |
8161 } | |
8162 | |
8163 //----- (0044C28B) -------------------------------------------------------- | |
8164 signed int __cdecl const_2() | |
8165 { | |
8166 return 2; | |
8167 } | |
8168 | |
8169 //----- (0044C28F) -------------------------------------------------------- | |
8170 bool __cdecl sub_44C28F_open_nwc_dungeon() | |
8171 { | |
8172 bool result; // eax@1 | |
8173 | |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
8174 result = _stricmp("nwc.blv", pCurrentMapName.data()); |
0 | 8175 if ( result ) |
8176 { | |
8177 _5B65A8_npcdata_uflags_or_other = 0; | |
8178 _5B65AC_npcdata_fame_or_other = 0; | |
8179 _5B65B0_npcdata_rep_or_other = 0; | |
8180 _5B65B4_npcdata_loword_house_or_other = 0; | |
8181 _5B65B8_npcdata_hiword_house_or_other = 0; | |
8182 dword_5B65BC = 0; | |
8183 dword_5B65C0 = 0; | |
8184 pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen; | |
783 | 8185 sub_44987B("nwc.blv", MapStartPoint_Party); |
151 | 8186 pCurrentScreen = SCREEN_GAME; |
0 | 8187 result = 1; |
8188 } | |
8189 return result; | |
8190 } | |
8191 | |
8192 //----- (0044C2F4) -------------------------------------------------------- | |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1112
diff
changeset
|
8193 bool LevelDecoration::IsInteractive() |
0 | 8194 { |
1035 | 8195 switch (uDecorationDescID) |
8196 { | |
8197 case 4: // trash pile | |
8198 case 5: // campfire | |
8199 case 6: // cauldron | |
8200 case 11: // fruit plate | |
8201 case 13: // trash pile | |
8202 case 14: // dirt | |
8203 case 24: // keg | |
8204 case 184: // fire | |
8205 case 187: // fire | |
8206 case 190: // fire | |
8207 return true; | |
8208 } | |
8209 | |
8210 if (uDecorationDescID >= 206 && uDecorationDescID <= 209) // lighthouse fire | |
8211 return true; | |
8212 if (uDecorationDescID >= 210 && uDecorationDescID <= 221) // magic pedistal | |
8213 return true; | |
8214 | |
8215 return false; | |
0 | 8216 } |
8217 | |
8218 //----- (0044C362) -------------------------------------------------------- | |
8219 void Vec3_int_::Normalize_float() | |
8220 { | |
1025 | 8221 //Vec3_int_ *v1; // esi@1 |
0 | 8222 double v2; // st6@1 |
8223 float v3; // ST20_4@1 | |
8224 double v4; // st5@1 | |
8225 float v5; // ST18_4@1 | |
8226 double v6; // st4@1 | |
8227 float v7; // ST14_4@1 | |
8228 float v8; // ST24_4@1 | |
8229 float v9; // ST20_4@1 | |
8230 double v10; // ST0C_8@1 | |
8231 float v11; // ST18_4@1 | |
8232 double v12; // ST0C_8@1 | |
8233 float v13; // ST14_4@1 | |
8234 double v14; // ST0C_8@1 | |
8235 | |
1035 | 8236 assert(false); |
1025 | 8237 //v1 = this; |
0 | 8238 v2 = (double)this->x * 0.000015258789; |
8239 v3 = v2; | |
8240 v4 = (double)this->y * 0.000015258789; | |
8241 v5 = v4; | |
8242 v6 = (double)this->z * 0.000015258789; | |
8243 v7 = v6; | |
8244 v8 = 1.0 / sqrt(v6 * v6 + v4 * v4 + v2 * v2); | |
8245 v9 = v8 * v3 * 65536.0; | |
8246 v10 = v9 + 6.7553994e15; | |
1025 | 8247 this->x = LODWORD(v10); |
0 | 8248 v11 = v8 * v5 * 65536.0; |
8249 v12 = v11 + 6.7553994e15; | |
1025 | 8250 this->y = LODWORD(v12); |
0 | 8251 v13 = v8 * v7 * 65536.0; |
8252 v14 = v13 + 6.7553994e15; | |
1025 | 8253 this->z = LODWORD(v14); |
0 | 8254 } |
8255 | |
8256 //----- (00401000) -------------------------------------------------------- | |
8257 void __stdcall mm7__vector_constructor(void *a1, int objSize, int numObjs, int (__thiscall *constructor)(int)) | |
8258 { | |
8259 void *v4; // esi@2 | |
8260 int v5; // edi@2 | |
8261 | |
8262 if ( numObjs - 1 >= 0 ) | |
8263 { | |
8264 v4 = a1; | |
8265 v5 = numObjs; | |
8266 do | |
8267 { | |
8268 constructor((int)v4); | |
8269 v4 = (char *)v4 + objSize; | |
8270 --v5; | |
8271 } | |
8272 while ( v5 ); | |
8273 } | |
8274 } | |
8275 | |
8276 // 4F75D8: using guessed type int ai_arrays_size; | |
8277 | |
1295 | 8278 // 4F75D8: using guessed type int ai_arrays_size; |
0 | 8279 |
8280 //----- (0040261D) -------------------------------------------------------- | |
8281 int stru298::Add(__int16 uID, __int16 a3, __int16 x, __int16 y, __int16 z, char a7, char a8) | |
8282 { | |
8283 int result; // eax@1 | |
8284 | |
8285 result = this->count; | |
8286 if ( this->count < 100 ) | |
8287 { | |
8288 this->pIDs[result] = uID; | |
8289 this->pXs[this->count] = x; | |
8290 this->pYs[this->count] = y; | |
8291 this->pZs[this->count] = z; | |
8292 this->field_324[this->count] = a3; | |
8293 this->field_3EC[this->count] = a8; | |
8294 result = this->count; | |
8295 this->field_450[this->count++] = a7; | |
8296 } | |
8297 return result; | |
8298 } | |
8299 | |
8300 //----- (00402CAE) -------------------------------------------------------- | |
323 | 8301 int stru193_math::Cos(int angle) |
0 | 8302 { |
8303 int v2; // eax@1 | |
8304 | |
8305 //a2: (angle - uIntegerHalfPi) for sin(angle) | |
8306 // (angle) for cos(angle) | |
8307 | |
8308 v2 = uDoublePiMask & angle; | |
8309 | |
8310 if ( v2 > uIntegerPi ) | |
8311 v2 = uIntegerDoublePi - v2; | |
8312 if ( v2 >= uIntegerHalfPi ) | |
8313 return -pCosTable[uIntegerPi - v2]; | |
8314 else | |
8315 return pCosTable[v2]; | |
8316 } | |
8317 |