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