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