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