Mercurial > mm7
annotate mm7_3.cpp @ 2084:48b790721bdc
WalkSound
author | Ritor1 |
---|---|
date | Sat, 07 Dec 2013 14:25:50 +0600 |
parents | 87be06553c76 |
children | 3920278a2905 |
rev | line source |
---|---|
1165
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1160
diff
changeset
|
1 #ifdef _MSC_VER |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1160
diff
changeset
|
2 #define _CRT_SECURE_NO_WARNINGS |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1160
diff
changeset
|
3 #endif |
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1160
diff
changeset
|
4 |
1323 | 5 #include "Weather.h" |
1262 | 6 #include "Texture.h" |
7 #include "mm7_data.h" | |
1016 | 8 #include "Sprites.h" |
9 #include "BSPModel.h" | |
10 #include "LightmapBuilder.h" | |
11 #include "DecalBuilder.h" | |
12 #include "ParticleEngine.h" | |
13 #include "Mouse.h" | |
14 #include "Keyboard.h" | |
15 #include "stru6.h" | |
1263 | 16 #include "FactionTable.h" |
0 | 17 #include "MapInfo.h" |
18 #include "Game.h" | |
19 #include "GUIWindow.h" | |
20 #include "GUIFont.h" | |
21 #include "GUIProgressBar.h" | |
22 #include "Party.h" | |
23 #include "AudioPlayer.h" | |
24 #include "Outdoor.h" | |
1277 | 25 #include "Outdoor_stuff.h" |
0 | 26 #include "Overlays.h" |
27 #include "LOD.h" | |
28 #include "Actor.h" | |
29 #include "Events.h" | |
30 #include "Viewport.h" | |
2037
7a9477135943
Renamed Math.h -> OurMath.h (file resolution was sometimes ambiguous)
Nomad
parents:
2030
diff
changeset
|
31 #include "OurMath.h" |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
32 #include "SpriteObject.h" |
0 | 33 #include "ObjectList.h" |
34 #include "PaletteManager.h" | |
35 #include "DecorationList.h" | |
36 #include "stru123.h" | |
2044 | 37 #include "Timer.h" |
0 | 38 #include "IconFrameTable.h" |
39 #include "TurnEngine.h" | |
40 #include "Events2D.h" | |
41 #include "stru176.h" | |
42 #include "stru298.h" | |
189 | 43 #include "texts.h" |
0 | 44 #include "Log.h" |
1262 | 45 #include "Lights.h" |
1828
35c1e4ff6ba7
party_finds_gold to Party::PartyFindsGold, cleaned up, moved Level/Decoration.h reference out of Indoor.h
Grumpy7
parents:
1813
diff
changeset
|
46 #include "Level/Decoration.h" |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
47 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
48 #include "MM7.h" |
0 | 49 |
50 //----- (0046E44E) -------------------------------------------------------- | |
1458 | 51 int _46E44E_collide_against_faces_and_portals(unsigned int b1) |
0 | 52 { |
717 | 53 BLVSector *pSector; // edi@1 |
0 | 54 signed int v2; // ebx@1 |
717 | 55 BLVFace *pFace; // esi@2 |
56 __int16 pNextSector; // si@10 | |
57 int pArrayNum; // ecx@12 | |
0 | 58 unsigned __int8 v6; // sf@12 |
59 unsigned __int8 v7; // of@12 | |
60 int result; // eax@14 | |
717 | 61 //BLVSector *v9; // ebx@15 |
0 | 62 int v10; // ecx@15 |
717 | 63 int pFloor; // eax@16 |
64 //BLVFace *v12; // ebp@16 | |
0 | 65 int v13; // eax@24 |
66 int v14; // esi@24 | |
67 int v15; // eax@24 | |
68 int v16; // edx@25 | |
69 int v17; // eax@29 | |
70 unsigned int v18; // eax@33 | |
71 int v19; // eax@35 | |
72 int v20; // edx@35 | |
73 int v21; // eax@35 | |
74 int v22; // ecx@36 | |
75 int v23; // eax@40 | |
76 unsigned int v24; // eax@44 | |
77 int a3; // [sp+10h] [bp-48h]@28 | |
78 int v26; // [sp+14h] [bp-44h]@15 | |
79 int i; // [sp+18h] [bp-40h]@1 | |
80 int a10; // [sp+1Ch] [bp-3Ch]@1 | |
81 int v29; // [sp+20h] [bp-38h]@14 | |
82 int v30; // [sp+24h] [bp-34h]@35 | |
83 int v31; // [sp+28h] [bp-30h]@24 | |
84 int v32; // [sp+2Ch] [bp-2Ch]@15 | |
717 | 85 int pSectorsArray[10]; // [sp+30h] [bp-28h]@1 |
86 | |
87 pSector = &pIndoor->pSectors[stru_721530.uSectorID]; | |
0 | 88 v2 = 0; |
89 a10 = b1; | |
717 | 90 pSectorsArray[0] = stru_721530.uSectorID; |
91 for ( i = 1; v2 < pSector->uNumPortals; ++v2 ) | |
92 { | |
93 pFace = &pIndoor->pFaces[pSector->pPortals[v2]]; | |
94 if ( stru_721530.sMaxX <= pFace->pBounding.x2 | |
95 && stru_721530.sMinX >= pFace->pBounding.x1 | |
96 && stru_721530.sMaxY <= pFace->pBounding.y2 | |
97 && stru_721530.sMinY >= pFace->pBounding.y1 | |
98 && stru_721530.sMaxZ <= pFace->pBounding.z2 | |
99 && stru_721530.sMinZ >= pFace->pBounding.z1 | |
100 && abs((pFace->pFacePlane_old.dist | |
101 + stru_721530.normal.x * pFace->pFacePlane_old.vNormal.x | |
102 + stru_721530.normal.y * pFace->pFacePlane_old.vNormal.y | |
103 + stru_721530.normal.z * pFace->pFacePlane_old.vNormal.z) >> 16) <= stru_721530.field_6C + 16 ) | |
104 { | |
105 pNextSector = pFace->uSectorID == stru_721530.uSectorID ? pFace->uBackSectorID : pFace->uSectorID;//FrontSectorID | |
106 pArrayNum = i++; | |
107 v7 = i < 10; | |
0 | 108 v6 = i - 10 < 0; |
717 | 109 pSectorsArray[pArrayNum] = pNextSector; |
0 | 110 if ( !(v6 ^ v7) ) |
111 break; | |
112 } | |
113 } | |
114 result = 0; | |
115 v29 = 0; | |
116 if ( i > 0 ) | |
117 { | |
118 while ( 1 ) | |
119 { | |
717 | 120 pSector = &pIndoor->pSectors[pSectorsArray[result]]; |
0 | 121 v10 = 0; |
717 | 122 v32 = pSector->uNumFloors + pSector->uNumWalls + pSector->uNumCeilings; |
0 | 123 v26 = 0; |
124 if ( v32 > 0 ) | |
125 break; | |
126 LABEL_46: | |
127 result = v29++ + 1; | |
128 if ( v29 >= i ) | |
129 return result; | |
130 } | |
131 while ( 1 ) | |
132 { | |
717 | 133 pFloor = pSector->pFloors[v10]; |
134 pFace = &pIndoor->pFaces[pFloor]; | |
135 if ( pFace->Portal() | |
136 || stru_721530.sMaxX > pFace->pBounding.x2 | |
137 || stru_721530.sMinX < pFace->pBounding.x1 | |
138 || stru_721530.sMaxY > pFace->pBounding.y2 | |
139 || stru_721530.sMinY < pFace->pBounding.y1 | |
140 || stru_721530.sMaxZ > pFace->pBounding.z2 | |
141 || stru_721530.sMinZ < pFace->pBounding.z1 | |
142 || pFloor == stru_721530.field_84 ) | |
0 | 143 goto LABEL_45; |
717 | 144 v13 = pFace->pFacePlane_old.vNormal.y; |
145 v14 = pFace->pFacePlane_old.dist; | |
0 | 146 v31 = v13; |
717 | 147 v15 = (stru_721530.normal.x * pFace->pFacePlane_old.vNormal.x + v14 + stru_721530.normal.y * v13 |
148 + stru_721530.normal.z * pFace->pFacePlane_old.vNormal.z) >> 16; | |
0 | 149 if ( v15 > 0 ) |
150 { | |
717 | 151 v16 = (stru_721530.normal2.y * v31 + pFace->pFacePlane_old.dist + stru_721530.normal2.z * pFace->pFacePlane_old.vNormal.z |
152 + stru_721530.normal2.x * pFace->pFacePlane_old.vNormal.x) >> 16; | |
0 | 153 if ( v15 <= stru_721530.prolly_normal_d || v16 <= stru_721530.prolly_normal_d ) |
154 { | |
155 if ( v16 <= v15 ) | |
156 { | |
157 a3 = stru_721530.field_6C; | |
717 | 158 if ( sub_47531C(stru_721530.prolly_normal_d, &a3, stru_721530.normal.x, stru_721530.normal.y, stru_721530.normal.z, |
1546 | 159 stru_721530.direction.x, stru_721530.direction.y, stru_721530.direction.z, pFace, a10) ) |
0 | 160 { |
161 v17 = a3; | |
162 } | |
163 else | |
164 { | |
165 a3 = stru_721530.field_6C + stru_721530.prolly_normal_d; | |
1546 | 166 if ( !sub_475D85(&stru_721530.normal, &stru_721530.direction, &a3, pFace) ) |
0 | 167 goto LABEL_34; |
168 v17 = a3 - stru_721530.prolly_normal_d; | |
169 a3 -= stru_721530.prolly_normal_d; | |
170 } | |
171 if ( v17 < stru_721530.field_7C ) | |
172 { | |
173 stru_721530.field_7C = v17; | |
717 | 174 v18 = 8 * pSector->pFloors[v26]; |
0 | 175 LOBYTE(v18) = v18 | 6; |
176 stru_721530.uFaceID = v18; | |
177 } | |
178 } | |
179 } | |
180 } | |
181 LABEL_34: | |
182 if ( !(stru_721530.field_0 & 1) | |
717 | 183 || (v19 = pFace->pFacePlane_old.vNormal.x, |
184 v20 = pFace->pFacePlane_old.vNormal.y, | |
0 | 185 v30 = v19, |
1546 | 186 v21 = (stru_721530.position.x * v19 + pFace->pFacePlane_old.dist + stru_721530.position.y * v20 |
187 + stru_721530.position.z * pFace->pFacePlane_old.vNormal.z) >> 16, | |
0 | 188 v21 <= 0) |
717 | 189 || (v22 = (stru_721530.field_4C * v30 + pFace->pFacePlane_old.dist + stru_721530.field_50 * v20 |
190 + stru_721530.field_54 * pFace->pFacePlane_old.vNormal.z) >> 16, | |
0 | 191 v21 > stru_721530.prolly_normal_d) |
192 && v22 > stru_721530.prolly_normal_d | |
193 || v22 > v21 ) | |
194 goto LABEL_45; | |
195 a3 = stru_721530.field_6C; | |
1546 | 196 if ( sub_47531C(stru_721530.field_8_radius, &a3, stru_721530.position.x, stru_721530.position.y, stru_721530.position.z, |
197 stru_721530.direction.x, stru_721530.direction.y, stru_721530.direction.z, pFace, a10) ) | |
0 | 198 { |
199 v23 = a3; | |
200 goto LABEL_43; | |
201 } | |
1546 | 202 a3 = stru_721530.field_6C + stru_721530.field_8_radius; |
203 if ( sub_475D85(&stru_721530.position, &stru_721530.direction, &a3, pFace) ) | |
0 | 204 { |
205 v23 = a3 - stru_721530.prolly_normal_d; | |
206 a3 -= stru_721530.prolly_normal_d; | |
207 LABEL_43: | |
208 if ( v23 < stru_721530.field_7C ) | |
209 { | |
210 stru_721530.field_7C = v23; | |
717 | 211 v24 = 8 * pSector->pFloors[v26]; |
0 | 212 LOBYTE(v24) = v24 | 6; |
213 stru_721530.uFaceID = v24; | |
214 } | |
215 } | |
216 LABEL_45: | |
217 v10 = v26++ + 1; | |
218 if ( v26 >= v32 ) | |
219 goto LABEL_46; | |
220 } | |
221 } | |
222 return result; | |
223 } | |
224 // 46E44E: using guessed type int var_28[10]; | |
225 | |
226 //----- (0046E889) -------------------------------------------------------- | |
227 int __fastcall _46E889_collide_against_bmodels(unsigned int ecx0) | |
228 { | |
229 int result; // eax@1 | |
230 BSPModel *v2; // ecx@3 | |
231 int v3; // ebx@9 | |
232 ODMFace *v4; // eax@11 | |
233 int v5; // edi@17 | |
234 int v6; // esi@17 | |
235 unsigned int v7; // ecx@17 | |
236 int v8; // eax@19 | |
237 int v9; // ecx@20 | |
238 int v10; // eax@24 | |
239 int v11; // ST18_4@25 | |
240 int v12; // ST1C_4@25 | |
241 int v13; // ST0C_4@25 | |
242 unsigned int v14; // eax@28 | |
243 int v15; // eax@30 | |
244 int v16; // ecx@31 | |
245 unsigned int v17; // eax@36 | |
246 int v18; // ST18_4@41 | |
247 int v19; // ST1C_4@41 | |
248 int v20; // ST0C_4@41 | |
249 int v21; // eax@42 | |
250 unsigned int v22; // eax@43 | |
251 //BLVFace f; // [sp+Ch] [bp-7Ch]@1 | |
252 int v24; // [sp+6Ch] [bp-1Ch]@9 | |
253 int a11; // [sp+70h] [bp-18h]@1 | |
254 unsigned int v26; // [sp+74h] [bp-14h]@2 | |
255 unsigned int v27; // [sp+78h] [bp-10h]@10 | |
256 BSPModel *v28; // [sp+7Ch] [bp-Ch]@3 | |
257 int a10; // [sp+80h] [bp-8h]@1 | |
258 int a2; // [sp+84h] [bp-4h]@23 | |
259 | |
260 a11 = ecx0; | |
261 | |
262 BLVFace f; // [sp+Ch] [bp-7Ch]@1 | |
263 //BLVFace::BLVFace(&f); | |
264 | |
265 result = 0; | |
266 a10 = 0; | |
267 if ( (signed int)pOutdoor->uNumBModels > 0 ) | |
268 { | |
269 v26 = 0; | |
270 while ( 1 ) | |
271 { | |
272 v2 = &pOutdoor->pBModels[v26 / 0xBC]; | |
273 v28 = &pOutdoor->pBModels[v26 / 0xBC]; | |
274 if ( stru_721530.sMaxX <= pOutdoor->pBModels[v26 / 0xBC].sMaxX ) | |
275 { | |
276 if ( stru_721530.sMinX >= v2->sMinX ) | |
277 { | |
278 if ( stru_721530.sMaxY <= v2->sMaxY ) | |
279 { | |
280 if ( stru_721530.sMinY >= v2->sMinY ) | |
281 { | |
282 if ( stru_721530.sMaxZ <= v2->sMaxZ ) | |
283 { | |
284 if ( stru_721530.sMinZ >= v2->sMinZ ) | |
285 { | |
286 v3 = 0; | |
287 v24 = v2->uNumFaces; | |
288 if ( v24 > 0 ) | |
289 break; | |
290 } | |
291 } | |
292 } | |
293 } | |
294 } | |
295 } | |
296 LABEL_39: | |
297 ++a10; | |
298 v26 += 188; | |
299 result = a10; | |
300 if ( a10 >= (signed int)pOutdoor->uNumBModels ) | |
301 return result; | |
302 } | |
303 v27 = 0; | |
304 while ( 1 ) | |
305 { | |
306 v4 = &v2->pFaces[v27 / 0x134]; | |
307 if ( stru_721530.sMaxX > v4->pBoundingBox.x2 | |
308 || stru_721530.sMinX < v4->pBoundingBox.x1 | |
309 || stru_721530.sMaxY > v4->pBoundingBox.y2 | |
310 || stru_721530.sMinY < v4->pBoundingBox.y1 | |
311 || stru_721530.sMaxZ > v4->pBoundingBox.z2 | |
312 || stru_721530.sMinZ < v4->pBoundingBox.z1 ) | |
313 goto LABEL_38; | |
314 f.pFacePlane_old.vNormal.x = v4->pFacePlane.vNormal.x; | |
315 f.pFacePlane_old.vNormal.y = v4->pFacePlane.vNormal.y; | |
316 v5 = v4->pFacePlane.vNormal.z; | |
317 f.pFacePlane_old.vNormal.z = v4->pFacePlane.vNormal.z; | |
318 v6 = v4->pFacePlane.dist; | |
319 f.pFacePlane_old.dist = v4->pFacePlane.dist; | |
320 v7 = v4->uAttributes; | |
321 f.uAttributes = v7; | |
322 f.pBounding.x1 = v4->pBoundingBox.x1; | |
323 f.pBounding.y1 = v4->pBoundingBox.y1; | |
324 f.pBounding.z1 = v4->pBoundingBox.z1; | |
325 f.pBounding.x2 = v4->pBoundingBox.x2; | |
326 f.pBounding.y2 = v4->pBoundingBox.y2; | |
327 f.pBounding.z2 = v4->pBoundingBox.z2; | |
328 f.zCalc1 = v4->zCalc1; | |
329 f.zCalc2 = v4->zCalc2; | |
330 f.zCalc3 = v4->zCalc3; | |
331 f.pXInterceptDisplacements = v4->pXInterceptDisplacements; | |
332 f.pYInterceptDisplacements = v4->pYInterceptDisplacements; | |
333 f.pZInterceptDisplacements = v4->pZInterceptDisplacements; | |
334 f.uPolygonType = (PolygonType)v4->uPolygonType; | |
335 f.uNumVertices = v4->uNumVertices; | |
336 f.uBitmapID = v4->uTextureID; | |
337 f.pVertexIDs = v4->pVertexIDs; | |
338 if ( !(v7 & 0x20000000) ) | |
339 { | |
340 if ( !(v7 & 1) ) | |
341 break; | |
342 } | |
343 LABEL_37: | |
344 v2 = v28; | |
345 LABEL_38: | |
346 v27 += 308; | |
347 ++v3; | |
348 if ( v3 >= v24 ) | |
349 goto LABEL_39; | |
350 } | |
351 v8 = (v5 * stru_721530.normal.z | |
352 + v6 | |
353 + f.pFacePlane_old.vNormal.y * stru_721530.normal.y | |
354 + f.pFacePlane_old.vNormal.x * stru_721530.normal.x) >> 16; | |
355 if ( v8 > 0 ) | |
356 { | |
357 v9 = (v5 * stru_721530.normal2.z | |
358 + v6 | |
359 + f.pFacePlane_old.vNormal.y * stru_721530.normal2.y | |
360 + f.pFacePlane_old.vNormal.x * stru_721530.normal2.x) >> 16; | |
361 if ( v8 <= stru_721530.prolly_normal_d || v9 <= stru_721530.prolly_normal_d ) | |
362 { | |
363 if ( v9 <= v8 ) | |
364 { | |
365 a2 = stru_721530.field_6C; | |
366 if ( sub_4754BF( | |
367 stru_721530.prolly_normal_d, | |
368 &a2, | |
369 stru_721530.normal.x, | |
370 stru_721530.normal.y, | |
371 stru_721530.normal.z, | |
1546 | 372 stru_721530.direction.x, |
373 stru_721530.direction.y, | |
374 stru_721530.direction.z, | |
0 | 375 &f, |
376 a10, | |
377 a11) ) | |
378 { | |
379 v10 = a2; | |
380 } | |
381 else | |
382 { | |
1546 | 383 v11 = stru_721530.direction.y; |
384 v12 = stru_721530.direction.z; | |
0 | 385 v13 = stru_721530.normal.y; |
386 a2 = stru_721530.prolly_normal_d + stru_721530.field_6C; | |
387 if ( !sub_475F30( | |
388 &a2, | |
389 &f, | |
390 stru_721530.normal.x, | |
391 v13, | |
392 stru_721530.normal.z, | |
1546 | 393 stru_721530.direction.x, |
0 | 394 v11, |
395 v12, | |
396 a10) ) | |
397 goto LABEL_29; | |
398 v10 = a2 - stru_721530.prolly_normal_d; | |
399 a2 -= stru_721530.prolly_normal_d; | |
400 } | |
401 if ( v10 < stru_721530.field_7C ) | |
402 { | |
403 stru_721530.field_7C = v10; | |
404 v14 = 8 * (v3 | (a10 << 6)); | |
405 LOBYTE(v14) = v14 | 6; | |
406 stru_721530.uFaceID = v14; | |
407 } | |
408 } | |
409 } | |
410 } | |
411 LABEL_29: | |
412 if ( stru_721530.field_0 & 1 ) | |
413 { | |
1546 | 414 v15 = (f.pFacePlane_old.vNormal.z * stru_721530.position.z |
0 | 415 + f.pFacePlane_old.dist |
1546 | 416 + f.pFacePlane_old.vNormal.y * stru_721530.position.y |
417 + f.pFacePlane_old.vNormal.x * stru_721530.position.x) >> 16; | |
0 | 418 if ( v15 > 0 ) |
419 { | |
420 v16 = (f.pFacePlane_old.vNormal.z * stru_721530.field_54 | |
421 + f.pFacePlane_old.dist | |
422 + f.pFacePlane_old.vNormal.y * stru_721530.field_50 | |
423 + f.pFacePlane_old.vNormal.x * stru_721530.field_4C) >> 16; | |
424 if ( v15 <= stru_721530.prolly_normal_d || v16 <= stru_721530.prolly_normal_d ) | |
425 { | |
426 if ( v16 <= v15 ) | |
427 { | |
428 a2 = stru_721530.field_6C; | |
1546 | 429 if ( sub_4754BF(stru_721530.field_8_radius, |
0 | 430 &a2, |
1546 | 431 stru_721530.position.x, |
432 stru_721530.position.y, | |
433 stru_721530.position.z, | |
434 stru_721530.direction.x, | |
435 stru_721530.direction.y, | |
436 stru_721530.direction.z, | |
0 | 437 &f, |
438 a10, | |
439 a11) ) | |
440 { | |
441 if ( a2 < stru_721530.field_7C ) | |
442 { | |
443 stru_721530.field_7C = a2; | |
444 v17 = 8 * (v3 | (a10 << 6)); | |
445 LOBYTE(v17) = v17 | 6; | |
446 stru_721530.uFaceID = v17; | |
447 } | |
448 } | |
449 else | |
450 { | |
1546 | 451 v18 = stru_721530.direction.y; |
452 v19 = stru_721530.direction.z; | |
453 v20 = stru_721530.position.y; | |
454 a2 = stru_721530.field_6C + stru_721530.field_8_radius; | |
455 if ( sub_475F30(&a2, | |
0 | 456 &f, |
1546 | 457 stru_721530.position.x, |
0 | 458 v20, |
1546 | 459 stru_721530.position.z, |
460 stru_721530.direction.x, | |
0 | 461 v18, |
462 v19, | |
463 a10) ) | |
464 { | |
465 v2 = v28; | |
466 v21 = a2 - stru_721530.prolly_normal_d; | |
467 a2 -= stru_721530.prolly_normal_d; | |
468 if ( a2 < stru_721530.field_7C ) | |
469 { | |
470 stru_721530.field_7C = v21; | |
471 v22 = 8 * (v3 | (a10 << 6)); | |
472 LOBYTE(v22) = v22 | 6; | |
473 stru_721530.uFaceID = v22; | |
474 } | |
475 goto LABEL_38; | |
476 } | |
477 } | |
478 } | |
479 } | |
480 } | |
481 } | |
482 goto LABEL_37; | |
483 } | |
484 return result; | |
485 } | |
486 | |
487 //----- (0046ED1B) -------------------------------------------------------- | |
783 | 488 int collide_against_floor(int x, int y, int z, unsigned int *pSectorID, unsigned int *pFaceID) |
0 | 489 { |
490 uint uFaceID = -1; | |
723 | 491 int floor_level = BLV_GetFloorLevel(x, y, z, *pSectorID, &uFaceID); |
0 | 492 |
493 if (floor_level != -30000 && floor_level <= z + 50) | |
494 { | |
495 *pFaceID = uFaceID; | |
496 return floor_level; | |
497 } | |
498 | |
499 uint uSectorID = pIndoor->GetSector(x, y, z); | |
500 *pSectorID = uSectorID; | |
501 | |
723 | 502 floor_level = BLV_GetFloorLevel(x, y, z, uSectorID, &uFaceID); |
0 | 503 if (uSectorID && floor_level != -30000) |
504 *pFaceID = uFaceID; | |
505 else return -30000; | |
506 return floor_level; | |
507 } | |
508 | |
509 //----- (0046ED8A) -------------------------------------------------------- | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
510 void __fastcall _46ED8A_collide_against_sprite_objects(unsigned int _this) |
0 | 511 { |
512 int v1; // ebx@2 | |
513 ObjectDesc *v2; // edx@4 | |
514 int v3; // esi@5 | |
515 int v4; // ecx@5 | |
516 int v5; // eax@7 | |
517 int v6; // edi@9 | |
518 int v7; // edx@9 | |
519 int v8; // edi@11 | |
520 int v9; // ebx@11 | |
521 int v10; // ecx@12 | |
522 int v11; // esi@13 | |
523 signed int v12; // [sp+0h] [bp-14h]@1 | |
524 int v13; // [sp+4h] [bp-10h]@9 | |
525 char *v14; // [sp+8h] [bp-Ch]@2 | |
526 unsigned int v15; // [sp+10h] [bp-4h]@1 | |
527 | |
528 v15 = 0; | |
529 v12 = _this; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
530 if ( (signed int)uNumSpriteObjects > 0 ) |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
531 { |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
532 v1 = (int)&pSpriteObjects[0].uObjectDescID; |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
533 v14 = (char *)&pSpriteObjects[0].uObjectDescID; |
0 | 534 do |
535 { | |
536 if ( *(short *)v1 ) | |
537 { | |
538 v2 = &pObjectList->pObjects[*(short *)v1]; | |
539 if ( !(v2->uFlags & 2) ) | |
540 { | |
541 v3 = v2->uRadius; | |
542 v4 = *(int *)(v1 + 2); | |
543 if ( stru_721530.sMaxX <= v4 + v3 ) | |
544 { | |
545 if ( stru_721530.sMinX >= v4 - v3 ) | |
546 { | |
547 v5 = *(int *)(v1 + 6); | |
548 if ( stru_721530.sMaxY <= v5 + v3 ) | |
549 { | |
550 if ( stru_721530.sMinY >= v5 - v3 ) | |
551 { | |
552 v6 = v2->uHeight; | |
553 v7 = *(int *)(v1 + 10); | |
554 v13 = v6; | |
555 if ( stru_721530.sMaxZ <= v7 + v6 ) | |
556 { | |
557 if ( stru_721530.sMinZ >= v7 ) | |
558 { | |
559 v8 = v4 - stru_721530.normal.x; | |
560 v9 = v5 - stru_721530.normal.y; | |
1546 | 561 if ( abs(((v4 - stru_721530.normal.x) * stru_721530.direction.y |
562 - (v5 - stru_721530.normal.y) * stru_721530.direction.x) >> 16) <= v3 | |
0 | 563 + stru_721530.prolly_normal_d ) |
564 { | |
1546 | 565 v10 = (v8 * stru_721530.direction.x + v9 * stru_721530.direction.y) >> 16; |
0 | 566 if ( v10 > 0 ) |
567 { | |
568 v11 = stru_721530.normal.z | |
1546 | 569 + ((unsigned __int64)(stru_721530.direction.z * (signed __int64)v10) >> 16); |
0 | 570 if ( v11 >= *(int *)(v14 + 10) - stru_721530.prolly_normal_d ) |
571 { | |
572 if ( v11 <= v13 + stru_721530.prolly_normal_d + *(int *)(v14 + 10) ) | |
573 { | |
574 if ( v10 < stru_721530.field_7C ) | |
575 sub_46DEF2(v12, v15); | |
576 } | |
577 } | |
578 } | |
579 } | |
580 } | |
581 } | |
582 } | |
583 } | |
584 } | |
585 } | |
586 } | |
587 } | |
588 ++v15; | |
589 v1 = (int)(v14 + 112); | |
590 v14 += 112; | |
591 } | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
592 while ( (signed int)v15 < (signed int)uNumSpriteObjects ); |
0 | 593 } |
594 } | |
595 | |
596 //----- (0046EF01) -------------------------------------------------------- | |
1546 | 597 int _46EF01_collision_chech_player(int a1) |
0 | 598 { |
599 int v1; // edx@1 | |
600 int result; // eax@1 | |
601 int v3; // ebx@7 | |
602 int v4; // esi@7 | |
603 int v5; // edi@8 | |
604 int v6; // ecx@9 | |
605 int v7; // edi@12 | |
606 int v8; // [sp+Ch] [bp-10h]@1 | |
607 unsigned int v9; // [sp+10h] [bp-Ch]@1 | |
608 int v10; // [sp+14h] [bp-8h]@7 | |
609 int v11; // [sp+18h] [bp-4h]@7 | |
610 | |
611 v8 = a1; | |
1546 | 612 v1 = 2 * pParty->field_14_radius; |
0 | 613 result = pParty->vPosition.x; |
614 v9 = pParty->uPartyHeight; | |
1546 | 615 if ( stru_721530.sMaxX <= pParty->vPosition.x + 2 * pParty->field_14_radius ) |
0 | 616 { |
617 if ( stru_721530.sMinX >= pParty->vPosition.x - v1 ) | |
618 { | |
619 if ( stru_721530.sMaxY <= pParty->vPosition.y + v1 ) | |
620 { | |
621 if ( stru_721530.sMinY >= pParty->vPosition.y - v1 ) | |
622 { | |
623 if ( stru_721530.sMaxZ <= (signed int)(pParty->vPosition.z + pParty->uPartyHeight) ) | |
624 { | |
625 if ( stru_721530.sMinZ >= pParty->vPosition.z ) | |
626 { | |
627 v3 = stru_721530.prolly_normal_d + v1; | |
628 v11 = pParty->vPosition.x - stru_721530.normal.x; | |
1546 | 629 v4 = ((pParty->vPosition.x - stru_721530.normal.x) * stru_721530.direction.y |
630 - (pParty->vPosition.y - stru_721530.normal.y) * stru_721530.direction.x) >> 16; | |
0 | 631 v10 = pParty->vPosition.y - stru_721530.normal.y; |
1546 | 632 result = abs(((pParty->vPosition.x - stru_721530.normal.x) * stru_721530.direction.y |
633 - (pParty->vPosition.y - stru_721530.normal.y) * stru_721530.direction.x) >> 16); | |
0 | 634 if ( result <= v3 ) |
635 { | |
1546 | 636 result = v10 * stru_721530.direction.y; |
637 v5 = (v10 * stru_721530.direction.y + v11 * stru_721530.direction.x) >> 16; | |
0 | 638 if ( v5 > 0 ) |
639 { | |
1546 | 640 v6 = ((unsigned __int64)(stru_721530.direction.z * (signed __int64)v5) >> 16) + stru_721530.normal.z; |
0 | 641 result = pParty->vPosition.z; |
642 if ( v6 >= pParty->vPosition.z ) | |
643 { | |
644 result = v9 + pParty->vPosition.z; | |
645 if ( v6 <= (signed int)(v9 + pParty->vPosition.z) || v8 ) | |
646 { | |
295 | 647 result = integer_sqrt(v3 * v3 - v4 * v4); |
0 | 648 v7 = v5 - result; |
649 if ( v7 < 0 ) | |
650 v7 = 0; | |
651 if ( v7 < stru_721530.field_7C ) | |
652 { | |
653 stru_721530.field_7C = v7; | |
654 stru_721530.uFaceID = 4; | |
655 } | |
656 } | |
657 } | |
658 } | |
659 } | |
660 } | |
661 } | |
662 } | |
663 } | |
664 } | |
665 } | |
666 return result; | |
667 } | |
668 | |
669 //----- (0046F04E) -------------------------------------------------------- | |
1459 | 670 int _46F04E_collide_against_portals() |
0 | 671 { |
672 BLVSector *v0; // ecx@1 | |
673 unsigned int v1; // eax@1 | |
674 int v2; // eax@2 | |
675 BLVFace *v3; // eax@3 | |
676 int v4; // ecx@9 | |
677 int v5; // edx@9 | |
678 signed int result; // eax@21 | |
679 BLVFace *v7; // eax@22 | |
680 signed int v8; // [sp+0h] [bp-14h]@1 | |
681 BLVSector *v9; // [sp+4h] [bp-10h]@1 | |
682 unsigned int v10; // [sp+8h] [bp-Ch]@1 | |
683 int a3; // [sp+Ch] [bp-8h]@13 | |
684 int v12; // [sp+10h] [bp-4h]@15 | |
685 | |
686 v8 = 0; | |
687 v0 = &pIndoor->pSectors[stru_721530.uSectorID]; | |
688 v1 = 0xFFFFFFu; | |
689 v10 = 0xFFFFFFu; | |
690 v9 = v0; | |
691 if ( v0->uNumPortals > 0 ) | |
692 { | |
693 do | |
694 { | |
695 v2 = v0->pPortals[v8]; | |
696 if ( v2 != stru_721530.field_80 ) | |
697 { | |
698 v3 = &pIndoor->pFaces[v2]; | |
699 if ( stru_721530.sMaxX <= v3->pBounding.x2 ) | |
700 { | |
701 if ( stru_721530.sMinX >= v3->pBounding.x1 | |
702 && stru_721530.sMaxY <= v3->pBounding.y2 | |
703 && stru_721530.sMinY >= v3->pBounding.y1 | |
704 && stru_721530.sMaxZ <= v3->pBounding.z2 | |
705 && stru_721530.sMinZ >= v3->pBounding.z1 ) | |
706 { | |
1546 | 707 v4 = (stru_721530.normal.x * v3->pFacePlane_old.vNormal.x + v3->pFacePlane_old.dist |
0 | 708 + stru_721530.normal.y * v3->pFacePlane_old.vNormal.y |
709 + stru_721530.normal.z * v3->pFacePlane_old.vNormal.z) >> 16; | |
1546 | 710 v5 = (stru_721530.normal2.z * v3->pFacePlane_old.vNormal.z + v3->pFacePlane_old.dist |
0 | 711 + stru_721530.normal2.x * v3->pFacePlane_old.vNormal.x |
712 + stru_721530.normal2.y * v3->pFacePlane_old.vNormal.y) >> 16; | |
713 if ( (v4 < stru_721530.prolly_normal_d || v5 < stru_721530.prolly_normal_d) | |
714 && (v4 > -stru_721530.prolly_normal_d || v5 > -stru_721530.prolly_normal_d) | |
1546 | 715 && (a3 = stru_721530.field_6C, sub_475D85(&stru_721530.normal, &stru_721530.direction, &a3, v3)) |
0 | 716 && a3 < (signed int)v10 ) |
717 { | |
718 v0 = v9; | |
719 v10 = a3; | |
720 v12 = v9->pPortals[v8]; | |
721 } | |
722 else | |
723 { | |
724 v0 = v9; | |
725 } | |
726 } | |
727 } | |
728 } | |
729 ++v8; | |
730 } | |
731 while ( v8 < v0->uNumPortals ); | |
732 v1 = v10; | |
733 } | |
734 if ( stru_721530.field_7C >= (signed int)v1 && (signed int)v1 <= stru_721530.field_6C ) | |
735 { | |
736 stru_721530.field_80 = v12; | |
737 v7 = &pIndoor->pFaces[v12]; | |
738 if ( v7->uSectorID == stru_721530.uSectorID ) | |
739 stru_721530.uSectorID = v7->uBackSectorID; | |
740 else | |
741 stru_721530.uSectorID = v7->uSectorID; | |
742 stru_721530.field_7C = 268435455; | |
743 result = 0; | |
744 } | |
745 else | |
746 { | |
747 result = 1; | |
748 } | |
749 return result; | |
750 } | |
751 | |
752 //----- (0047050A) -------------------------------------------------------- | |
1546 | 753 int stru141_actor_collision_object::_47050A(int dt) |
0 | 754 { |
1799 | 755 //stru141_actor_collision_object *v2; // esi@1 |
1546 | 756 //signed int v3; // eax@1 |
757 //int v4; // ecx@1 | |
758 //int v5; // edx@1 | |
759 //int v6; // edx@1 | |
0 | 760 int v7; // eax@1 |
1799 | 761 //int v8; // eax@3 |
0 | 762 signed int result; // eax@4 |
1799 | 763 //int v10; // eax@5 |
764 //int v11; // eax@5 | |
765 //int v12; // ebx@5 | |
766 //int v13; // edx@5 | |
767 //int v14; // edi@5 | |
768 //int v15; // ecx@5 | |
769 //int v16; // eax@5 | |
0 | 770 int v17; // eax@5 |
771 int v18; // eax@7 | |
1799 | 772 //int v19; // edx@9 |
773 //int v20; // edi@9 | |
0 | 774 int v21; // eax@9 |
775 int v22; // eax@11 | |
1799 | 776 //int v23; // edx@13 |
777 //int v24; // eax@13 | |
778 //int v25; // eax@14 | |
779 //int v26; // eax@16 | |
780 //int v27; // eax@17 | |
781 //int v28; // [sp+14h] [bp+8h]@5 | |
782 | |
783 //v2 = this; | |
1546 | 784 int speed = 1 | integer_sqrt(this->velocity.z * this->velocity.z + this->velocity.y * this->velocity.y + this->velocity.x * this->velocity.x); |
785 | |
1799 | 786 this->direction.x = 65536 / speed * this->velocity.x; |
787 this->direction.y = 65536 / speed * this->velocity.y; | |
788 this->direction.z = 65536 / speed * this->velocity.z; | |
789 | |
790 this->speed = speed; | |
791 this->inv_speed = 65536 / speed; | |
1546 | 792 |
793 if (dt) | |
794 v7 = dt; | |
795 else | |
0 | 796 v7 = pEventTimer->dt_in_some_format; |
1546 | 797 |
1799 | 798 //v8 = fixpoint_mul(v7, speed) - this->field_70; // speed * dt - something |
799 this->field_6C = fixpoint_mul(v7, speed) - this->field_70; | |
800 if ( this->field_6C > 0 ) | |
801 { | |
802 //v10 = fixpoint_mul(v8, this->direction.x) + this->normal.x; | |
803 this->field_4C = fixpoint_mul(this->field_6C, this->direction.x) + this->normal.x; | |
804 this->normal2.x = fixpoint_mul(this->field_6C, this->direction.x) + this->normal.x; | |
805 //v11 = fixpoint_mul(this->field_6C, this->direction.y) + this->normal.y; | |
806 this->field_50 = fixpoint_mul(this->field_6C, this->direction.y) + this->normal.y; | |
807 this->normal2.y = fixpoint_mul(this->field_6C, this->direction.y) + this->normal.y; | |
808 this->normal2.z = fixpoint_mul(this->field_6C, this->direction.z) + this->normal.z; | |
809 //v12 = this->position.z; | |
810 //v13 = this->normal.x; | |
811 //v14 = this->normal2.x; | |
812 //v15 = this->prolly_normal_d; | |
813 //v16 = this->position.z + fixpoint_mul(this->field_6C, this->direction.z); | |
814 //v28 = this->position.z + fixpoint_mul(this->field_6C, this->direction.z); | |
815 this->field_54 = this->position.z + fixpoint_mul(this->field_6C, this->direction.z); | |
816 v17 = this->normal.x; | |
817 if ( v17 >= this->normal2.x ) | |
818 v17 = this->normal2.x; | |
819 this->sMaxX = v17 - this->prolly_normal_d; | |
820 v18 = this->prolly_normal_d + this->normal.x; | |
821 if ( this->normal.x <= this->normal2.x ) | |
822 v18 = this->prolly_normal_d + this->normal2.x; | |
823 //v19 = this->normal.y; | |
824 //v20 = this->normal2.y; | |
825 this->sMinX = v18; | |
826 v21 = this->normal.y; | |
827 if ( v21 >= this->normal2.y ) | |
828 v21 = this->normal2.y; | |
829 this->sMaxY = v21 - this->prolly_normal_d; | |
830 v22 = this->prolly_normal_d + this->normal.y; | |
831 if ( this->normal.y <= this->normal2.y ) | |
832 v22 = this->normal2.y + this->prolly_normal_d; | |
833 //v23 = this->normal2.z; | |
834 this->sMinY = v22; | |
835 //v24 = this->normal.z; | |
836 if ( this->normal.z >= this->normal2.z ) | |
837 this->sMaxZ = this->normal2.z - this->prolly_normal_d; | |
0 | 838 else |
1799 | 839 this->sMaxZ = this->normal.z - this->prolly_normal_d; |
840 //this->sMaxZ = v25; | |
841 //v26 = this->field_8_radius; | |
842 if ( this->position.z <= this->position.z + fixpoint_mul(this->field_6C, this->direction.z) ) | |
843 this->sMinZ = (this->position.z + fixpoint_mul(this->field_6C, this->direction.z)) + this->field_8_radius; | |
0 | 844 else |
1799 | 845 this->sMinZ = this->position.z + this->field_8_radius; |
846 this->uFaceID = 0; | |
847 this->field_80 = -1; | |
848 this->field_88 = -1; | |
849 //this->sMinZ = v27; | |
850 this->field_7C = 0xFFFFFFu; | |
0 | 851 result = 0; |
852 } | |
853 else | |
854 { | |
855 result = 1; | |
856 } | |
857 return result; | |
858 } | |
859 | |
860 //----- (004706C6) -------------------------------------------------------- | |
1545 | 861 void UpdateActors_ODM() |
0 | 862 { |
863 Actor *v0; // esi@2 | |
845 | 864 AIState uAIState; // ax@2 |
846 | 865 //unsigned int v2; // ecx@6 |
0 | 866 int v3; // ebx@6 |
845 | 867 //int v4; // eax@8 |
0 | 868 int v5; // eax@10 |
869 int v6; // ecx@10 | |
846 | 870 //signed int v7; // ebx@10 |
0 | 871 signed int v8; // ebx@17 |
845 | 872 //unsigned __int8 v9; // zf@17 |
0 | 873 unsigned __int8 v10; // sf@17 |
874 unsigned __int16 v11; // ax@21 | |
1545 | 875 //int v12; // eax@29 |
876 //unsigned __int64 v13; // qax@29 | |
877 //int v14; // eax@30 | |
878 //unsigned __int64 v15; // qax@30 | |
0 | 879 int v16; // eax@33 |
846 | 880 //int v17; // edi@34 |
1545 | 881 //int v18; // edx@42 |
882 //int v19; // ecx@42 | |
0 | 883 __int16 v20; // ax@42 |
1545 | 884 //int v21; // ebx@42 |
885 //int v22; // edi@42 | |
886 //int v23; // ecx@42 | |
887 //__int16 v24; // ax@42 | |
0 | 888 int v25; // eax@45 |
889 signed int v26; // ecx@50 | |
1546 | 890 //int v27; // eax@52 |
0 | 891 int v28; // eax@54 |
892 signed int v29; // ebx@57 | |
893 signed int v30; // eax@57 | |
894 int v31; // edi@57 | |
895 signed int i; // ebx@57 | |
896 unsigned int v33; // ecx@58 | |
845 | 897 //int v34; // ebx@64 |
0 | 898 int v35; // edi@64 |
899 int v36; // eax@64 | |
848 | 900 //unsigned __int16 v37; // cx@66 |
0 | 901 signed int v38; // edx@71 |
848 | 902 unsigned int v39; // edi@71 |
0 | 903 BSPModel *v40; // eax@75 |
904 ODMFace *v41; // edi@75 | |
905 int v42; // ebx@76 | |
906 int v43; // ecx@77 | |
907 int v44; // edx@77 | |
908 __int16 v45; // dx@82 | |
909 int v46; // ecx@82 | |
910 signed int v47; // ebx@85 | |
911 int v48; // edi@85 | |
912 int v49; // edi@85 | |
1545 | 913 //int v50; // eax@85 |
914 //unsigned __int64 v51; // qax@85 | |
848 | 915 //unsigned __int8 v52; // zf@87 |
916 //unsigned __int8 v53; // sf@87 | |
845 | 917 // unsigned __int8 v54; // of@104 |
0 | 918 int v55; // eax@107 |
919 unsigned int v56; // edi@107 | |
920 int v57; // ST10_4@107 | |
921 unsigned int v58; // edi@107 | |
922 unsigned int v59; // ebx@107 | |
923 signed int v60; // eax@107 | |
924 int v61; // eax@124 | |
925 Vec3_int_ v62; // [sp+Ch] [bp-44h]@42 | |
153 | 926 int v63; // [sp+18h] [bp-38h]@64 |
0 | 927 int v64; // [sp+1Ch] [bp-34h]@64 |
928 int v65; // [sp+20h] [bp-30h]@2 | |
929 int v66; // [sp+24h] [bp-2Ch]@2 | |
930 bool v67; // [sp+28h] [bp-28h]@10 | |
846 | 931 //unsigned int v68; // [sp+2Ch] [bp-24h]@10 |
0 | 932 unsigned int v69; // [sp+30h] [bp-20h]@6 |
933 unsigned int v70; // [sp+34h] [bp-1Ch]@10 | |
934 int v71; // [sp+38h] [bp-18h]@62 | |
845 | 935 int uIsAboveFloor; // [sp+3Ch] [bp-14h]@10 |
936 int v72b; | |
1545 | 937 //int v73; // [sp+40h] [bp-10h]@17 |
845 | 938 int uIsFlying; // [sp+44h] [bp-Ch]@8 |
0 | 939 unsigned int v75; // [sp+48h] [bp-8h]@1 |
845 | 940 int uIsOnWater; // [sp+4Ch] [bp-4h]@10 |
941 | |
1545 | 942 for (v75 = 0; v75 < uNumActors; ++v75) |
0 | 943 { |
944 v0 = &pActors[v75]; | |
945 v66 = v0->vPosition.x; | |
946 v65 = v0->vPosition.y; | |
845 | 947 uAIState = v0->uAIState; |
948 if ( uAIState == Removed || uAIState == Disabled || uAIState == Summoned || !v0->uMovementSpeed ) | |
949 { | |
950 continue; | |
951 } | |
0 | 952 v3 = 0; |
953 v69 = 0; | |
846 | 954 if ( MonsterStats::BelongsToSupertype(v0->pMonsterInfo.uID, MONSTER_SUPERTYPE_WATER_ELEMENTAL) ) |
0 | 955 v3 = 1; |
956 v0->uSectorID = 0; | |
845 | 957 uIsFlying = v0->pMonsterInfo.uFlying; |
0 | 958 if ( !v0->CanAct() ) |
845 | 959 uIsFlying = 0; |
138 | 960 v70 = IsTerrainSlopeTooHigh(v0->vPosition.x, v0->vPosition.y); |
723 | 961 v5 = ODM_GetFloorLevel( |
0 | 962 v0->vPosition.x, |
963 v0->vPosition.y, | |
964 v0->vPosition.z, | |
965 v0->uActorHeight, | |
845 | 966 &uIsOnWater, |
0 | 967 (int *)&v69, |
968 v3); | |
969 v6 = v0->vPosition.z; | |
845 | 970 uIsAboveFloor = 0; |
0 | 971 v67 = v69 == 0; |
972 if ( v6 > v5 + 1 ) | |
845 | 973 uIsAboveFloor = 1; |
974 if ( uAIState == Dead && uIsOnWater && !uIsAboveFloor ) | |
0 | 975 { |
976 v0->uAIState = Removed; | |
845 | 977 continue; |
0 | 978 } |
305 | 979 if ( v0->uCurrentActionAnimation == ANIM_Walking ) |
0 | 980 { |
981 v8 = v0->uMovementSpeed; | |
1951 | 982 if ( (signed __int64)v0->pActorBuffs[ACTOR_BUFF_SLOWED].uExpireTime > 0 ) |
0 | 983 { |
1545 | 984 v8 = (signed __int64)((double)v8 * 0.5); |
0 | 985 } |
845 | 986 if ( uAIState == Fleeing || uAIState == Pursuing ) |
0 | 987 { |
988 v8 *= 2; | |
989 } | |
1340 | 990 if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->turn_stage == 1 ) |
1545 | 991 v8 *= flt_6BE3AC_debug_recmod1_x_1_6; |
0 | 992 if ( v8 > 1000 ) |
993 v8 = 1000; | |
1545 | 994 |
1643 | 995 v0->vVelocity.x = fixpoint_mul(stru_5C6E00->Cos(v0->uYawAngle), v8); |
996 v0->vVelocity.y = fixpoint_mul(stru_5C6E00->Sin(v0->uYawAngle), v8); | |
845 | 997 if ( uIsFlying ) |
0 | 998 { |
1643 | 999 v0->vVelocity.z = fixpoint_mul(stru_5C6E00->Sin(v0->uPitchAngle), v8); |
0 | 1000 } |
846 | 1001 //v7 = v68; |
0 | 1002 } |
1003 else | |
1004 { | |
1643 | 1005 v0->vVelocity.x = fixpoint_mul(55000, v0->vVelocity.x); |
1006 v0->vVelocity.y = fixpoint_mul(55000, v0->vVelocity.y); | |
845 | 1007 if ( uIsFlying ) |
0 | 1008 { |
1643 | 1009 v0->vVelocity.z = fixpoint_mul(55000, v0->vVelocity.z); |
0 | 1010 } |
1011 } | |
846 | 1012 if ( v0->vPosition.z < v5 ) |
0 | 1013 { |
845 | 1014 v16 = uIsFlying; |
846 | 1015 v0->vPosition.z = v5; |
0 | 1016 v0->vVelocity.z = v16 != 0 ? 0x14 : 0; |
1017 } | |
846 | 1018 //v17 = 0; |
845 | 1019 if ( !uIsAboveFloor || uIsFlying ) |
1020 { | |
1021 if ( v70 && !uIsAboveFloor && v67 ) | |
0 | 1022 { |
846 | 1023 v0->vPosition.z = v5; |
1545 | 1024 ODM_GetTerrainNormalAt(v0->vPosition.x, v0->vPosition.y, &v62); |
0 | 1025 v20 = GetGravityStrength(); |
1545 | 1026 //v21 = v62.y; |
1027 //v22 = v62.z; | |
1028 //v23 = v62.y * v0->vVelocity.y; | |
0 | 1029 v0->vVelocity.z += -8 * LOWORD(pEventTimer->uTimeElapsed) * v20; |
1545 | 1030 int v73 = abs(v62.x * v0->vVelocity.x + v62.z * v0->vVelocity.z + v62.y * v0->vVelocity.y) >> 16; |
1031 //v72b = v21; | |
1643 | 1032 v0->vVelocity.x += fixpoint_mul(v73, v62.x); |
1033 v0->vVelocity.y += fixpoint_mul(v73, v62.y); | |
1034 v0->vVelocity.z += fixpoint_mul(v73, v62.z); | |
846 | 1035 //v17 = 0; |
0 | 1036 } |
1037 } | |
1038 else | |
1039 { | |
1040 v0->vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength(); | |
1041 } | |
846 | 1042 if ( pParty->armageddon_timer != 0 && v0->CanAct() ) |
0 | 1043 { |
1044 v0->vVelocity.x += rand() % 100 - 50; | |
1045 v0->vVelocity.y += rand() % 100 - 50; | |
1046 v0->vVelocity.z += rand() % 100 - 20; | |
1047 v25 = rand(); | |
1048 v0->uAIState = Stunned; | |
1049 v0->uYawAngle += v25 % 32 - 16; | |
1050 v0->UpdateAnimation(); | |
1051 } | |
846 | 1052 if ( v0->vVelocity.x * v0->vVelocity.x + v0->vVelocity.y * v0->vVelocity.y < 400 && v70 == 0 ) |
1053 { | |
1054 v0->vVelocity.y = 0; | |
1055 v0->vVelocity.x = 0; | |
0 | 1056 } |
1057 stru_721530.field_0 = 1; | |
845 | 1058 if ( !uIsFlying ) |
0 | 1059 v26 = 40; |
1060 else | |
1061 v26 = v0->uActorRadius; | |
1546 | 1062 |
0 | 1063 stru_721530.field_84 = -1; |
1546 | 1064 stru_721530.field_8_radius = v26; |
0 | 1065 stru_721530.prolly_normal_d = v26; |
1546 | 1066 stru_721530.height = v0->uActorHeight; |
846 | 1067 stru_721530.field_70 = 0; |
1068 v69 = 0; | |
0 | 1069 while ( 1 ) |
1070 { | |
1546 | 1071 stru_721530.position.x = v0->vPosition.x; |
1072 stru_721530.normal.x = stru_721530.position.x; | |
1073 stru_721530.position.y = v0->vPosition.y; | |
1074 stru_721530.normal.y = stru_721530.position.y; | |
0 | 1075 v28 = v0->vPosition.z; |
1076 stru_721530.normal.z = v28 + v26 + 1; | |
1546 | 1077 stru_721530.position.z = v28 - v26 + stru_721530.height - 1; |
1078 if ( stru_721530.position.z < stru_721530.normal.z ) | |
1079 stru_721530.position.z = v28 + v26 + 1; | |
1080 stru_721530.velocity.x = v0->vVelocity.x; | |
0 | 1081 stru_721530.uSectorID = 0; |
1546 | 1082 stru_721530.velocity.y = v0->vVelocity.y; |
1083 stru_721530.velocity.z = v0->vVelocity.z; | |
0 | 1084 if ( stru_721530._47050A(0) ) |
1085 break; | |
1086 _46E889_collide_against_bmodels(1u); | |
1087 v29 = WorldPosToGridCellZ(v0->vPosition.y); | |
1088 v30 = WorldPosToGridCellX(v0->vPosition.x); | |
1089 _46E26D_collide_against_sprites(v30, v29); | |
1090 _46EF01_collision_chech_player(0); | |
862 | 1091 _46ED8A_collide_against_sprite_objects(PID(OBJECT_Actor,v75)); |
0 | 1092 v31 = 0; |
1093 for ( i = 0; v31 < ai_arrays_size; ++v31 ) | |
1094 { | |
390 | 1095 v33 = ai_near_actors_ids[v31]; |
1897
436553b0603c
_46DF1A_collide_against_actor cleaned up, moved to Actor.h
Grumpy7
parents:
1861
diff
changeset
|
1096 if ( v33 != v75 && Actor::_46DF1A_collide_against_actor(v33, 40) ) |
0 | 1097 ++i; |
1098 } | |
1099 v71 = i > 1; | |
1100 if ( stru_721530.field_7C < stru_721530.field_6C ) | |
1643 | 1101 v70 = fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z); |
845 | 1102 //v34 = 0; |
0 | 1103 v35 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1; |
1545 | 1104 v36 = ODM_GetFloorLevel(stru_721530.normal2.x, |
0 | 1105 stru_721530.normal2.y, |
1106 stru_721530.normal2.z - stru_721530.prolly_normal_d - 1, | |
1107 v0->uActorHeight, | |
1108 (int *)&v63, | |
1109 &v64, | |
1110 0); | |
845 | 1111 if ( uIsOnWater ) |
0 | 1112 { |
1113 if ( v35 < v36 + 60 ) | |
1114 { | |
848 | 1115 if ( uAIState == Dead || uAIState == Dying || uAIState == Removed || uAIState == Disabled ) |
0 | 1116 { |
1117 if ( v64 ) | |
1118 v61 = v36 + 30; | |
1119 else | |
846 | 1120 v61 = v5 + 60; |
0 | 1121 sub_42F960_create_object(v0->vPosition.x, v0->vPosition.y, v61); |
1122 v0->uAIState = Removed; | |
1123 return; | |
1124 } | |
1125 } | |
1126 } | |
1127 if ( stru_721530.field_7C >= stru_721530.field_6C ) | |
1128 { | |
1129 v0->vPosition.x = LOWORD(stru_721530.normal2.x); | |
1130 v0->vPosition.y = LOWORD(stru_721530.normal2.y); | |
1131 v0->vPosition.z = LOWORD(stru_721530.normal2.z) - LOWORD(stru_721530.prolly_normal_d) - 1; | |
1132 break; | |
1133 } | |
1643 | 1134 //v72b = fixpoint_mul(stru_721530.field_7C, stru_721530.field_58.x); |
1135 v0->vPosition.x += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.x); | |
1545 | 1136 //v72b = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16; |
1643 | 1137 v0->vPosition.y += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.y); |
1545 | 1138 //v72b = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16; |
1643 | 1139 v0->vPosition.z += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z); |
0 | 1140 v38 = stru_721530.uFaceID; |
1141 stru_721530.field_70 += stru_721530.field_7C; | |
848 | 1142 v39 = PID_ID(v38); |
845 | 1143 switch ( PID_TYPE(v38) ) |
1144 { | |
1145 case OBJECT_Actor: | |
1340 | 1146 if ( pTurnEngine->turn_stage != 2 && pTurnEngine->turn_stage != 3 || pParty->bTurnBasedModeOn != 1 ) |
845 | 1147 { |
1148 //if(pParty->bTurnBasedModeOn == 1) | |
1149 //v34 = 0; | |
0 | 1150 if ( v0->pMonsterInfo.uHostilityType ) |
1151 { | |
845 | 1152 if ( v71 == 0 ) |
1153 { | |
1060 | 1154 Actor::AI_Flee(v75, v38, 0, (AIDirection *)0); |
845 | 1155 } |
1156 else | |
1157 { | |
1158 Actor::AI_StandOrBored(v75, 4, 0, (AIDirection *)0); | |
1159 } | |
0 | 1160 } |
1545 | 1161 else if ( v71 ) |
845 | 1162 { |
1163 Actor::AI_StandOrBored(v75, 4, 0, (AIDirection *)0); | |
1164 } | |
1165 else if ( pActors[v39].pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly ) | |
0 | 1166 { |
1060 | 1167 Actor::AI_Flee(v75, v38, 0, (AIDirection *)0); |
0 | 1168 } |
845 | 1169 else |
1170 { | |
1060 | 1171 Actor::AI_FaceObject(v75, v38, 0, (AIDirection *)0); |
845 | 1172 } |
0 | 1173 } |
1174 break; | |
845 | 1175 case OBJECT_Player: |
0 | 1176 if ( !v0->GetActorsRelation(0) ) |
1177 { | |
1178 v38 = stru_721530.uFaceID; | |
1060 | 1179 Actor::AI_FaceObject(v75, v38, 0, (AIDirection *)0); |
845 | 1180 break; |
0 | 1181 } |
1167 | 1182 //v52 = HIDWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) == 0; |
1183 //v53 = SHIDWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) < 0; | |
0 | 1184 v0->vVelocity.y = 0; |
1185 v0->vVelocity.x = 0; | |
1167 | 1186 //if ( !v53 && (!(v53 | v52) || LODWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) > 0) ) |
1187 if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime < 0) | |
1188 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); | |
0 | 1189 viewparams->bRedrawGameUI = 1; |
1190 break; | |
845 | 1191 case OBJECT_Decoration: |
295 | 1192 v47 = integer_sqrt(v0->vVelocity.x * v0->vVelocity.x + v0->vVelocity.y * v0->vVelocity.y); |
0 | 1193 v48 = stru_5C6E00->Atan2( |
1194 v0->vPosition.x - pLevelDecorations[v39].vPosition.x, | |
1195 v0->vPosition.y - pLevelDecorations[v39].vPosition.y); | |
323 | 1196 v49 = v48; |
1643 | 1197 v0->vVelocity.x = fixpoint_mul(stru_5C6E00->Cos(v48), v47); |
1198 v0->vVelocity.y = fixpoint_mul(stru_5C6E00->Sin(v48), v47); | |
0 | 1199 break; |
845 | 1200 case OBJECT_BModel: |
0 | 1201 v40 = &pOutdoor->pBModels[v38 >> 9]; |
1202 v41 = &v40->pFaces[v39 & 0x3F]; | |
1545 | 1203 if ( !(v41->uAttributes & 0x20000000) ) |
0 | 1204 { |
1205 v42 = v41->uPolygonType; | |
1206 if ( v42 == 3 ) | |
1207 { | |
1208 v43 = v0->vVelocity.y; | |
1209 v44 = v0->vVelocity.x; | |
1210 v0->vVelocity.z = 0; | |
1211 v0->vPosition.z = LOWORD(v40->pVertices.pVertices[v41->pVertexIDs[0]].z) + 1; | |
1212 if ( v44 * v44 + v43 * v43 < 400 ) | |
1213 { | |
1214 v0->vVelocity.y = 0; | |
1215 v0->vVelocity.x = 0; | |
1216 } | |
1217 } | |
1218 else | |
1219 { | |
845 | 1220 v72b = abs(v41->pFacePlane.vNormal.y * v0->vVelocity.y + v41->pFacePlane.vNormal.z * v0->vVelocity.z |
0 | 1221 + v41->pFacePlane.vNormal.x * v0->vVelocity.x) >> 16; |
1546 | 1222 if ( (stru_721530.speed >> 3) > v72b ) |
1223 v72b = stru_721530.speed >> 3; | |
1545 | 1224 |
1643 | 1225 v0->vVelocity.x += fixpoint_mul(v72b, v41->pFacePlane.vNormal.x); |
1226 v0->vVelocity.y += fixpoint_mul(v72b, v41->pFacePlane.vNormal.y); | |
1227 v0->vVelocity.z += fixpoint_mul(v72b, v41->pFacePlane.vNormal.z); | |
0 | 1228 if ( v42 != 4 ) |
1229 { | |
1230 v45 = v0->vPosition.z; | |
1231 v46 = stru_721530.prolly_normal_d | |
1232 - ((v41->pFacePlane.dist | |
1233 + v41->pFacePlane.vNormal.x * v0->vPosition.x | |
1234 + v41->pFacePlane.vNormal.y * v0->vPosition.y | |
1235 + v41->pFacePlane.vNormal.z * v0->vPosition.z) >> 16); | |
1236 if ( v46 > 0 ) | |
1237 { | |
1238 v0->vPosition.x += (unsigned int)(v46 * v41->pFacePlane.vNormal.x) >> 16; | |
1239 v0->vPosition.y += (unsigned int)(v46 * v41->pFacePlane.vNormal.y) >> 16; | |
1240 v0->vPosition.z = v45 + ((unsigned int)(v46 * v41->pFacePlane.vNormal.z) >> 16); | |
1241 } | |
1242 v0->uYawAngle = stru_5C6E00->Atan2(v0->vVelocity.x, v0->vVelocity.y); | |
1243 } | |
1244 } | |
1245 } | |
1246 break; | |
1247 } | |
1545 | 1248 |
1643 | 1249 v0->vVelocity.x = fixpoint_mul(58500, v0->vVelocity.x); |
1250 v0->vVelocity.y = fixpoint_mul(58500, v0->vVelocity.y); | |
1251 v0->vVelocity.z = fixpoint_mul(58500, v0->vVelocity.z); | |
1545 | 1252 |
0 | 1253 ++v69; |
845 | 1254 if ( v69 >= 100 ) |
0 | 1255 break; |
1256 v26 = stru_721530.prolly_normal_d; | |
1257 } | |
846 | 1258 v58 = ((unsigned int)~pOutdoor->ActuallyGetSomeOtherTileInfo(WorldPosToGridCellX(v66), WorldPosToGridCellZ(v65) - 1) >> 1) & 1; |
1259 v59 = ((unsigned int)~pOutdoor->ActuallyGetSomeOtherTileInfo(WorldPosToGridCellX(v0->vPosition.x), WorldPosToGridCellZ(v0->vPosition.y) - 1) >> 1) & 1; | |
1260 if ( WorldPosToGridCellX(v66) == WorldPosToGridCellX(v0->vPosition.x) | |
845 | 1261 && WorldPosToGridCellZ(v65) == WorldPosToGridCellZ(v0->vPosition.y) |
1262 && v58 | |
1263 || v67 != 0 ) | |
0 | 1264 { |
1265 if ( MonsterStats::BelongsToSupertype(v0->pMonsterInfo.uID, MONSTER_SUPERTYPE_WATER_ELEMENTAL) ) | |
1266 { | |
1267 v58 = v58 == 0; | |
1268 v59 = v59 == 0; | |
1269 } | |
845 | 1270 if ( !uIsFlying && v58 && !v59 ) |
0 | 1271 { |
1272 v0->vPosition.x = v66; | |
1273 v0->vPosition.y = v65; | |
1274 if ( v0->CanAct() ) | |
1275 { | |
1276 v0->uYawAngle -= 32; | |
1277 v0->uCurrentActionTime = 0; | |
1278 v0->uCurrentActionLength = 128; | |
1279 v0->uAIState = Fleeing; | |
1280 } | |
1281 } | |
1282 } | |
845 | 1283 } |
0 | 1284 } |
1285 | |
1286 //----- (0047253E) -------------------------------------------------------- | |
1287 void UpdateObjects() | |
1288 { | |
1289 unsigned int v0; // ebx@0 | |
1290 //unsigned int v1; // edi@1 | |
1083 | 1291 //char *v2; // esi@2 |
0 | 1292 //__int16 v3; // dx@5 |
1293 ObjectDesc *v4; // eax@5 | |
1294 int v5; // ecx@6 | |
1295 __int16 v6; // cx@7 | |
1296 signed int v7; // eax@9 | |
1297 __int16 v8; // cx@14 | |
1298 __int16 v9; // dx@14 | |
1299 unsigned int v10; // ecx@16 | |
1300 signed int v11; // eax@17 | |
1301 int v12; // edi@27 | |
1302 int v13; // eax@27 | |
1303 int v14; // ebx@27 | |
1304 unsigned int v15; // ecx@27 | |
1305 unsigned int v16; // edx@30 | |
1306 unsigned int v17; // edx@32 | |
1307 int v18; // [sp+4h] [bp-10h]@27 | |
1308 int v19; // [sp+8h] [bp-Ch]@27 | |
1309 //signed int v20; // [sp+10h] [bp-4h]@1 | |
1310 | |
1311 //v1 = 0; | |
1312 //v20 = 0; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
1313 for (uint i = 0; i < uNumSpriteObjects; ++i) |
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
1314 { |
1980 | 1315 SpriteObject* item = &pSpriteObjects[i]; |
1083 | 1316 //v2 = (char *)&item->uSpriteFrameID; |
0 | 1317 //do |
1318 //{ | |
1319 //LOWORD(v0) = item->uAttributes; | |
1545 | 1320 if (item->uAttributes & OBJECT_40) |
1321 item->uAttributes &= ~OBJECT_40; | |
0 | 1322 else |
1323 { | |
1324 //v3 = item->uObjectDescID; | |
1325 v4 = &pObjectList->pObjects[item->uObjectDescID]; | |
430 | 1326 if (item->AttachedToActor()) |
1327 { | |
848 | 1328 v5 = PID_ID(item->spell_target_pid); |
1083 | 1329 item->vPosition.x = pActors[v5].vPosition.x; |
1330 item->vPosition.y = pActors[v5].vPosition.y; | |
1331 item->vPosition.z = pActors[v5].vPosition.z + pActors[v5].uActorHeight; | |
1332 if ( !item->uObjectDescID || (v6 = LOWORD(pEventTimer->uTimeElapsed) + item->uSpriteFrameID, item->uSpriteFrameID = v6, !(v4->uFlags & 4)) ) | |
1333 continue; | |
0 | 1334 if ( v6 >= 0 ) |
1335 { | |
1336 v7 = v4->uLifetime; | |
1337 if (item->uAttributes & 2) | |
1083 | 1338 v7 = item->field_20; |
0 | 1339 if ( v6 < v7 ) |
1083 | 1340 continue; |
1341 } | |
1342 v10 = i; | |
1343 SpriteObject::OnInteraction(v10); | |
1344 continue; | |
0 | 1345 } |
1346 | |
1347 if ( item->uObjectDescID ) | |
1348 { | |
1349 v8 = LOWORD(pEventTimer->uTimeElapsed) + item->uSpriteFrameID; | |
1350 item->uSpriteFrameID = v8; | |
1351 v9 = v4->uFlags; | |
1083 | 1352 if ( v9 & 4 ) |
1353 { | |
1354 if ( v8 < 0 ) | |
1355 { | |
1356 v10 = i; | |
1357 SpriteObject::OnInteraction(v10); | |
1358 continue; | |
1359 } | |
1360 v11 = v4->uLifetime; | |
1361 if (item->uAttributes & 2) | |
1362 v11 = item->field_20; | |
1363 } | |
1364 if ( !(v9 & 4) || v8 < v11 ) | |
1365 { | |
0 | 1366 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
1367 SpriteObject::UpdateObject_fn0_BLV(i); |
0 | 1368 else |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
1369 SpriteObject::UpdateObject_fn0_ODM(i); |
1083 | 1370 if ( pParty->bTurnBasedModeOn != 1 || !(item->uSectorID & 4) ) |
1371 continue; | |
1372 v12 = abs(pParty->vPosition.x - item->vPosition.x); | |
1373 v18 = abs(pParty->vPosition.y - item->vPosition.y); | |
1374 v19 = abs(pParty->vPosition.z - item->vPosition.z); | |
0 | 1375 v13 = v12; |
1376 v14 = v18; | |
1377 v15 = v19; | |
1378 if ( v12 < v18 ) | |
1379 { | |
1380 v13 = v18; | |
1381 v14 = v12; | |
1382 } | |
1383 if ( v13 < v19 ) | |
1384 { | |
1385 v16 = v13; | |
1386 v13 = v19; | |
1387 v15 = v16; | |
1388 } | |
1389 if ( v14 < (signed int)v15 ) | |
1390 { | |
1391 v17 = v15; | |
1392 v15 = v14; | |
1393 v14 = v17; | |
1394 } | |
1395 v0 = (unsigned int)(11 * v14) >> 5; | |
1396 if ( (signed int)(v0 + (v15 >> 2) + v13) <= 5120 ) | |
1083 | 1397 continue; |
0 | 1398 v10 = i; |
1083 | 1399 SpriteObject::OnInteraction(v10); |
1400 continue; | |
0 | 1401 } |
1402 v10 = i; | |
1403 if ( !(v9 & 0x40) ) | |
1083 | 1404 { |
1405 SpriteObject::OnInteraction(v10); | |
1406 continue; | |
1407 } | |
862 | 1408 _46BFFA_check_object_intercept(i, PID(OBJECT_Item,i)); |
0 | 1409 } |
1410 } | |
1411 //v2 += 112; | |
1412 //v1 = v20++ + 1; | |
1413 //} | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
1414 //while ( v20 < (signed int)uNumSpriteObjects ); |
0 | 1415 } |
1416 } | |
1417 | |
1418 //----- (0047272C) -------------------------------------------------------- | |
831 | 1419 int collide_against_floor_approximate(int x, int y, int z, unsigned int *pSectorID, unsigned int *pFaceID) |
0 | 1420 { |
1421 signed int v5; // ebx@1 | |
1422 int result; // eax@1 | |
1423 int v7; // [sp+10h] [bp-8h]@1 | |
1424 signed int v8; // [sp+14h] [bp-4h]@1 | |
1425 | |
1426 v5 = x - 2; | |
1427 v7 = x; | |
1428 v8 = y; | |
1429 *pSectorID = pIndoor->GetSector(x - 2, y, z + 40); | |
783 | 1430 result = collide_against_floor(v5, v8, z + 40, pSectorID, pFaceID); |
0 | 1431 if ( result == -30000 || !*pSectorID ) |
1432 { | |
1433 *pSectorID = pIndoor->GetSector(v7 + 2, v8, z + 40); | |
783 | 1434 result = collide_against_floor(v7 + 2, v8, z + 40, pSectorID, pFaceID); |
0 | 1435 if ( result == -30000 || !*pSectorID ) |
1436 { | |
1437 *pSectorID = pIndoor->GetSector(v7, v8 - 2, z + 40); | |
783 | 1438 result = collide_against_floor(v7, v8 - 2, z + 40, pSectorID, pFaceID); |
0 | 1439 if ( result == -30000 || !*pSectorID ) |
1440 { | |
1441 *pSectorID = pIndoor->GetSector(v7, v8 + 2, z + 40); | |
783 | 1442 result = collide_against_floor(v7, v8 + 2, z + 40, pSectorID, pFaceID); |
0 | 1443 if ( result == -30000 || !*pSectorID ) |
1444 { | |
1445 *pSectorID = pIndoor->GetSector(v7, v8, z + 140); | |
783 | 1446 result = collide_against_floor(v7, v8, z + 140, pSectorID, pFaceID); |
0 | 1447 } |
1448 } | |
1449 } | |
1450 } | |
1451 return result; | |
1452 } | |
1453 | |
1454 //----- (0047531C) -------------------------------------------------------- | |
1455 bool __fastcall sub_47531C(int a1, int *a2, int a3, int a4, int a5, int a6, int a7, int a8, BLVFace *a9, int a10) | |
1456 { | |
1457 BLVFace *v10; // ebx@1 | |
1458 int v11; // ST1C_4@3 | |
1459 int v12; // edi@3 | |
1460 int v13; // esi@3 | |
1461 int v14; // edi@4 | |
1462 signed __int64 v15; // qtt@6 | |
1463 __int16 v16; // si@7 | |
1464 int *v18; // [sp+Ch] [bp-Ch]@1 | |
1465 int v19; // [sp+10h] [bp-8h]@1 | |
1466 int a7a; // [sp+30h] [bp+18h]@7 | |
1467 int a9b; // [sp+38h] [bp+20h]@3 | |
1468 int a9a; // [sp+38h] [bp+20h]@3 | |
1469 int a10b; // [sp+3Ch] [bp+24h]@3 | |
1470 signed int a10a; // [sp+3Ch] [bp+24h]@4 | |
1471 int a10c; // [sp+3Ch] [bp+24h]@5 | |
1472 | |
1473 v10 = a9; | |
1474 v18 = a2; | |
1475 v19 = a1; | |
1476 if ( a10 && BYTE3(a9->uAttributes) & 0x20 ) | |
1477 return 0; | |
1478 v11 = (unsigned __int64)(a6 * (signed __int64)a9->pFacePlane_old.vNormal.x) >> 16; | |
1479 a10b = (unsigned __int64)(a7 * (signed __int64)a9->pFacePlane_old.vNormal.y) >> 16; | |
1480 a9b = (unsigned __int64)(a8 * (signed __int64)a9->pFacePlane_old.vNormal.z) >> 16; | |
1481 v12 = v11 + a9b + a10b; | |
1482 a9a = v11 + a9b + a10b; | |
1483 v13 = (a1 << 16) | |
1484 - a3 * v10->pFacePlane_old.vNormal.x | |
1485 - a4 * v10->pFacePlane_old.vNormal.y | |
1486 - a5 * v10->pFacePlane_old.vNormal.z | |
1487 - v10->pFacePlane_old.dist; | |
1488 if ( abs((a1 << 16) | |
1489 - a3 * v10->pFacePlane_old.vNormal.x | |
1490 - a4 * v10->pFacePlane_old.vNormal.y | |
1491 - a5 * v10->pFacePlane_old.vNormal.z - v10->pFacePlane_old.dist) >= a1 << 16 ) | |
1492 { | |
1493 a10c = abs(v13) >> 14; | |
1494 if ( a10c > abs(v12) ) | |
1495 return 0; | |
1496 LODWORD(v15) = v13 << 16; | |
1497 HIDWORD(v15) = v13 >> 16; | |
1498 v14 = v19; | |
1499 a10a = v15 / a9a; | |
1500 } | |
1501 else | |
1502 { | |
1503 a10a = 0; | |
1504 v14 = abs(v13) >> 16; | |
1505 } | |
1506 v16 = a4 + ((unsigned int)((unsigned __int64)(a10a * (signed __int64)a7) >> 16) >> 16); | |
1507 LOWORD(a7a) = (short)a3 | |
1508 + ((unsigned int)((unsigned __int64)(a10a * (signed __int64)a6) >> 16) >> 16) | |
1509 - ((unsigned int)(v14 * v10->pFacePlane_old.vNormal.x) >> 16); | |
1510 HIWORD(a7a) = v16 - ((unsigned int)(v14 * v10->pFacePlane_old.vNormal.y) >> 16); | |
1511 if ( !sub_475665( | |
1512 v10, | |
1513 a7a, | |
1514 (short)a5 | |
1515 + ((unsigned int)((unsigned __int64)(a10a * (signed __int64)a8) >> 16) >> 16) | |
1516 - ((unsigned int)(v14 * v10->pFacePlane_old.vNormal.z) >> 16)) ) | |
1517 return 0; | |
1518 *v18 = a10a >> 16; | |
1519 if ( a10a >> 16 < 0 ) | |
1520 *v18 = 0; | |
1521 return 1; | |
1522 } | |
1523 | |
1524 //----- (004754BF) -------------------------------------------------------- | |
1525 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) | |
1526 { | |
1527 BLVFace *v11; // ebx@1 | |
1528 int v12; // ST1C_4@3 | |
1529 int v13; // edi@3 | |
1530 int v14; // esi@3 | |
1531 int v15; // edi@4 | |
1532 signed __int64 v16; // qtt@6 | |
1533 __int16 v17; // si@7 | |
1534 int *v19; // [sp+Ch] [bp-Ch]@1 | |
1535 int v20; // [sp+10h] [bp-8h]@1 | |
1536 int a7a; // [sp+30h] [bp+18h]@7 | |
1537 int a1b; // [sp+38h] [bp+20h]@3 | |
1538 int a1a; // [sp+38h] [bp+20h]@3 | |
1539 int a11b; // [sp+40h] [bp+28h]@3 | |
1540 signed int a11a; // [sp+40h] [bp+28h]@4 | |
1541 int a11c; // [sp+40h] [bp+28h]@5 | |
1542 | |
1543 v11 = a9; | |
1544 v19 = a2; | |
1545 v20 = a1; | |
1546 if ( a11 && BYTE3(a9->uAttributes) & 0x20 ) | |
1547 return 0; | |
1548 v12 = (unsigned __int64)(a6 * (signed __int64)a9->pFacePlane_old.vNormal.x) >> 16; | |
1549 a11b = (unsigned __int64)(a7 * (signed __int64)a9->pFacePlane_old.vNormal.y) >> 16; | |
1550 a1b = (unsigned __int64)(a8 * (signed __int64)a9->pFacePlane_old.vNormal.z) >> 16; | |
1551 v13 = v12 + a1b + a11b; | |
1552 a1a = v12 + a1b + a11b; | |
1553 v14 = (a1 << 16) | |
1554 - a3 * v11->pFacePlane_old.vNormal.x | |
1555 - a4 * v11->pFacePlane_old.vNormal.y | |
1556 - a5 * v11->pFacePlane_old.vNormal.z | |
1557 - v11->pFacePlane_old.dist; | |
1558 if ( abs((a1 << 16) | |
1559 - a3 * v11->pFacePlane_old.vNormal.x | |
1560 - a4 * v11->pFacePlane_old.vNormal.y | |
1561 - a5 * v11->pFacePlane_old.vNormal.z - v11->pFacePlane_old.dist) >= a1 << 16 ) | |
1562 { | |
1563 a11c = abs(v14) >> 14; | |
1564 if ( a11c > abs(v13) ) | |
1565 return 0; | |
1566 LODWORD(v16) = v14 << 16; | |
1567 HIDWORD(v16) = v14 >> 16; | |
1568 v15 = v20; | |
1569 a11a = v16 / a1a; | |
1570 } | |
1571 else | |
1572 { | |
1573 a11a = 0; | |
1574 v15 = abs(v14) >> 16; | |
1575 } | |
1576 v17 = a4 + ((unsigned int)((unsigned __int64)(a11a * (signed __int64)a7) >> 16) >> 16); | |
1577 LOWORD(a7a) = (short)a3 | |
1578 + ((unsigned int)((unsigned __int64)(a11a * (signed __int64)a6) >> 16) >> 16) | |
1579 - ((unsigned int)(v15 * v11->pFacePlane_old.vNormal.x) >> 16); | |
1580 HIWORD(a7a) = v17 - ((unsigned int)(v15 * v11->pFacePlane_old.vNormal.y) >> 16); | |
1581 if ( !sub_4759C9( | |
1582 v11, | |
1583 a10, | |
1584 a7a, | |
1585 (short)a5 | |
1586 + ((unsigned int)((unsigned __int64)(a11a * (signed __int64)a8) >> 16) >> 16) | |
1587 - ((unsigned int)(v15 * v11->pFacePlane_old.vNormal.z) >> 16)) ) | |
1588 return 0; | |
1589 *v19 = a11a >> 16; | |
1590 if ( a11a >> 16 < 0 ) | |
1591 *v19 = 0; | |
1592 return 1; | |
1593 } | |
1594 | |
1595 //----- (00475665) -------------------------------------------------------- | |
1459 | 1596 int sub_475665(BLVFace *_this, int a2, __int16 a3) |
0 | 1597 { |
1598 unsigned int v3; // eax@1 | |
1599 Vec3_short_ *v4; // edx@3 | |
1600 signed int v5; // eax@4 | |
1601 int v6; // esi@4 | |
1602 signed int v7; // eax@7 | |
1603 Vec3_short_ *v8; // edx@8 | |
1604 signed int v9; // eax@9 | |
1605 int v10; // esi@9 | |
1606 signed int v11; // eax@11 | |
1607 Vec3_short_ *v12; // edx@12 | |
1608 signed int v13; // eax@13 | |
1609 int v14; // esi@13 | |
1610 int v15; // esi@14 | |
1611 bool v16; // edi@14 | |
1612 int v17; // ecx@16 | |
1613 signed int v18; // edx@16 | |
1614 int v19; // eax@17 | |
1615 signed int v20; // ebx@18 | |
1616 int v21; // edi@20 | |
1617 signed int v22; // ST14_4@22 | |
1618 signed __int64 v23; // qtt@22 | |
1619 signed int result; // eax@25 | |
1620 int v25; // [sp+14h] [bp-10h]@14 | |
1621 int v26; // [sp+1Ch] [bp-8h]@2 | |
1622 signed int v27; // [sp+20h] [bp-4h]@2 | |
1623 signed int v28; // [sp+30h] [bp+Ch]@2 | |
1624 signed int v29; // [sp+30h] [bp+Ch]@7 | |
1625 signed int v30; // [sp+30h] [bp+Ch]@11 | |
1626 signed int v31; // [sp+30h] [bp+Ch]@14 | |
1627 | |
1628 v3 = _this->uAttributes; | |
1629 if ( BYTE1(v3) & 1 ) | |
1630 { | |
1631 v28 = 0; | |
1632 v26 = (signed __int16)a2; | |
1633 v27 = SHIWORD(a2); | |
1634 if ( _this->uNumVertices ) | |
1635 { | |
1636 v4 = pIndoor->pVertices; | |
1637 do | |
1638 { | |
1639 v5 = v28; | |
1640 v6 = 2 * v28; | |
1641 word_720C10_intercepts_xs[2 * v28] = _this->pXInterceptDisplacements[v28] + v4[_this->pVertexIDs[v28]].x; | |
1642 word_720B40_intercepts_zs[2 * v28] = _this->pYInterceptDisplacements[v5] + v4[_this->pVertexIDs[v5]].y; | |
1643 word_720C10_intercepts_xs[2 * v28++ + 1] = _this->pXInterceptDisplacements[v5 + 1] | |
1644 + v4[_this->pVertexIDs[v5 + 1]].x; | |
1645 word_720B40_intercepts_zs[v6 + 1] = _this->pYInterceptDisplacements[v5 + 1] + v4[_this->pVertexIDs[v5 + 1]].y; | |
1646 } | |
1647 while ( v28 < _this->uNumVertices ); | |
1648 } | |
1649 } | |
1650 else | |
1651 { | |
1652 if ( BYTE1(v3) & 2 ) | |
1653 { | |
1654 v26 = (signed __int16)a2; | |
1655 v7 = a3; | |
1656 v29 = 0; | |
1657 v27 = v7; | |
1658 if ( _this->uNumVertices ) | |
1659 { | |
1660 v8 = pIndoor->pVertices; | |
1661 do | |
1662 { | |
1663 v9 = v29; | |
1664 v10 = 2 * v29; | |
1665 word_720C10_intercepts_xs[2 * v29] = _this->pXInterceptDisplacements[v29] + v8[_this->pVertexIDs[v29]].x; | |
1666 word_720B40_intercepts_zs[2 * v29] = _this->pZInterceptDisplacements[v9] + v8[_this->pVertexIDs[v9]].z; | |
1667 word_720C10_intercepts_xs[2 * v29++ + 1] = _this->pXInterceptDisplacements[v9 + 1] + v8[_this->pVertexIDs[v9 + 1]].x; | |
1668 word_720B40_intercepts_zs[v10 + 1] = _this->pZInterceptDisplacements[v9 + 1] + v8[_this->pVertexIDs[v9 + 1]].z; | |
1669 } | |
1670 while ( v29 < _this->uNumVertices ); | |
1671 } | |
1672 } | |
1673 else | |
1674 { | |
1675 v26 = SHIWORD(a2); | |
1676 v11 = a3; | |
1677 v30 = 0; | |
1678 v27 = v11; | |
1679 if ( _this->uNumVertices ) | |
1680 { | |
1681 v12 = pIndoor->pVertices; | |
1682 do | |
1683 { | |
1684 v13 = v30; | |
1685 v14 = 2 * v30; | |
1686 word_720C10_intercepts_xs[2 * v30] = _this->pYInterceptDisplacements[v30] + v12[_this->pVertexIDs[v30]].y; | |
1687 word_720B40_intercepts_zs[2 * v30] = _this->pZInterceptDisplacements[v13] + v12[_this->pVertexIDs[v13]].z; | |
1688 word_720C10_intercepts_xs[2 * v30++ + 1] = _this->pYInterceptDisplacements[v13 + 1] + v12[_this->pVertexIDs[v13 + 1]].y; | |
1689 word_720B40_intercepts_zs[v14 + 1] = _this->pZInterceptDisplacements[v13 + 1] + v12[_this->pVertexIDs[v13 + 1]].z; | |
1690 } | |
1691 while ( v30 < _this->uNumVertices ); | |
1692 } | |
1693 } | |
1694 } | |
1695 v15 = 2 * _this->uNumVertices; | |
1696 v31 = 0; | |
1697 word_720C10_intercepts_xs[2 * _this->uNumVertices] = word_720C10_intercepts_xs[0]; | |
1698 word_720B40_intercepts_zs[v15] = word_720B40_intercepts_zs[0]; | |
1699 v25 = 0; | |
1700 v16 = word_720B40_intercepts_zs[0] >= v27; | |
1701 if ( v15 <= 0 ) | |
1418 | 1702 return 0; |
0 | 1703 do |
1704 { | |
1705 if ( v31 >= 2 ) | |
1706 break; | |
1707 v17 = v25; | |
1708 v18 = word_720B40_intercepts_zs[v25 + 1]; | |
1110 | 1709 if ( v16 ^ (v18 >= v27) ) |
0 | 1710 { |
1711 v19 = word_720C10_intercepts_xs[v17 + 1]; | |
1712 if ( v19 >= v26 ) | |
1713 v20 = 0; | |
1714 else | |
1715 v20 = 2; | |
1110 | 1716 v21 = v20 | (word_720C10_intercepts_xs[v17] < v26); |
0 | 1717 if ( v21 != 3 ) |
1718 { | |
1719 if ( !v21 | |
1720 || (v22 = v19 - word_720C10_intercepts_xs[v17], | |
1721 LODWORD(v23) = v22 << 16, | |
1722 HIDWORD(v23) = v22 >> 16, | |
1723 word_720C10_intercepts_xs[v17] | |
1724 + ((signed int)(((unsigned __int64)(v23 | |
1725 / (v18 - word_720B40_intercepts_zs[v17]) | |
1726 * ((v27 - (signed int)word_720B40_intercepts_zs[v17]) << 16)) >> 16) | |
1727 + 32768) >> 16) >= v26) ) | |
1728 ++v31; | |
1729 } | |
1730 } | |
1731 ++v25; | |
1732 v16 = v18 >= v27; | |
1733 } | |
1734 while ( v25 < v15 ); | |
1735 result = 1; | |
1736 if ( v31 != 1 ) | |
1737 result = 0; | |
1738 return result; | |
1739 } | |
1740 | |
1741 //----- (004759C9) -------------------------------------------------------- | |
1742 bool __fastcall sub_4759C9(BLVFace *a1, int a2, int a3, __int16 a4) | |
1743 { | |
1744 unsigned int v4; // eax@1 | |
1745 int v5; // edx@4 | |
1746 __int16 v6; // si@4 | |
1747 int v7; // edx@9 | |
1748 __int16 v8; // si@9 | |
1749 int v9; // edx@13 | |
1750 __int16 v10; // si@13 | |
1751 int v11; // esi@14 | |
1752 bool v12; // edi@14 | |
1753 int v13; // ecx@16 | |
1754 signed int v14; // edx@16 | |
1755 int v15; // eax@17 | |
1756 signed int v16; // ebx@18 | |
1757 int v17; // edi@20 | |
1758 signed int v18; // ST14_4@22 | |
1759 signed __int64 v19; // qtt@22 | |
1760 bool result; // eax@25 | |
1761 int v21; // [sp+14h] [bp-10h]@14 | |
1762 signed int v22; // [sp+18h] [bp-Ch]@1 | |
1763 int v23; // [sp+1Ch] [bp-8h]@2 | |
1764 signed int v24; // [sp+20h] [bp-4h]@2 | |
1765 Vec3_int_ **a4a; // [sp+30h] [bp+Ch]@3 | |
1766 Vec3_int_ **a4b; // [sp+30h] [bp+Ch]@8 | |
1767 Vec3_int_ **a4c; // [sp+30h] [bp+Ch]@12 | |
1768 signed int a4d; // [sp+30h] [bp+Ch]@14 | |
1769 | |
1770 v4 = a1->uAttributes; | |
1771 v22 = 0; | |
1772 if ( BYTE1(v4) & 1 ) | |
1773 { | |
1774 v23 = (signed __int16)a3; | |
1775 v24 = SHIWORD(a3); | |
1776 if ( a1->uNumVertices ) | |
1777 { | |
1778 a4a = &pOutdoor->pBModels[a2].pVertices.pVertices; | |
1779 do | |
1780 { | |
1781 v5 = 2 * v22; | |
1782 word_720A70_intercepts_xs_plus_xs[2 * v22] = a1->pXInterceptDisplacements[v22] + LOWORD((*a4a)[a1->pVertexIDs[v22]].x); | |
1783 word_7209A0_intercepts_ys_plus_ys[2 * v22] = a1->pYInterceptDisplacements[v22] + LOWORD((*a4a)[a1->pVertexIDs[v22]].y); | |
1784 word_720A70_intercepts_xs_plus_xs[2 * v22 + 1] = a1->pXInterceptDisplacements[v22 + 1] + LOWORD((*a4a)[a1->pVertexIDs[v22 + 1]].x); | |
1785 word_7209A0_intercepts_ys_plus_ys[v5 + 1] = v6 = a1->pYInterceptDisplacements[v22 + 1] + LOWORD((*a4a)[a1->pVertexIDs[v22 + 1]].y); | |
1786 ++v22; | |
1787 } | |
1788 while ( v22 < a1->uNumVertices ); | |
1789 } | |
1790 } | |
1791 else | |
1792 { | |
1793 if ( BYTE1(v4) & 2 ) | |
1794 { | |
1795 v23 = (signed __int16)a3; | |
1796 v24 = a4; | |
1797 if ( a1->uNumVertices ) | |
1798 { | |
1799 a4b = &pOutdoor->pBModels[a2].pVertices.pVertices; | |
1800 do | |
1801 { | |
1802 v7 = 2 * v22; | |
1803 word_720A70_intercepts_xs_plus_xs[2 * v22] = a1->pXInterceptDisplacements[v22] + LOWORD((*a4b)[a1->pVertexIDs[v22]].x); | |
1804 word_7209A0_intercepts_ys_plus_ys[2 * v22] = a1->pZInterceptDisplacements[v22] + LOWORD((*a4b)[a1->pVertexIDs[v22]].z); | |
1805 word_720A70_intercepts_xs_plus_xs[2 * v22 + 1] = a1->pXInterceptDisplacements[v22 + 1] + LOWORD((*a4b)[a1->pVertexIDs[v22 + 1]].x); | |
1806 word_7209A0_intercepts_ys_plus_ys[v7 + 1] = v8 = a1->pZInterceptDisplacements[v22 + 1] + LOWORD((*a4b)[a1->pVertexIDs[v22 + 1]].z); | |
1807 ++v22; | |
1808 } | |
1809 while ( v22 < a1->uNumVertices ); | |
1810 } | |
1811 } | |
1812 else | |
1813 { | |
1814 v23 = SHIWORD(a3); | |
1815 v24 = a4; | |
1816 if ( a1->uNumVertices ) | |
1817 { | |
1818 a4c = &pOutdoor->pBModels[a2].pVertices.pVertices; | |
1819 do | |
1820 { | |
1821 v9 = 2 * v22; | |
1822 word_720A70_intercepts_xs_plus_xs[2 * v22] = a1->pYInterceptDisplacements[v22] + LOWORD((*a4c)[a1->pVertexIDs[v22]].y); | |
1823 word_7209A0_intercepts_ys_plus_ys[2 * v22] = a1->pZInterceptDisplacements[v22] + LOWORD((*a4c)[a1->pVertexIDs[v22]].z); | |
1824 word_720A70_intercepts_xs_plus_xs[2 * v22 + 1] = a1->pYInterceptDisplacements[v22 + 1] + LOWORD((*a4c)[a1->pVertexIDs[v22 + 1]].y); | |
1825 word_7209A0_intercepts_ys_plus_ys[v9 + 1] = v10 = a1->pZInterceptDisplacements[v22 + 1] + LOWORD((*a4c)[a1->pVertexIDs[v22 + 1]].z); | |
1826 ++v22; | |
1827 } | |
1828 while ( v22 < a1->uNumVertices ); | |
1829 } | |
1830 } | |
1831 } | |
1832 v11 = 2 * a1->uNumVertices; | |
1833 a4d = 0; | |
1834 word_720A70_intercepts_xs_plus_xs[2 * a1->uNumVertices] = word_720A70_intercepts_xs_plus_xs[0]; | |
1835 word_7209A0_intercepts_ys_plus_ys[v11] = word_7209A0_intercepts_ys_plus_ys[0]; | |
1836 v21 = 0; | |
1837 v12 = word_7209A0_intercepts_ys_plus_ys[0] >= v24; | |
1838 if ( v11 <= 0 ) | |
1418 | 1839 return 0; |
0 | 1840 do |
1841 { | |
1842 if ( a4d >= 2 ) | |
1843 break; | |
1844 v13 = v21; | |
1845 v14 = word_7209A0_intercepts_ys_plus_ys[v21 + 1]; | |
1110 | 1846 if ( v12 ^ (v14 >= v24) ) |
0 | 1847 { |
1848 v15 = word_720A70_intercepts_xs_plus_xs[v13 + 1]; | |
1849 if ( v15 >= v23 ) | |
1850 v16 = 0; | |
1851 else | |
1852 v16 = 2; | |
1110 | 1853 v17 = v16 | (word_720A70_intercepts_xs_plus_xs[v13] < v23); |
0 | 1854 if ( v17 != 3 ) |
1855 { | |
1856 if ( !v17 | |
1857 || (v18 = v15 - word_720A70_intercepts_xs_plus_xs[v13], | |
1858 LODWORD(v19) = v18 << 16, | |
1859 HIDWORD(v19) = v18 >> 16, | |
1860 word_720A70_intercepts_xs_plus_xs[v13] | |
1861 + ((signed int)(((unsigned __int64)(v19 | |
1862 / (v14 - word_7209A0_intercepts_ys_plus_ys[v13]) | |
1863 * ((v24 - (signed int)word_7209A0_intercepts_ys_plus_ys[v13]) << 16)) >> 16) | |
1864 + 32768) >> 16) >= v23) ) | |
1865 ++a4d; | |
1866 } | |
1867 } | |
1868 ++v21; | |
1869 v12 = v14 >= v24; | |
1870 } | |
1871 while ( v21 < v11 ); | |
1872 result = 1; | |
1873 if ( a4d != 1 ) | |
1874 result = 0; | |
1875 return result; | |
1876 } | |
1877 | |
1878 //----- (00475D85) -------------------------------------------------------- | |
1879 bool __fastcall sub_475D85(Vec3_int_ *a1, Vec3_int_ *a2, int *a3, BLVFace *a4) | |
1880 { | |
1881 BLVFace *v4; // ebx@1 | |
1882 int v5; // ST24_4@2 | |
1883 int v6; // ST28_4@2 | |
1884 int v7; // edi@2 | |
1885 int v8; // eax@5 | |
1886 signed int v9; // esi@5 | |
1887 signed __int64 v10; // qtt@10 | |
1888 Vec3_int_ *v11; // esi@11 | |
1889 int v12; // ST14_4@11 | |
1890 Vec3_int_ *v14; // [sp+Ch] [bp-18h]@1 | |
1891 Vec3_int_ *v15; // [sp+14h] [bp-10h]@1 | |
1892 int v16; // [sp+18h] [bp-Ch]@2 | |
1893 int v17; // [sp+20h] [bp-4h]@10 | |
1894 int a4b; // [sp+30h] [bp+Ch]@2 | |
1895 int a4c; // [sp+30h] [bp+Ch]@9 | |
1896 signed int a4a; // [sp+30h] [bp+Ch]@10 | |
1897 | |
1898 v4 = a4; | |
1899 v15 = a2; | |
1900 v14 = a1; | |
1901 if ( BYTE3(a4->uAttributes) & 0x20 | |
1902 || (v5 = (unsigned __int64)(a2->x * (signed __int64)a4->pFacePlane_old.vNormal.x) >> 16, | |
1903 a4b = (unsigned __int64)(a2->y * (signed __int64)a4->pFacePlane_old.vNormal.y) >> 16, | |
1904 v6 = (unsigned __int64)(a2->z * (signed __int64)v4->pFacePlane_old.vNormal.z) >> 16, | |
1905 v7 = v5 + v6 + a4b, | |
1906 (v16 = v5 + v6 + a4b) == 0) | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
675
diff
changeset
|
1907 || v7 > 0 && !v4->Portal()) |
0 | 1908 return 0; |
1909 v8 = v4->pFacePlane_old.vNormal.z * a1->z; | |
1910 v9 = -(v4->pFacePlane_old.dist + v8 + a1->y * v4->pFacePlane_old.vNormal.y + a1->x * v4->pFacePlane_old.vNormal.x); | |
1911 if ( v7 <= 0 ) | |
1912 { | |
1913 if ( v4->pFacePlane_old.dist + v8 + a1->y * v4->pFacePlane_old.vNormal.y + a1->x * v4->pFacePlane_old.vNormal.x < 0 ) | |
1914 return 0; | |
1915 } | |
1916 else | |
1917 { | |
1918 if ( v9 < 0 ) | |
1919 return 0; | |
1920 } | |
1921 a4c = abs(-(v4->pFacePlane_old.dist + v8 + a1->y * v4->pFacePlane_old.vNormal.y + a1->x * v4->pFacePlane_old.vNormal.x)) >> 14; | |
1922 if ( a4c > abs(v7) | |
1923 || (LODWORD(v10) = v9 << 16, HIDWORD(v10) = v9 >> 16, a4a = v10 / v16, v17 = v10 / v16, v17 > *a3 << 16) | |
1924 || (v11 = v14, | |
1925 LOWORD(v12) = LOWORD(v14->x) | |
1926 + (((unsigned int)((unsigned __int64)(v17 * (signed __int64)v15->x) >> 16) + 32768) >> 16), | |
1927 HIWORD(v12) = LOWORD(v11->y) | |
1928 + (((unsigned int)((unsigned __int64)(v17 * (signed __int64)v15->y) >> 16) + 32768) >> 16), | |
1929 !sub_475665( | |
1930 v4, | |
1931 v12, | |
1932 LOWORD(v11->z) + (((unsigned int)((unsigned __int64)(v17 * (signed __int64)v15->z) >> 16) + 32768) >> 16))) ) | |
1933 return 0; | |
1934 *a3 = a4a >> 16; | |
1935 return 1; | |
1936 } | |
1937 | |
1938 //----- (00475F30) -------------------------------------------------------- | |
1939 bool __fastcall sub_475F30(int *a1, BLVFace *a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9) | |
1940 { | |
1941 BLVFace *v9; // ebx@1 | |
1942 int v10; // ST20_4@2 | |
1943 int v11; // ST28_4@2 | |
1944 int v12; // ST24_4@2 | |
1945 char v13; // zf@2 | |
1946 int v14; // edi@2 | |
1947 int v15; // eax@5 | |
1948 signed int v16; // esi@5 | |
1949 int v17; // ST20_4@9 | |
1950 signed __int64 v18; // qtt@10 | |
1951 int v19; // ST14_4@11 | |
1952 int *v21; // [sp+14h] [bp-10h]@1 | |
1953 int v22; // [sp+1Ch] [bp-8h]@2 | |
1954 int v23; // [sp+1Ch] [bp-8h]@10 | |
1955 signed int v24; // [sp+20h] [bp-4h]@10 | |
1956 | |
1957 v9 = a2; | |
1958 v21 = a1; | |
1959 if ( BYTE3(a2->uAttributes) & 0x20 | |
1960 || (v10 = (unsigned __int64)(a6 * (signed __int64)a2->pFacePlane_old.vNormal.x) >> 16, | |
1961 v11 = (unsigned __int64)(a7 * (signed __int64)a2->pFacePlane_old.vNormal.y) >> 16, | |
1962 v12 = (unsigned __int64)(a8 * (signed __int64)a2->pFacePlane_old.vNormal.z) >> 16, | |
1963 v13 = v10 + v12 + v11 == 0, | |
1964 v14 = v10 + v12 + v11, | |
1965 v22 = v10 + v12 + v11, | |
1966 v13) | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
675
diff
changeset
|
1967 || v14 > 0 && !a2->Portal()) |
0 | 1968 return 0; |
1969 v15 = a4 * a2->pFacePlane_old.vNormal.y; | |
1970 v16 = -(a2->pFacePlane_old.dist + v15 + a3 * a2->pFacePlane_old.vNormal.x + a5 * a2->pFacePlane_old.vNormal.z); | |
1971 if ( v14 <= 0 ) | |
1972 { | |
1973 if ( a2->pFacePlane_old.dist + v15 + a3 * a2->pFacePlane_old.vNormal.x + a5 * a2->pFacePlane_old.vNormal.z < 0 ) | |
1974 return 0; | |
1975 } | |
1976 else | |
1977 { | |
1978 if ( v16 < 0 ) | |
1979 return 0; | |
1980 } | |
1981 v17 = abs(-(a2->pFacePlane_old.dist + v15 + a3 * a2->pFacePlane_old.vNormal.x + a5 * a2->pFacePlane_old.vNormal.z)) >> 14; | |
1982 if ( v17 > abs(v14) | |
1983 || (LODWORD(v18) = v16 << 16, HIDWORD(v18) = v16 >> 16, v24 = v18 / v22, v23 = v18 / v22, v23 > *v21 << 16) | |
1984 || (LOWORD(v19) = a3 + (((unsigned int)((unsigned __int64)(v23 * (signed __int64)a6) >> 16) + 32768) >> 16), | |
1985 HIWORD(v19) = a4 + (((unsigned int)((unsigned __int64)(v23 * (signed __int64)a7) >> 16) + 32768) >> 16), | |
1986 !sub_4759C9( | |
1987 v9, | |
1988 a9, | |
1989 v19, | |
1990 a5 + (((unsigned int)((unsigned __int64)(v23 * (signed __int64)a8) >> 16) + 32768) >> 16))) ) | |
1991 return 0; | |
1992 *v21 = v24 >> 16; | |
1993 return 1; | |
1994 } | |
1995 | |
1996 //----- (004760D5) -------------------------------------------------------- | |
1997 PartyAction ActionQueue::Next() | |
1998 { | |
1999 if (!uNumActions) | |
2000 return PARTY_INVALID; | |
2001 | |
1980 | 2002 PartyAction result = pActions[0]; |
0 | 2003 for (unsigned int i = 0; i < uNumActions - 1; ++i) |
2004 pActions[i] = pActions[i + 1]; | |
2005 --uNumActions; | |
2006 | |
2007 return result; | |
2008 } | |
2009 | |
2010 //----- (004775ED) -------------------------------------------------------- | |
2011 int stru6_stru1_indoor_sw_billboard::_4775ED(float a2) | |
2012 { | |
2013 char *v2; // edi@1 | |
2014 int v3; // eax@1 | |
2015 char *v4; // edx@2 | |
2016 char *v5; // esi@3 | |
2017 double v6; // st7@6 | |
2018 signed __int64 v7; // ST84_8@6 | |
2019 double v8; // ST0C_8@6 | |
2020 int v9; // esi@6 | |
2021 double v10; // ST44_8@6 | |
2022 int v11; // ecx@6 | |
2023 double v12; // ST34_8@6 | |
2024 int v13; // ecx@6 | |
2025 double v14; // ST14_8@6 | |
2026 double v15; // st7@8 | |
2027 unsigned int v16; // ecx@8 | |
2028 signed __int64 v17; // ST64_8@8 | |
2029 double v18; // ST24_8@8 | |
2030 int v19; // edi@8 | |
2031 double v20; // ST3C_8@8 | |
2032 int v21; // ecx@8 | |
2033 double v22; // ST2C_8@8 | |
2034 int v23; // ST9C_4@8 | |
2035 double v24; // ST1C_8@8 | |
2036 int *v25; // edi@8 | |
2037 int v26; // esi@8 | |
2038 int *v27; // edi@10 | |
2039 int v28; // esi@10 | |
2040 int result; // eax@12 | |
2041 __int64 v30; // [sp+A8h] [bp-30h]@8 | |
2042 float v31; // [sp+B0h] [bp-28h]@6 | |
2043 float v32; // [sp+B4h] [bp-24h]@6 | |
2044 int v33; // [sp+B8h] [bp-20h]@6 | |
2045 int v34; // [sp+BCh] [bp-1Ch]@2 | |
2046 stru6_stru1_indoor_sw_billboard *v35; // [sp+C0h] [bp-18h]@1 | |
2047 float v36; // [sp+C4h] [bp-14h]@6 | |
2048 int v37; // [sp+C8h] [bp-10h]@6 | |
2049 int v38; // [sp+CCh] [bp-Ch]@1 | |
2050 float v39; // [sp+D0h] [bp-8h]@6 | |
2051 int *v40; // [sp+D4h] [bp-4h]@2 | |
2052 | |
1390 | 2053 v2 = (char *)&this->field_64[4 * this->uNumVertices]; |
0 | 2054 v38 = 0; |
1390 | 2055 *(int *)v2 = this->field_64[0]; |
0 | 2056 v2 += 4; |
1390 | 2057 *(int *)v2 = this->field_64[1]; |
0 | 2058 v2 += 4; |
1390 | 2059 *(int *)v2 = this->field_64[2]; |
2060 *((int *)v2 + 1) = this->field_64[3]; | |
2061 v3 = this->uNumVertices; | |
0 | 2062 v35 = this; |
2063 if ( v3 > 0 ) | |
2064 { | |
1390 | 2065 v40 = &this->field_64[20]; |
2066 v4 = (char *)&this->field_64[3] + 3; | |
0 | 2067 v34 = v3; |
2068 while ( 1 ) | |
2069 { | |
2070 v5 = v4 - 15; | |
2071 if ( *(float *)(v4 - 15) <= (double)a2 && *(float *)(v4 + 1) <= (double)a2 ) | |
1418 | 2072 { |
2073 v4 += 16; | |
2074 --v34; | |
2075 if ( !v34 ) | |
2076 return this->uNumVertices = v38; | |
2077 continue; | |
2078 } | |
0 | 2079 if ( *(float *)v5 <= (double)a2 ) |
1418 | 2080 { |
2081 v6 = (a2 - *(float *)v5) / (*(float *)(v4 + 1) - *(float *)v5); | |
2082 v7 = (unsigned __int8)v4[16] - (unsigned int)(unsigned __int8)*v4; | |
2083 v36 = v6; | |
2084 v31 = (*(float *)(v4 + 5) - *(float *)(v4 - 11)) * v6 + *(float *)(v4 - 11); | |
2085 v32 = (*(float *)(v4 + 9) - *(float *)(v4 - 7)) * v6 + *(float *)(v4 - 7); | |
2086 *(float *)&v37 = (double)v7 * v6; | |
2087 v8 = *(float *)&v37 + 6.7553994e15; | |
2088 v9 = (unsigned __int8)*v4; | |
2089 *(float *)&v37 = (double)((unsigned __int8)v4[15] - (unsigned int)(unsigned __int8)*(v4 - 1)) * v36; | |
2090 v10 = *(float *)&v37 + 6.7553994e15; | |
2091 v11 = (unsigned __int8)*(v4 - 2); | |
2092 v37 = LODWORD(v10) + (unsigned __int8)*(v4 - 1); | |
2093 v39 = (double)((unsigned int)(unsigned __int8)v4[14] - v11) * v36; | |
2094 v12 = v39 + 6.7553994e15; | |
2095 v13 = LODWORD(v12) + (unsigned __int8)*(v4 - 2); | |
2096 v39 = (double)((*(int *)(v4 + 13) & 0xFF) - (*(int *)(v4 - 3) & 0xFFu)) * v36; | |
2097 v14 = v39 + 6.7553994e15; | |
2098 v33 = (LODWORD(v14) + (*(int *)(v4 - 3) & 0xFF)) | ((v13 | ((v37 | ((LODWORD(v8) + v9) << 8)) << 8)) << 8); | |
2099 //this = v35; | |
2100 v5 = (char *)&v30 + 4; | |
2101 } | |
2102 else if ( *(float *)(v4 + 1) <= (double)a2 ) | |
0 | 2103 { |
2104 v15 = (a2 - *(float *)v5) / (*(float *)(v4 + 1) - *(float *)v5); | |
2105 v16 = (unsigned __int8)*v4; | |
2106 HIDWORD(v30) = LODWORD(a2); | |
2107 v17 = (unsigned __int8)v4[16] - v16; | |
2108 v36 = v15; | |
2109 v31 = (*(float *)(v4 + 5) - *(float *)(v4 - 11)) * v15 + *(float *)(v4 - 11); | |
2110 v32 = (*(float *)(v4 + 9) - *(float *)(v4 - 7)) * v15 + *(float *)(v4 - 7); | |
2111 v39 = (double)v17 * v15; | |
2112 v18 = v39 + 6.7553994e15; | |
2113 v19 = (unsigned __int8)*v4; | |
2114 v39 = (double)((unsigned __int8)v4[15] - (unsigned int)(unsigned __int8)*(v4 - 1)) * v36; | |
2115 v20 = v39 + 6.7553994e15; | |
2116 v21 = (unsigned __int8)*(v4 - 2); | |
2117 v37 = LODWORD(v20) + (unsigned __int8)*(v4 - 1); | |
2118 v39 = (double)((unsigned int)(unsigned __int8)v4[14] - v21) * v36; | |
2119 v22 = v39 + 6.7553994e15; | |
2120 v23 = LODWORD(v22) + (unsigned __int8)*(v4 - 2); | |
2121 v39 = (double)((*(int *)(v4 + 13) & 0xFF) - (*(int *)(v4 - 3) & 0xFFu)) * v36; | |
2122 v24 = v39 + 6.7553994e15; | |
2123 v33 = (LODWORD(v24) + (*(int *)(v4 - 3) & 0xFF)) | ((v23 | ((v37 | ((LODWORD(v18) + v19) << 8)) << 8)) << 8); | |
2124 v25 = v40; | |
2125 *v40 = *(int *)v5; | |
2126 v26 = (int)(v5 + 4); | |
2127 ++v25; | |
2128 *v25 = *(int *)v26; | |
2129 v26 += 4; | |
2130 ++v25; | |
2131 ++v38; | |
2132 v40 += 4; | |
2133 *v25 = *(int *)v26; | |
2134 v25[1] = *(int *)(v26 + 4); | |
1418 | 2135 v5 = (char *)&v30 + 4; |
0 | 2136 } |
2137 v27 = v40; | |
2138 ++v38; | |
2139 *v40 = *(int *)v5; | |
2140 v28 = (int)(v5 + 4); | |
2141 ++v27; | |
2142 *v27 = *(int *)v28; | |
2143 v28 += 4; | |
2144 ++v27; | |
2145 v40 += 4; | |
2146 *v27 = *(int *)v28; | |
2147 v27[1] = *(int *)(v28 + 4); | |
2148 v4 += 16; | |
2149 --v34; | |
2150 if ( !v34 ) | |
1418 | 2151 return this->uNumVertices = v38; |
0 | 2152 } |
1418 | 2153 } |
1390 | 2154 return this->uNumVertices = v38; |
0 | 2155 } |
2156 | |
2157 //----- (00477927) -------------------------------------------------------- | |
2158 int stru6_stru1_indoor_sw_billboard::_477927(float a2) | |
2159 { | |
2160 char *v2; // edi@1 | |
2161 int v3; // eax@1 | |
2162 char *v4; // edx@2 | |
2163 char *v5; // esi@3 | |
2164 double v6; // st7@6 | |
2165 signed __int64 v7; // ST84_8@6 | |
2166 double v8; // ST0C_8@6 | |
2167 int v9; // esi@6 | |
2168 double v10; // ST44_8@6 | |
2169 int v11; // ecx@6 | |
2170 double v12; // ST34_8@6 | |
2171 int v13; // ecx@6 | |
2172 double v14; // ST14_8@6 | |
2173 double v15; // st7@8 | |
2174 unsigned int v16; // ecx@8 | |
2175 signed __int64 v17; // ST64_8@8 | |
2176 double v18; // ST24_8@8 | |
2177 int v19; // edi@8 | |
2178 double v20; // ST3C_8@8 | |
2179 int v21; // ecx@8 | |
2180 double v22; // ST2C_8@8 | |
2181 int v23; // ST9C_4@8 | |
2182 double v24; // ST1C_8@8 | |
2183 int *v25; // edi@8 | |
2184 int v26; // esi@8 | |
2185 int *v27; // edi@10 | |
2186 int v28; // esi@10 | |
2187 int result; // eax@12 | |
2188 __int64 v30; // [sp+A8h] [bp-30h]@8 | |
2189 float v31; // [sp+B0h] [bp-28h]@6 | |
2190 float v32; // [sp+B4h] [bp-24h]@6 | |
2191 int v33; // [sp+B8h] [bp-20h]@6 | |
2192 int v34; // [sp+BCh] [bp-1Ch]@2 | |
2193 stru6_stru1_indoor_sw_billboard *v35; // [sp+C0h] [bp-18h]@1 | |
2194 float v36; // [sp+C4h] [bp-14h]@6 | |
2195 int v37; // [sp+C8h] [bp-10h]@6 | |
2196 int v38; // [sp+CCh] [bp-Ch]@1 | |
2197 float v39; // [sp+D0h] [bp-8h]@6 | |
2198 int *v40; // [sp+D4h] [bp-4h]@2 | |
2199 | |
1390 | 2200 v2 = (char *)&this->field_64[4 * this->uNumVertices]; |
0 | 2201 v38 = 0; |
1390 | 2202 *(int *)v2 = this->field_64[0]; |
0 | 2203 v2 += 4; |
1390 | 2204 *(int *)v2 = this->field_64[1]; |
0 | 2205 v2 += 4; |
1390 | 2206 *(int *)v2 = this->field_64[2]; |
2207 *((int *)v2 + 1) = this->field_64[3]; | |
2208 v3 = this->uNumVertices; | |
0 | 2209 v35 = this; |
2210 if ( v3 > 0 ) | |
2211 { | |
1390 | 2212 v40 = &this->field_64[20]; |
2213 v4 = (char *)&this->field_64[3] + 3; | |
0 | 2214 v34 = v3; |
2215 while ( 1 ) | |
2216 { | |
2217 v5 = v4 - 15; | |
2218 if ( *(float *)(v4 - 15) >= (double)a2 && *(float *)(v4 + 1) >= (double)a2 ) | |
1418 | 2219 { |
2220 v4 += 16; | |
2221 --v34; | |
2222 if ( !v34 ) | |
2223 return this->uNumVertices = v38; | |
2224 continue; | |
2225 } | |
0 | 2226 if ( *(float *)v5 >= (double)a2 ) |
1418 | 2227 { |
2228 v6 = (a2 - *(float *)v5) / (*(float *)(v4 + 1) - *(float *)v5); | |
2229 v7 = (unsigned __int8)v4[16] - (unsigned int)(unsigned __int8)*v4; | |
2230 v36 = v6; | |
2231 v31 = (*(float *)(v4 + 5) - *(float *)(v4 - 11)) * v6 + *(float *)(v4 - 11); | |
2232 v32 = (*(float *)(v4 + 9) - *(float *)(v4 - 7)) * v6 + *(float *)(v4 - 7); | |
2233 *(float *)&v37 = (double)v7 * v6; | |
2234 v8 = *(float *)&v37 + 6.7553994e15; | |
2235 v9 = (unsigned __int8)*v4; | |
2236 *(float *)&v37 = (double)((unsigned __int8)v4[15] - (unsigned int)(unsigned __int8)*(v4 - 1)) * v36; | |
2237 v10 = *(float *)&v37 + 6.7553994e15; | |
2238 v11 = (unsigned __int8)*(v4 - 2); | |
2239 v37 = LODWORD(v10) + (unsigned __int8)*(v4 - 1); | |
2240 v39 = (double)((unsigned int)(unsigned __int8)v4[14] - v11) * v36; | |
2241 v12 = v39 + 6.7553994e15; | |
2242 v13 = LODWORD(v12) + (unsigned __int8)*(v4 - 2); | |
2243 v39 = (double)((*(int *)(v4 + 13) & 0xFF) - (*(int *)(v4 - 3) & 0xFFu)) * v36; | |
2244 v14 = v39 + 6.7553994e15; | |
2245 v33 = (LODWORD(v14) + (*(int *)(v4 - 3) & 0xFF)) | ((v13 | ((v37 | ((LODWORD(v8) + v9) << 8)) << 8)) << 8); | |
2246 //this = v35; | |
2247 v5 = (char *)&v30 + 4; | |
2248 } | |
2249 else if ( *(float *)(v4 + 1) >= (double)a2 ) | |
0 | 2250 { |
2251 v15 = (a2 - *(float *)v5) / (*(float *)(v4 + 1) - *(float *)v5); | |
2252 v16 = (unsigned __int8)*v4; | |
2253 HIDWORD(v30) = LODWORD(a2); | |
2254 v17 = (unsigned __int8)v4[16] - v16; | |
2255 v36 = v15; | |
2256 v31 = (*(float *)(v4 + 5) - *(float *)(v4 - 11)) * v15 + *(float *)(v4 - 11); | |
2257 v32 = (*(float *)(v4 + 9) - *(float *)(v4 - 7)) * v15 + *(float *)(v4 - 7); | |
2258 v39 = (double)v17 * v15; | |
2259 v18 = v39 + 6.7553994e15; | |
2260 v19 = (unsigned __int8)*v4; | |
2261 v39 = (double)((unsigned __int8)v4[15] - (unsigned int)(unsigned __int8)*(v4 - 1)) * v36; | |
2262 v20 = v39 + 6.7553994e15; | |
2263 v21 = (unsigned __int8)*(v4 - 2); | |
2264 v37 = LODWORD(v20) + (unsigned __int8)*(v4 - 1); | |
2265 v39 = (double)((unsigned int)(unsigned __int8)v4[14] - v21) * v36; | |
2266 v22 = v39 + 6.7553994e15; | |
2267 v23 = LODWORD(v22) + (unsigned __int8)*(v4 - 2); | |
2268 v39 = (double)((*(int *)(v4 + 13) & 0xFF) - (*(int *)(v4 - 3) & 0xFFu)) * v36; | |
2269 v24 = v39 + 6.7553994e15; | |
2270 v33 = (LODWORD(v24) + (*(int *)(v4 - 3) & 0xFF)) | ((v23 | ((v37 | ((LODWORD(v18) + v19) << 8)) << 8)) << 8); | |
2271 v25 = v40; | |
2272 *v40 = *(int *)v5; | |
2273 v26 = (int)(v5 + 4); | |
2274 ++v25; | |
2275 *v25 = *(int *)v26; | |
2276 v26 += 4; | |
2277 ++v25; | |
2278 ++v38; | |
2279 v40 += 4; | |
2280 *v25 = *(int *)v26; | |
2281 v25[1] = *(int *)(v26 + 4); | |
1418 | 2282 v5 = (char *)&v30 + 4; |
0 | 2283 } |
2284 v27 = v40; | |
2285 ++v38; | |
2286 *v40 = *(int *)v5; | |
2287 v28 = (int)(v5 + 4); | |
2288 ++v27; | |
2289 *v27 = *(int *)v28; | |
2290 v28 += 4; | |
2291 ++v27; | |
2292 v40 += 4; | |
2293 *v27 = *(int *)v28; | |
2294 v27[1] = *(int *)(v28 + 4); | |
2295 v4 += 16; | |
2296 --v34; | |
2297 if ( !v34 ) | |
1418 | 2298 return this->uNumVertices = v38; |
0 | 2299 } |
1418 | 2300 } |
1390 | 2301 return this->uNumVertices = v38; |
0 | 2302 } |
2303 | |
2304 //----- (00477C61) -------------------------------------------------------- | |
2305 int stru6_stru1_indoor_sw_billboard::sub_477C61() | |
2306 { | |
998 | 2307 //stru6_stru1_indoor_sw_billboard *v1; // ebx@1 |
0 | 2308 int v2; // ecx@2 |
2309 int v3; // eax@3 | |
2310 double v4; // st7@4 | |
2311 double v5; // st7@5 | |
2312 double v6; // st6@5 | |
2313 double v7; // st5@6 | |
2314 float v8; // ST30_4@8 | |
2315 float v9; // ST24_4@8 | |
2316 double v10; // st7@8 | |
2317 double v11; // st6@8 | |
2318 double v12; // st5@8 | |
2319 float v13; // ST24_4@13 | |
2320 int v14; // esi@13 | |
2321 char *v15; // esi@15 | |
1638
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
2322 //signed int v16; // eax@16 |
0 | 2323 __int16 v17; // fps@16 |
2324 unsigned __int8 v18; // c2@16 | |
2325 unsigned __int8 v19; // c3@16 | |
2326 double v20; // st6@16 | |
2327 float v21; // ST18_4@17 | |
2328 float v22; // ST2C_4@17 | |
2329 float v23; // ST34_4@17 | |
2330 float v24; // ST24_4@17 | |
2331 double v25; // st7@17 | |
2332 double v26; // st6@17 | |
2333 float v27; // ST34_4@18 | |
2334 float v28; // ST30_4@18 | |
2335 int v29; // eax@19 | |
2336 signed int v31; // [sp+8h] [bp-28h]@15 | |
2337 float v32; // [sp+Ch] [bp-24h]@16 | |
2338 float v33; // [sp+14h] [bp-1Ch]@16 | |
2339 float v34; // [sp+18h] [bp-18h]@16 | |
2340 float v35; // [sp+1Ch] [bp-14h]@17 | |
2341 float v36; // [sp+20h] [bp-10h]@4 | |
2342 float v37; // [sp+24h] [bp-Ch]@4 | |
2343 float v38; // [sp+24h] [bp-Ch]@16 | |
2344 float v39; // [sp+28h] [bp-8h]@9 | |
2345 float v40; // [sp+28h] [bp-8h]@16 | |
2346 float v41; // [sp+2Ch] [bp-4h]@6 | |
2347 float v42; // [sp+2Ch] [bp-4h]@9 | |
2348 | |
998 | 2349 //v1 = this; |
0 | 2350 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) |
2351 { | |
2352 v2 = 0; | |
1390 | 2353 if ( this->uNumVertices > 0 ) |
998 | 2354 { |
2355 v3 = (int)&this->field_14[1]; | |
0 | 2356 do |
2357 { | |
2358 v4 = *(float *)(v3 - 4); | |
2359 LODWORD(v37) = *(int *)v3; | |
2360 LODWORD(v36) = *(int *)(v3 + 4); | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2361 if (pGame->pIndoorCameraD3D->sRotationX) |
0 | 2362 { |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2363 v5 = v4 - (double)pGame->pIndoorCameraD3D->vPartyPos.x; |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2364 v6 = v37 - (double)pGame->pIndoorCameraD3D->vPartyPos.y; |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2365 //if ( pRenderer->pRenderD3D ) |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2366 //{ |
1642 | 2367 v41 = pGame->pIndoorCameraD3D->fRotationYSine * v6 + pGame->pIndoorCameraD3D->fRotationYCosine * v5; |
2368 v7 = pGame->pIndoorCameraD3D->fRotationYSine * v5 - pGame->pIndoorCameraD3D->fRotationYCosine * v6; | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2369 /*} |
0 | 2370 else |
2371 { | |
2372 v41 = pBLVRenderParams->fCosineY * v5 - pBLVRenderParams->fSineY * v6; | |
2373 v7 = pBLVRenderParams->fSineY * v5 + pBLVRenderParams->fCosineY * v6; | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2374 }*/ |
0 | 2375 v8 = v7; |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2376 v9 = v36 - (double)pGame->pIndoorCameraD3D->vPartyPos.z; |
1642 | 2377 v10 = pGame->pIndoorCameraD3D->fRotationXCosine * v41 - pGame->pIndoorCameraD3D->fRotationXSine * v9; |
0 | 2378 v11 = v8; |
1642 | 2379 v12 = pGame->pIndoorCameraD3D->fRotationXCosine * v9 + pGame->pIndoorCameraD3D->fRotationXSine * v41; |
0 | 2380 } |
2381 else | |
2382 { | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2383 v42 = v4 - (double)pGame->pIndoorCameraD3D->vPartyPos.x; |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2384 v39 = v37 - (double)pGame->pIndoorCameraD3D->vPartyPos.y; |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2385 //if ( pRenderer->pRenderD3D ) |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2386 //{ |
1642 | 2387 v10 = pGame->pIndoorCameraD3D->fRotationYSine * v39 + pGame->pIndoorCameraD3D->fRotationYCosine * v42; |
2388 v11 = pGame->pIndoorCameraD3D->fRotationYSine * v42 - pGame->pIndoorCameraD3D->fRotationYCosine * v39; | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2389 /*} |
0 | 2390 else |
2391 { | |
2392 v10 = pBLVRenderParams->fCosineY * v42 - pBLVRenderParams->fSineY * v39; | |
2393 v11 = pBLVRenderParams->fSineY * v42 + pBLVRenderParams->fCosineY * v39; | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2394 }*/ |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2395 v12 = v36 - (double)pGame->pIndoorCameraD3D->vPartyPos.z; |
0 | 2396 } |
2397 v13 = v12; | |
2398 ++v2; | |
2399 *(int *)(v3 + 84) = LODWORD(v13); | |
2400 v14 = *(int *)(v3 + 8); | |
2401 *(float *)(v3 + 76) = v10; | |
2402 *(int *)(v3 + 88) = v14; | |
2403 *(float *)(v3 + 80) = v11; | |
2404 v3 += 16; | |
2405 } | |
1390 | 2406 while ( v2 < this->uNumVertices ); |
0 | 2407 } |
2408 } | |
2409 else | |
2410 { | |
2411 v15 = (char *)&this->field_14[1]; | |
2412 v31 = 3; | |
2413 do | |
2414 { | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2415 v40 = (double)stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX) * 0.0000152587890625; |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2416 v32 = (double)stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX) * 0.0000152587890625; |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2417 v34 = (double)stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationY) * 0.0000152587890625; |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2418 v33 = (double)stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationY) * 0.0000152587890625; |
1638
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
2419 //v16 = stru_5C6E00->Sin(pODMRenderParams->rotation_y); |
0 | 2420 LODWORD(v38) = *(int *)v15; |
2421 //UNDEF(v17); | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2422 v20 = *((float *)v15 - 1) - (double)pGame->pIndoorCameraD3D->vPartyPos.x; |
1090 | 2423 //if ( v19 | v18 ) |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2424 if (pGame->pIndoorCameraD3D->vPartyPos.x == 0) |
0 | 2425 { |
2426 v27 = v20; | |
2427 LODWORD(v35) = *((int *)v15 + 1); | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2428 v28 = v38 - (double)pGame->pIndoorCameraD3D->vPartyPos.y; |
0 | 2429 v25 = v33 * v28 + v34 * v27; |
2430 v26 = v34 * v28 - v33 * v27; | |
2431 } | |
2432 else | |
2433 { | |
2434 v21 = v20; | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2435 v22 = v38 - (double)pGame->pIndoorCameraD3D->vPartyPos.y; |
0 | 2436 v23 = v33 * v22 + v34 * v21; |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2437 v24 = *((float *)v15 + 1) - (double)pGame->pIndoorCameraD3D->vPartyPos.z; |
0 | 2438 v25 = v32 * v24 + v40 * v23; |
2439 v26 = v34 * v22 - v33 * v21; | |
2440 v35 = v40 * v24 - v32 * v23; | |
2441 } | |
2442 *((int *)v15 + 21) = LODWORD(v35); | |
2443 v29 = *((int *)v15 + 2); | |
2444 *((float *)v15 + 19) = v25; | |
2445 *((int *)v15 + 22) = v29; | |
2446 *((float *)v15 + 20) = v26; | |
2447 v15 += 16; | |
2448 --v31; | |
2449 } | |
2450 while ( v31 ); | |
2451 } | |
1390 | 2452 this->uNumVertices = 3; |
0 | 2453 return 1; |
2454 } | |
2455 | |
2456 //----- (00477F63) -------------------------------------------------------- | |
2457 bool stru6_stru1_indoor_sw_billboard::sub_477F63() | |
2458 { | |
2459 signed int v1; // ebx@1 | |
2460 stru6_stru1_indoor_sw_billboard *v2; // esi@1 | |
2461 double v3; // st7@2 | |
2462 int v4; // edx@4 | |
2463 char *v5; // ecx@5 | |
2464 int v6; // edi@5 | |
2465 float v7; // ST08_4@13 | |
2466 signed int v9; // [sp+Ch] [bp-8h]@1 | |
2467 float v10; // [sp+10h] [bp-4h]@2 | |
2468 | |
1980 | 2469 stru6_stru1_indoor_sw_billboard* a1 = this; |
0 | 2470 |
2471 v1 = 0; | |
2472 v2 = a1; | |
2473 v9 = 0; | |
2474 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) | |
2475 { | |
2476 v10 = 16192.0; | |
1641 | 2477 v3 = (double)pBLVRenderParams->fov_rad_fixpoint * 0.000015258789; |
0 | 2478 } |
2479 else | |
2480 { | |
1637 | 2481 v10 = (double)pODMRenderParams->shading_dist_mist; |
0 | 2482 v3 = 8.0; |
2483 } | |
1390 | 2484 v4 = a1->uNumVertices; |
0 | 2485 if ( v4 <= 0 ) |
1418 | 2486 { |
2487 memcpy(&v2->field_14[40], &v2->field_14[20], 16 * v4); | |
2488 return v2->uNumVertices != 0; | |
2489 } | |
0 | 2490 v5 = (char *)&a1->field_14[20]; |
2491 v6 = v4; | |
2492 do | |
2493 { | |
2494 if ( v3 >= *(float *)v5 || *(float *)v5 >= (double)v10 ) | |
2495 { | |
2496 if ( v3 < *(float *)v5 ) | |
2497 v9 = 1; | |
2498 else | |
2499 v1 = 1; | |
2500 } | |
2501 v5 += 16; | |
2502 --v6; | |
2503 } | |
2504 while ( v6 ); | |
2505 if ( !v1 ) | |
2506 { | |
2507 if ( v9 ) | |
2508 { | |
2509 v2->_477927(v10); | |
1390 | 2510 return v2->uNumVertices != 0; |
0 | 2511 } |
2512 memcpy(&v2->field_14[40], &v2->field_14[20], 16 * v4); | |
1390 | 2513 return v2->uNumVertices != 0; |
0 | 2514 } |
2515 v7 = v3; | |
2516 _4775ED(v7); | |
1390 | 2517 return v2->uNumVertices != 0; |
0 | 2518 } |
2519 | |
2520 //----- (0047802A) -------------------------------------------------------- | |
2521 int stru6_stru1_indoor_sw_billboard::sub_47802A() | |
2522 { | |
2523 double v6; // st7@4 | |
2524 double v12; // st7@16 | |
2525 signed int v16; // [sp+38h] [bp-Ch]@1 | |
2526 int a6; // [sp+3Ch] [bp-8h]@5 | |
2527 int a5; // [sp+40h] [bp-4h]@5 | |
2528 | |
1980 | 2529 stru6_stru1_indoor_sw_billboard* a1 = this; |
0 | 2530 |
2531 v16 = 0; | |
2532 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) | |
2533 { | |
1390 | 2534 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
|
2535 { |
1641 | 2536 v6 = (double)pBLVRenderParams->fov_rad_fixpoint * 0.000015258789 / a1->field_B4[i*4]; |
1117
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
2537 if ( pRenderer->pRenderD3D ) |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
2538 { |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
2539 pGame->pIndoorCameraD3D->Project( |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
2540 round(a1->field_B4[i*4]), |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
2541 round(a1->field_B4[i*4+1]), |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
2542 round(a1->field_B4[i*4+2]), |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
2543 &a5, |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
2544 &a6); |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
2545 a1->field_B4[i*4+16] = (double)a5; |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
2546 a1->field_B4[i*4+17] = (double)a6; |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
2547 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
|
2548 } |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
2549 else |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
2550 { |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
2551 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
|
2552 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
|
2553 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
|
2554 } |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
2555 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
|
2556 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
|
2557 && (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
|
2558 && (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
|
2559 && (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
|
2560 v16 = 1; |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
2561 } |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
2562 } |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
2563 else |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
2564 { |
1390 | 2565 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
|
2566 { |
1637 | 2567 v12 = (double)pODMRenderParams->int_fov_rad / a1->field_B4[i*4]; |
1117
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
2568 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
|
2569 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
|
2570 *((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
|
2571 *((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
|
2572 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
|
2573 && (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
|
2574 && (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
|
2575 && (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
|
2576 v16 = 1; |
0 | 2577 } |
2578 } | |
2579 return v16; | |
2580 } | |
2581 | |
2582 // 73C84C: using guessed type char static_RenderBuildingsD3D_byte_73C84C_init_flag; | |
2583 | |
2584 //----- (00479089) -------------------------------------------------------- | |
323 | 2585 bool __fastcall IsBModelVisible(unsigned int uModelID, int *reachable) |
0 | 2586 { |
2587 BSPModel *v2; // eax@1 | |
2588 int v3; // edi@1 | |
2589 int v4; // ebx@1 | |
2590 int v5; // ST28_4@1 | |
2591 int v6; // ecx@1 | |
2592 int v7; // ebx@3 | |
2593 int v8; // eax@3 | |
2594 int v9; // eax@3 | |
323 | 2595 //int v10; // ebx@3 |
0 | 2596 signed int v11; // esi@6 |
2597 int v12; // esi@8 | |
2598 bool result; // eax@9 | |
323 | 2599 //unsigned int v14; // [sp+Ch] [bp-20h]@1 |
0 | 2600 int v15; // [sp+Ch] [bp-20h]@5 |
323 | 2601 //int *v16; // [sp+10h] [bp-1Ch]@1 |
0 | 2602 int v17; // [sp+1Ch] [bp-10h]@1 |
2603 int v18; // [sp+20h] [bp-Ch]@1 | |
2604 int v19; // [sp+20h] [bp-Ch]@3 | |
2605 int angle; // [sp+24h] [bp-8h]@1 | |
2606 int v21; // [sp+28h] [bp-4h]@1 | |
323 | 2607 //int v22; // [sp+28h] [bp-4h]@3 |
2608 | |
2609 //v16 = unused; | |
1637 | 2610 angle = (signed int)(pODMRenderParams->uCameraFovInDegrees << 11) / 360 >> 1; |
323 | 2611 //v14 = uModelID; |
0 | 2612 v2 = &pOutdoor->pBModels[uModelID]; |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2613 v3 = v2->vBoundingCenter.x - pGame->pIndoorCameraD3D->vPartyPos.x; |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2614 v4 = v2->vBoundingCenter.y - pGame->pIndoorCameraD3D->vPartyPos.y; |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2615 v5 = stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationY); |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2616 v21 = stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationY); |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2617 v18 = stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX); |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2618 stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX); |
0 | 2619 v6 = v5; |
2620 v17 = v3 * v5 + v4 * v21; | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2621 if (pGame->pIndoorCameraD3D->sRotationX) |
0 | 2622 v17 = (unsigned __int64)(v17 * (signed __int64)v18) >> 16; |
2623 v19 = v4 * v6 - v3 * v21; | |
2624 v7 = abs(v4); | |
2625 v8 = abs(v3); | |
322 | 2626 v9 = int_get_vector_length(v8, v7, 0); |
323 | 2627 //v10 = v14 * 188; |
2628 //v22 = v9; | |
2629 *reachable = false; | |
2630 if ( v9 < pOutdoor->pBModels[uModelID].sBoundingRadius + 256 ) | |
2631 *reachable = true; | |
2632 v15 = stru_5C6E00->Sin(angle); | |
0 | 2633 if ( v19 >= 0 ) |
323 | 2634 v11 = ((unsigned __int64)(v15 * (signed __int64)v17) >> 16) - ((unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)v19) >> 16); |
2635 else | |
2636 v11 = ((unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)v19) >> 16) + ((unsigned __int64)(v15 * (signed __int64)v17) >> 16); | |
0 | 2637 v12 = v11 >> 16; |
1637 | 2638 if ( v9 <= pODMRenderParams->shading_dist_mist + 2048 ) |
0 | 2639 { |
79 | 2640 //if ( abs(v12) > *(int *)((char *)&pOutdoor->pBModels->sBoundingRadius + v10) + 512 ) |
323 | 2641 if ( abs(v12) > pOutdoor->pBModels[uModelID].sBoundingRadius + 512 ) |
0 | 2642 { |
2643 result = v12 < 0; | |
2644 LOBYTE(result) = v12 >= 0; | |
323 | 2645 return result; |
2646 } | |
2647 else | |
2648 return true; | |
2649 } | |
2650 return false; | |
0 | 2651 } |
2652 | |
2653 //----- (00479295) -------------------------------------------------------- | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
2654 int Polygon::_479295() |
0 | 2655 { |
2656 ODMFace *v2; // esi@1 | |
2657 int v3; // ecx@4 | |
2658 int v4; // eax@4 | |
2659 int v5; // edx@4 | |
2660 int v6; // ST14_4@5 | |
2661 int v7; // ST04_4@5 | |
2662 stru149 *v8; // ecx@5 | |
2663 Vec3_int_ thisa; // [sp+Ch] [bp-10h]@8 | |
2664 int v11; // [sp+18h] [bp-4h]@4 | |
2665 | |
2666 v2 = this->pODMFace; | |
2667 if ( !v2->pFacePlane.vNormal.z ) | |
2668 { | |
2669 v3 = v2->pFacePlane.vNormal.x; | |
2670 v4 = -v2->pFacePlane.vNormal.y; | |
2671 v5 = 0; | |
2672 v11 = 65536; | |
1418 | 2673 } |
2674 else if ( (v2->pFacePlane.vNormal.x || v2->pFacePlane.vNormal.y) && abs(v2->pFacePlane.vNormal.z) < 59082 ) | |
0 | 2675 { |
2676 thisa.x = -v2->pFacePlane.vNormal.y; | |
2677 thisa.y = v2->pFacePlane.vNormal.x; | |
2678 thisa.z = 0; | |
2679 thisa.Normalize_float(); | |
2680 v4 = thisa.x; | |
2681 v3 = thisa.y; | |
1418 | 2682 v5 = 0; |
2683 v11 = 65536; | |
2684 } | |
2685 else | |
2686 { | |
2687 v3 = 0; | |
2688 v4 = 65536; | |
2689 v11 = 0; | |
2690 v5 = -65536; | |
2691 } | |
0 | 2692 v6 = v11; |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
2693 sTextureDeltaU = v2->sTextureDeltaU; |
0 | 2694 v7 = v3; |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
2695 v8 = ptr_38; |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
2696 sTextureDeltaV = v2->sTextureDeltaV; |
1544 | 2697 v8->_48616B_frustum_odm(v4, v7, 0, 0, v5, v6); |
0 | 2698 return 1; |
2699 } | |
2700 | |
2701 | |
168 | 2702 unsigned short *LoadTgaTexture(const wchar_t *filename, int *out_width = nullptr, int *out_height = nullptr) |
2703 { | |
2704 #pragma pack(push, 1) | |
2705 struct TGAHeader | |
2706 { | |
2707 unsigned char tgaSkip; | |
2708 unsigned char colourmaptype; // type of colour map 0=none, 1=has palette | |
2709 unsigned char tgaType; // type of image 0=none,1=indexed,2=rgb,3=grey,+8=rle packed | |
2710 | |
2711 short colourmapstart; // first colour map entry in palette | |
2712 short colourmaplength; // number of colours in palette | |
2713 char colourmapbits; // number of bits per palette entry 15,16,24,32 | |
2714 | |
2715 //unsigned char tgaDontCare2[9]; | |
2716 short xstart; // image x origin | |
2717 short ystart; // image y origin | |
2718 | |
2719 unsigned short tgaWidth; | |
2720 unsigned short tgaHeight; | |
2721 unsigned char tgaBPP; | |
2722 | |
2723 char descriptor; // image descriptor bits: 00vhaaaa | |
2724 // h horizontal flip | |
2725 // v vertical flip | |
2726 // a alpha bits | |
2727 }; | |
2728 #pragma pack(pop) | |
2729 | |
2730 if (out_width) | |
2731 *out_width = 0; | |
2732 if (out_height) | |
2733 *out_height = 0; | |
2734 | |
2735 DWORD w; | |
1980 | 2736 void* file = CreateFileW(filename, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr); |
168 | 2737 if (file == INVALID_HANDLE_VALUE) |
2738 return nullptr; | |
2739 | |
2740 TGAHeader header; | |
2741 ReadFile(file, &header, sizeof(header), &w, nullptr); | |
2742 SetFilePointer(file, header.tgaSkip, nullptr, FILE_CURRENT); | |
2743 | |
2744 if (header.tgaBPP != 24 || header.tgaType != 2) | |
2745 { | |
2746 CloseHandle(file); | |
2747 return nullptr; | |
2748 } | |
2749 | |
2750 int imgSize = header.tgaWidth * header.tgaHeight * 3; | |
1980 | 2751 unsigned char* pixels = new unsigned char[imgSize]; |
168 | 2752 ReadFile(file, pixels, imgSize, &w, nullptr); |
2753 CloseHandle(file); | |
2754 | |
2755 if (w != imgSize) | |
2756 { | |
2757 delete [] pixels; | |
2758 return nullptr; | |
2759 } | |
2760 | |
2761 if (out_width) | |
2762 *out_width = header.tgaWidth; | |
2763 if (out_height) | |
2764 *out_height = header.tgaHeight; | |
2765 | |
1980 | 2766 unsigned short* pixels_16bit = new unsigned short[imgSize / 3]; |
168 | 2767 for (int i = 0; i < imgSize / 3; ++i) |
2768 { | |
2769 pixels_16bit[i] = (pixels[i * 3] / 8 & 0x1F) | | |
2770 ((pixels[i * 3 + 1] / 4 & 0x3F) << 5) | | |
2771 ((pixels[i * 3 + 2] / 8 & 0x1F) << 11); | |
2772 } | |
2773 delete [] pixels; | |
2774 return pixels_16bit; | |
2775 } | |
2776 | |
2777 unsigned short *skybox_xn, *skybox_xp, | |
2778 *skybox_yn, *skybox_yp, | |
2779 *skybox_zn, *skybox_zp; | |
2780 int skybox_width, skybox_height; | |
781 | 2781 |
168 | 2782 IDirect3DTexture2 *skybox_texture; |
2783 IDirectDrawSurface4 *skybox_surface; | |
781 | 2784 |
168 | 2785 bool Skybox_Initialize(const wchar_t *skybox_name) |
2786 { | |
2787 wchar_t xn_filename[1024], xp_filename[1024], | |
2788 yn_filename[1024], yp_filename[1024], | |
2789 zn_filename[1024], zp_filename[1024]; | |
1165
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1160
diff
changeset
|
2790 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
|
2791 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
|
2792 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 | 2793 |
2794 int xn_width, xn_height; | |
2795 skybox_xn = LoadTgaTexture(xn_filename, &xn_width, &xn_height); | |
2796 if (!skybox_xn) | |
2797 return false; | |
2798 | |
2799 int xp_width, xp_height; | |
2800 skybox_xp = LoadTgaTexture(xp_filename, &xp_width, &xp_height); | |
2801 if (!skybox_xp || xp_width != xn_width || xp_height != xn_height) | |
2802 { | |
2803 delete [] skybox_xn; | |
2804 if (skybox_xp) delete [] skybox_xp; | |
2805 return false; | |
2806 } | |
2807 | |
2808 int yn_width, yn_height; | |
2809 skybox_yn = LoadTgaTexture(yn_filename, &yn_width, &yn_height); | |
2810 if (!skybox_yn || yn_width != xn_width || yn_height != xn_height) | |
2811 { | |
2812 delete [] skybox_xn; | |
2813 if (skybox_xp) delete [] skybox_xp; | |
2814 if (skybox_yn) delete [] skybox_yn; | |
2815 return false; | |
2816 } | |
2817 | |
2818 int yp_width, yp_height; | |
2819 skybox_yp = LoadTgaTexture(yp_filename, &yp_width, &yp_height); | |
2820 if (!skybox_yp || yp_width != xn_width || yp_height != xn_height) | |
2821 { | |
2822 delete [] skybox_xn; | |
2823 if (skybox_xp) delete [] skybox_xp; | |
2824 if (skybox_yn) delete [] skybox_yn; | |
2825 if (skybox_yp) delete [] skybox_yp; | |
2826 return false; | |
2827 } | |
2828 | |
2829 int zn_width, zn_height; | |
2830 skybox_zn = LoadTgaTexture(zn_filename, &zn_width, &zn_height); | |
2831 if (!skybox_zn || zn_width != xn_width || zn_height != xn_height) | |
2832 { | |
2833 delete [] skybox_xn; | |
2834 if (skybox_xp) delete [] skybox_xp; | |
2835 if (skybox_yn) delete [] skybox_yn; | |
2836 if (skybox_yp) delete [] skybox_yp; | |
2837 if (skybox_zn) delete [] skybox_zn; | |
2838 return false; | |
2839 } | |
2840 | |
2841 int zp_width, zp_height; | |
2842 skybox_zp = LoadTgaTexture(zp_filename, &zp_width, &zp_height); | |
2843 if (!skybox_zp || zp_width != xn_width || zp_height != xn_height) | |
2844 { | |
2845 delete [] skybox_xn; | |
2846 if (skybox_xp) delete [] skybox_xp; | |
2847 if (skybox_yn) delete [] skybox_yn; | |
2848 if (skybox_yp) delete [] skybox_yp; | |
2849 if (skybox_zn) delete [] skybox_zn; | |
2850 if (skybox_zp) delete [] skybox_zp; | |
2851 return false; | |
2852 } | |
2853 | |
2854 skybox_width = xn_width; | |
2855 skybox_height = xn_height; | |
2856 | |
2857 | |
2858 if (!pRenderer->pRenderD3D->CreateTexture(skybox_width, skybox_height, &skybox_surface, &skybox_texture, | |
2859 false, false, pRenderer->uMinDeviceTextureDim)) | |
2860 return false; | |
2861 | |
2862 return true; | |
2863 } | |
2864 | |
2865 struct vector | |
2866 { | |
2867 float x, y, z; | |
2868 }; | |
781 | 2869 |
168 | 2870 struct matrix |
2871 { | |
2872 float m[4][4]; | |
2873 }; | |
781 | 2874 |
168 | 2875 void VectorNormalize(vector *v) |
2876 { | |
2877 float invmag = 1.0f / sqrtf(v->x * v->x + v->y * v->y + v->z * v->z); | |
2878 v->x *= invmag; | |
2879 v->y *= invmag; | |
2880 v->z *= invmag; | |
2881 } | |
781 | 2882 |
168 | 2883 void MatrixRotationAxis(matrix *pout, CONST vector *pv, float angle) |
2884 { | |
2885 memset(pout, 0, sizeof(matrix)); | |
2886 pout->m[3][0] = 0; | |
2887 pout->m[3][1] = 0; | |
2888 pout->m[3][2] = 0; | |
2889 pout->m[3][3] = 1; | |
2890 | |
2891 vector v; | |
2892 v.x = pv->x; v.y = pv->y; v.z = pv->z; | |
2893 VectorNormalize(&v); | |
2894 | |
2895 pout->m[0][0] = (1.0f - cos(angle)) * v.x * v.x + cos(angle); | |
2896 pout->m[1][0] = (1.0f - cos(angle)) * v.x * v.y - sin(angle) * v.z; | |
2897 pout->m[2][0] = (1.0f - cos(angle)) * v.x * v.z + sin(angle) * v.y; | |
2898 pout->m[0][1] = (1.0f - cos(angle)) * v.y * v.x + sin(angle) * v.z; | |
2899 pout->m[1][1] = (1.0f - cos(angle)) * v.y * v.y + cos(angle); | |
2900 pout->m[2][1] = (1.0f - cos(angle)) * v.y * v.z - sin(angle) * v.x; | |
2901 pout->m[0][2] = (1.0f - cos(angle)) * v.z * v.x - sin(angle) * v.y; | |
2902 pout->m[1][2] = (1.0f - cos(angle)) * v.z * v.y + sin(angle) * v.x; | |
2903 pout->m[2][2] = (1.0f - cos(angle)) * v.z * v.z + cos(angle); | |
2904 } | |
781 | 2905 |
168 | 2906 void VectorTransform(const matrix *m, const vector *v, vector *out) |
2907 { | |
2908 out->x = m->m[0][0] * v->x + m->m[1][0] * v->y + m->m[2][0] * v->z + m->m[3][0]; | |
2909 out->y = m->m[0][1] * v->x + m->m[1][1] * v->y + m->m[2][1] * v->z + m->m[3][1]; | |
2910 out->z = m->m[0][2] * v->x + m->m[1][2] * v->y + m->m[2][2] * v->z + m->m[3][2]; | |
2911 } | |
2912 | |
2913 bool DrawSkyD3D_Skybox() | |
2914 { | |
2915 static bool initialized = false, | |
2916 initialization_failed = false; | |
2917 if (initialization_failed) | |
2918 return false; | |
2919 | |
2920 static int last_camera_rot_y, | |
2921 last_camera_rot_x; | |
2922 if (!initialized) | |
2923 { | |
2924 if (!Skybox_Initialize(L"data/skybox/stars")) | |
2925 { | |
2926 initialization_failed = true; | |
2927 return false; | |
2928 } | |
2929 initialized = true; | |
2930 | |
2931 last_camera_rot_y = pParty->sRotationY + 1; // force update for the first run | |
2932 last_camera_rot_x = pParty->sRotationX + 1; | |
2933 } | |
2934 | |
2935 /* | |
2936 r(y) = | |
2937 cos y 0 sin y 0 | |
2938 0 1 0 0 | |
2939 -sin y 0 cos y 0 | |
2940 0 0 0 1 | |
2941 | |
2942 x cos y - z sin y | |
2943 y | |
2944 x sin y + z cos y | |
2945 1 | |
2946 | |
2947 | |
2948 | |
2949 r(x) = // should be r(right) actually | |
2950 1 0 0 0 | |
2951 0 cos x -sin x 0 | |
2952 0 sin x cos x 0 | |
2953 0 0 0 1 | |
2954 | |
2955 | |
2956 x | |
2957 y cos x + z sin x | |
2958 -y sin x + z cos x | |
2959 1 | |
2960 | |
2961 */ | |
2962 | |
2963 if (last_camera_rot_y == pParty->sRotationY && | |
2964 last_camera_rot_x == pParty->sRotationX) | |
2965 { | |
2966 draw: | |
2967 struct RenderVertexD3D3 v[6]; | |
2968 | |
692 | 2969 v[0].pos.x = pViewport->uScreen_TL_X; |
2970 v[0].pos.y = pViewport->uScreen_TL_Y; | |
168 | 2971 v[0].pos.z = 0.99989998; |
2972 v[0].rhw = 1; | |
2006 | 2973 v[0].diffuse = -1; |
168 | 2974 v[0].specular = 0; |
2975 v[0].texcoord.x = 0; | |
2976 v[0].texcoord.y = 0; | |
2977 | |
692 | 2978 v[1].pos.x = pViewport->uScreen_TL_X + pViewport->uScreenWidth; |
2979 v[1].pos.y = pViewport->uScreen_TL_Y + pViewport->uScreenHeight; | |
168 | 2980 v[1].pos.z = 0.99989998; |
2981 v[1].rhw = 1; | |
2006 | 2982 v[1].diffuse = -1; |
168 | 2983 v[1].specular = 0; |
2984 v[1].texcoord.x = (float)pViewport->uScreenWidth / skybox_width; | |
2985 v[1].texcoord.y = (float)pViewport->uScreenHeight / skybox_height; | |
2986 | |
692 | 2987 v[2].pos.x = pViewport->uScreen_TL_X + pViewport->uScreenWidth; |
2988 v[2].pos.y = pViewport->uScreen_TL_Y; | |
168 | 2989 v[2].pos.z = 0.99989998; |
2990 v[2].rhw = 1; | |
2006 | 2991 v[2].diffuse = -1; |
168 | 2992 v[2].specular = 0; |
2993 v[2].texcoord.x = (float)pViewport->uScreenWidth / skybox_width; | |
2994 v[2].texcoord.y = 0; | |
2995 | |
2996 memcpy(&v[3], &v[0], sizeof(*v)); | |
2997 | |
692 | 2998 v[4].pos.x = pViewport->uScreen_TL_X; |
2999 v[4].pos.y = pViewport->uScreen_TL_Y + pViewport->uScreenHeight; | |
168 | 3000 v[4].pos.z = 0.99989998; |
3001 v[4].rhw = 1; | |
2006 | 3002 v[4].diffuse = -1; |
168 | 3003 v[4].specular = 0; |
3004 v[4].texcoord.x = 0; | |
3005 v[4].texcoord.y = (float)pViewport->uScreenHeight / skybox_height; | |
3006 | |
3007 memcpy(&v[5], &v[1], sizeof(*v)); | |
3008 | |
3009 pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE); | |
3010 pRenderer->pRenderD3D->pDevice->SetTexture(0, skybox_texture); | |
3011 pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLELIST, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, v, 6, D3DDP_DONOTUPDATEEXTENTS | D3DDP_DONOTLIGHT); | |
3012 //pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLELIST, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, v + 1, 3, D3DDP_DONOTUPDATEEXTENTS | D3DDP_DONOTLIGHT); | |
3013 | |
3014 return true; | |
3015 } | |
3016 | |
3017 | |
3018 DDSURFACEDESC2 desc; | |
3019 desc.dwSize = sizeof(desc); | |
3020 if (!pRenderer->LockSurface_DDraw4(skybox_surface, &desc, DDLOCK_WAIT | DDLOCK_WRITEONLY)) | |
3021 return false; | |
3022 | |
3023 last_camera_rot_y = pParty->sRotationY; | |
3024 last_camera_rot_x = pParty->sRotationX; | |
3025 | |
3026 float aspect = (float)pViewport->uScreenWidth / (float)pViewport->uScreenHeight; | |
1637 | 3027 float fov_x = 3.141592f * (pODMRenderParams->uCameraFovInDegrees + 0) / 360.0f; |
168 | 3028 float fov_y = fov_x / aspect; |
3029 | |
3030 float ray_dx = fov_x / (float)pViewport->uScreenWidth, | |
3031 ray_dy = fov_y / (float)pViewport->uScreenHeight; | |
3032 float party_angle_x = 2 * 3.141592653589 * pParty->sRotationX / 2048.0, | |
3033 party_angle_y = 2 * 3.141592653589 * pParty->sRotationY / 2048.0; | |
3034 for (int y = 0; y < pViewport->uScreenHeight; ++y) | |
3035 for (int x = 0; x < pViewport->uScreenWidth; ++x) | |
3036 { | |
3037 float angle_x = party_angle_x - (y - pViewport->uScreenHeight / 2) * ray_dy; | |
3038 float angle_y = party_angle_y - (x - pViewport->uScreenWidth / 2) * ray_dx; | |
3039 | |
3040 float _dir_x_ = 1, | |
3041 _dir_y_ = 0, | |
3042 _dir_z_ = 0; | |
3043 | |
3044 float dir_x_ = _dir_x_ * cosf(angle_y);// - _dir_z_ * sinf(angle_y); // rotation around y | |
3045 //float dir_y_ = _dir_y_; | |
3046 float dir_z_ = _dir_x_ * sinf(angle_y);// + _dir_z_ * cosf(angle_y); | |
3047 | |
3048 //float dir_x = dir_x_; // rotation around x | |
3049 //float dir_y = /*dir_y_ * cosf(angle_x)*/ + dir_z_ * sinf(angle_x); | |
3050 //float dir_z = /*-dir_y_ * sinf(angle_x)*/ + dir_z_ * cosf(angle_x); | |
3051 | |
3052 vector right; // rotate around right actually to avoid space distortion | |
3053 right.x = /*dir_y * 0*/ - dir_z_ * 1; | |
3054 right.y = /*dir_z_ * 0 - dir_x_ * */0; | |
3055 right.z = dir_x_ * 1/* - dir_y_ * 0*/; | |
3056 //VectorNormalize(&right); | |
3057 | |
3058 matrix rightMatrix; | |
3059 MatrixRotationAxis(&rightMatrix, &right, angle_x); | |
3060 | |
3061 vector v1, v2; | |
3062 v1.x = dir_x_; v1.y = 0; v1.z = dir_z_; | |
3063 VectorTransform(&rightMatrix, &v1, &v2); | |
3064 | |
3065 float dir_x = v2.x, | |
3066 dir_y = v2.y, | |
3067 dir_z = v2.z; | |
3068 | |
3069 float abs_dir_x = fabsf(dir_x), | |
3070 abs_dir_y = fabsf(dir_y), | |
3071 abs_dir_z = fabsf(dir_z); | |
3072 | |
3073 unsigned short color = (0x1F << 11) | (0x1F << 5) | (5); //default to orange | |
3074 if (abs_dir_x >= abs_dir_y) | |
3075 { | |
3076 if (abs_dir_x >= abs_dir_z) | |
3077 { | |
3078 if (dir_x >= 0) | |
3079 { | |
3080 float instersect_y = dir_y / (2.0f * dir_x); // plane equation for this side is x + 0.5 = 0 | |
3081 float instersect_z = dir_z / (2.0f * dir_x); | |
3082 | |
3083 float u = 1.0f - (instersect_z + 0.5f), | |
3084 v = 1.0f - (instersect_y + 0.5f); | |
3085 | |
3086 int tx = u * (skybox_width - 1), | |
3087 ty = v * (skybox_height - 1); | |
3088 | |
3089 color = skybox_xp[ty * skybox_width + tx]; | |
3090 //color = ty * 0x1F / skybox_height; | |
3091 } | |
3092 else | |
3093 { | |
3094 float instersect_y = dir_y / (2.0f * dir_x); | |
3095 float instersect_z = dir_z / (2.0f * dir_x); | |
3096 | |
3097 float u = 1.0f - (instersect_z + 0.5f), | |
3098 v = instersect_y + 0.5f; | |
3099 | |
3100 int tx = u * (skybox_width - 1), | |
3101 ty = v * (skybox_height - 1); | |
3102 | |
3103 color = skybox_xn[ty * skybox_width + tx]; | |
3104 //color = tx * 0x1F / skybox_height; | |
3105 } | |
3106 } | |
3107 else if (dir_z >= 0) | |
3108 goto DIR_ZP; | |
3109 else | |
3110 goto DIR_ZN; | |
3111 } | |
3112 else if (abs_dir_y >= abs_dir_z) | |
3113 { | |
3114 if (dir_y >= 0) | |
3115 { | |
3116 float instersect_x = dir_x / (2.0f * dir_y); | |
3117 float instersect_z = dir_z / (2.0f * dir_y); | |
3118 | |
3119 float u = instersect_x + 0.5f, | |
3120 v = instersect_z + 0.5f; | |
3121 | |
3122 int tx = u * (skybox_width - 1), | |
3123 ty = v * (skybox_height - 1); | |
3124 | |
3125 color = skybox_yp[ty * skybox_width + tx]; | |
3126 //color = tx * 0x1F / skybox_height; | |
3127 } | |
3128 /*else should never be seen i guess | |
3129 { | |
3130 __debugbreak(); | |
3131 // -y | |
3132 //Log::Warning(L"(%03u, %03u): -y", x, y); | |
3133 }*/ | |
3134 } | |
3135 else if (dir_z >= 0) | |
3136 { | |
3137 DIR_ZP: | |
3138 // +z | |
3139 float instersect_x = dir_x / (2.0f * dir_z); | |
3140 float instersect_y = dir_y / (2.0f * dir_z); | |
3141 //float intersect_z = 0.5f; | |
3142 | |
3143 float u = instersect_x + 0.5f, | |
3144 v = -instersect_y + 0.5f; | |
3145 | |
3146 int tx = u * (skybox_width - 1), | |
3147 ty = v * (skybox_height - 1); | |
3148 | |
3149 color = skybox_zp[ty * skybox_width + tx]; | |
3150 } | |
3151 else | |
3152 { | |
3153 DIR_ZN: | |
3154 // -z | |
3155 float instersect_x = -dir_x / (2.0f * dir_z); | |
3156 float instersect_y = -dir_y / (2.0f * dir_z); | |
3157 //float intersect_z = -0.5f; | |
3158 | |
3159 float u = 1.0f - instersect_x - 0.5f, | |
3160 v = -instersect_y + 0.5f; | |
3161 | |
3162 int tx = u * (skybox_width - 1), | |
3163 ty = v * (skybox_height - 1); | |
3164 | |
3165 color = skybox_zn[ty * skybox_width + tx]; | |
3166 } | |
3167 | |
3168 //pRenderer->pTargetSurface[(pViewport->uScreenY + y) * pRenderer->uTargetSurfacePitch + pViewport->uScreenX + x] = color; | |
3169 ((unsigned __int16 *)((char *)desc.lpSurface + y * desc.lPitch))[x] = color; | |
3170 } | |
3171 | |
3172 ErrD3D((skybox_surface)->Unlock(0)); | |
3173 goto draw; | |
3174 } | |
0 | 3175 //----- (0047A384) -------------------------------------------------------- |
1637 | 3176 void ODM_LoadAndInitialize(const char *pLevelFilename, ODMRenderParams *thisa) |
0 | 3177 { |
3178 int v2; // ebx@3 | |
3179 unsigned int v3; // eax@3 | |
3180 MapInfo *v4; // edi@4 | |
3181 //int v5; // eax@8 | |
3182 //SpawnPointMM7 *v6; // edx@14 | |
3183 size_t v7; // eax@19 | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3184 //char *v8; // eax@19 |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3185 //char *v9; // eax@21 |
0 | 3186 char Source[120]; // [sp+Ch] [bp-84h]@19 |
3187 const char *pFilename; // [sp+84h] [bp-Ch]@1 | |
3188 //unsigned int v12; // [sp+88h] [bp-8h]@12 | |
3189 //int v13; // [sp+8Ch] [bp-4h]@11 | |
3190 | |
3191 pFilename = pLevelFilename; | |
1583 | 3192 //thisa->AllocSoftwareDrawBuffers(); |
1637 | 3193 pODMRenderParams->Initialize(); |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3194 pWeather->bRenderSnow = false; |
0 | 3195 pRenderer->ClearZBuffer(0, 479); |
1637 | 3196 thisa = (ODMRenderParams *)1; |
0 | 3197 GetAlertStatus(); |
3198 if ( qword_A750D8 ) | |
1583 | 3199 qword_A750D8 = 0; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1470
diff
changeset
|
3200 v2 = pMapStats->GetMapInfo(pCurrentMapName); |
0 | 3201 v3 = 0; |
3202 if ( v2 ) | |
3203 { | |
3204 v4 = &pMapStats->pInfos[v2]; | |
3205 v3 = v4->uRespawnIntervalDays; | |
3206 } | |
3207 else | |
3208 { | |
3209 v4 = (MapInfo *)thisa; | |
3210 } | |
767 | 3211 day_attrib &= ~DAY_ATTRIB_FOG; |
0 | 3212 dword_6BE13C_uCurrentlyLoadedLocationID = v2; |
3213 pOutdoor->Initialize( | |
3214 pFilename, | |
3215 (unsigned int)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 0x3C / 0x3C / 0x18 + 1, | |
3216 v3, | |
3217 (int)&thisa); | |
2061 | 3218 if ( !(dword_6BE364_game_settings_1 & GAME_SETTINGS_2000) ) |
0 | 3219 { |
3220 InitializeActors(); | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
3221 InitializeSpriteObjects(); |
0 | 3222 } |
2061 | 3223 dword_6BE364_game_settings_1 &= ~GAME_SETTINGS_2000; |
0 | 3224 //v5 = 0; |
3225 if ( !v2 ) | |
3226 thisa = 0; | |
1637 | 3227 if ( thisa == (ODMRenderParams *)1 ) |
0 | 3228 { |
3229 //v13 = 0; | |
3230 for (uint i = 0; i < pOutdoor->uNumSpawnPoints; ++i) | |
3231 { | |
3232 //v12 = 0; | |
3233 //while ( 1 ) | |
3234 //{ | |
1980 | 3235 SpawnPointMM7* spawn = pOutdoor->pSpawnPoints + i; |
0 | 3236 //v6 = &pOutdoor->pSpawnPoints[v12 / 0x18]; |
3237 if (spawn->uKind == 3 ) | |
3238 SpawnEncounter(v4, spawn, 0, 0, 0); | |
3239 else | |
3240 v4->SpawnRandomTreasure(spawn); | |
3241 //++v13; | |
3242 //v12 += 24; | |
3243 //if ( v13 >= (signed int)pOutdoor->uNumSpawnPoints ) | |
3244 // break; | |
3245 //v5 = 0; | |
3246 //} | |
3247 } | |
3248 RespawnGlobalDecorations(); | |
3249 } | |
3250 pOutdoor->PrepareDecorations(); | |
2065
87be06553c76
rename int _47F223_LooksLikeGenerateMonsterLoot() to void ArrangeSpriteObjects()
Ritor1
parents:
2061
diff
changeset
|
3251 pOutdoor->ArrangeSpriteObjects(); |
0 | 3252 pOutdoor->InitalizeActors(v2); |
3253 pOutdoor->MessWithLUN(); | |
3254 v7 = strlen("levels\\"); | |
3255 strcpy(Source, &pFilename[v7]); | |
3256 strcpy(pOutdoor->pLevelFilename, Source); | |
3257 pWeather->Initialize(); | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
3258 pGame->pIndoorCameraD3D->sRotationY = pParty->sRotationY; |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
3259 pGame->pIndoorCameraD3D->sRotationX = pParty->sRotationX; |
1642 | 3260 //pODMRenderParams->RotationToInts(); |
0 | 3261 pOutdoor->UpdateSunlightVectors(); |
1638
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
3262 |
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
3263 float fov_rad; |
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
3264 float fov_rad_inv; |
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
3265 //----- (0042394D) -------------------------------------------------------- |
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
3266 //void IndoorCamera::Initialize(int degFov, unsigned int uViewportWidth, unsigned int uViewportHeight) |
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
3267 { |
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
3268 //pIndoorCamera->Initialize(65, viewparams->uScreen_BttmR_X - viewparams->uScreen_topL_X + 1, |
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
3269 // viewparams->uScreen_BttmR_Y - viewparams->uScreen_topL_Y + 1); |
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
3270 |
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
3271 int uViewportWidth = viewparams->uScreen_BttmR_X - viewparams->uScreen_topL_X + 1; |
1641 | 3272 |
3273 extern float _calc_fov(int viewport_width, int angle_degree); | |
3274 fov_rad = _calc_fov(uViewportWidth, 65); | |
3275 fov_rad_inv = 65536.0 / fov_rad; | |
1638
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
3276 } |
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
3277 pODMRenderParams->int_fov_rad = (signed __int64)fov_rad; |
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
3278 pODMRenderParams->int_fov_rad_inv = (signed __int64)fov_rad_inv; |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3279 |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3280 for (int i = 0; i < 20000; ++i) |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3281 { |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3282 array_77EC08[i].ptr_38 = &stru_8019C8; |
1644 | 3283 |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3284 array_77EC08[i].ptr_48 = nullptr; |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3285 } |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3286 |
0 | 3287 MM7Initialization(); |
3288 } | |
3289 | |
3290 //----- (0047C370) -------------------------------------------------------- | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3291 unsigned int GetLevelFogColor() |
0 | 3292 { |
3293 signed __int64 v1; // qax@5 | |
3294 int v2; // eax@6 | |
3295 | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3296 if (bUnderwater) |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3297 return 0xFF258F5C; |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3298 |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3299 if (day_attrib & DAY_ATTRIB_FOG) |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3300 { |
767 | 3301 if ( pWeather->bNight ) // night-time fog |
750 | 3302 { |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3303 __debugbreak(); // decompilation can be inaccurate, please send savegame to Nomad |
750 | 3304 v2 = -(pWeather->bNight != 1); |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3305 return (v2 & 0xE0E0E1) - 0xE0E0E1; |
0 | 3306 } |
3307 else | |
3308 { | |
3309 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
|
3310 return v1 | (((unsigned int)v1 | (((unsigned int)v1 | 0xFFFFFF00) << 8)) << 8); |
0 | 3311 } |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3312 } |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3313 |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3314 return 0; |
0 | 3315 } |
3316 | |
3317 //----- (0047C3D7) -------------------------------------------------------- | |
3318 int __fastcall sub_47C3D7_get_fog_related_stuff(int a1, int a2, float a3) | |
3319 { | |
3320 int v3; // ecx@1 | |
3321 double v5; // st7@10 | |
3322 signed int v7; // ecx@11 | |
3323 double v8; // st6@12 | |
3324 double v9; // st7@15 | |
3325 double v10; // st6@16 | |
3326 float v11; // ST14_4@17 | |
3327 double v12; // ST08_8@17 | |
3328 | |
750 | 3329 v3 = pWeather->bNight; |
0 | 3330 if ( bUnderwater == 1 ) |
3331 v3 = 0; | |
767 | 3332 if ( pParty->armageddon_timer || !(day_attrib & DAY_ATTRIB_FOG) && !bUnderwater ) |
349 | 3333 return 0xFF000000; |
0 | 3334 if ( v3 ) |
3335 { | |
3336 v5 = (double)day_fogrange_1; | |
3337 if ( a3 < v5 ) | |
1418 | 3338 { |
3339 v7 = 0; | |
3340 if ( a3 == 0.0 ) | |
3341 { | |
3342 v7 = 216; | |
3343 } | |
3344 goto LABEL_21; | |
3345 } | |
3346 else | |
3347 { | |
3348 v8 = (double)day_fogrange_2; | |
3349 if ( a3 > v8 ) | |
3350 { | |
3351 v7 = 216; | |
3352 if ( a3 == 0.0 ) | |
3353 { | |
3354 v7 = 216; | |
3355 } | |
3356 goto LABEL_21; | |
3357 } | |
3358 v7 = (signed __int64)((a3 - v5) / (v8 - v5) * 216.0); | |
3359 } | |
0 | 3360 } |
3361 else | |
3362 { | |
3363 v9 = (double)day_fogrange_1; | |
3364 if ( a3 < v9 ) | |
3365 { | |
3366 v7 = 0; | |
1418 | 3367 if ( a3 == 0.0 ) |
3368 { | |
3369 v7 = 216; | |
3370 } | |
3371 goto LABEL_21; | |
0 | 3372 } |
1418 | 3373 else |
3374 { | |
3375 v10 = (double)day_fogrange_2; | |
3376 if ( a3 > v10 ) | |
3377 { | |
3378 v7 = 216; | |
3379 if ( a3 == 0.0 ) | |
3380 { | |
3381 v7 = 216; | |
3382 } | |
3383 goto LABEL_21; | |
3384 } | |
3385 else | |
3386 { | |
3387 v11 = (a3 - v9) * 216.0 / (v10 - v9); | |
3388 v12 = v11 + 6.7553994e15; | |
3389 v7 = LODWORD(v12); | |
3390 } | |
3391 } | |
3392 } | |
3393 if ( v7 > 216 ) | |
3394 { | |
3395 v7 = 216; | |
3396 } | |
3397 else | |
3398 { | |
3399 if ( a3 == 0.0 ) | |
3400 { | |
3401 v7 = 216; | |
3402 } | |
3403 } | |
0 | 3404 LABEL_21: |
3405 if ( a2 ) | |
3406 v7 = 248; | |
3407 return (-1 - v7) << 24; | |
3408 } | |
349 | 3409 |
0 | 3410 //----- (0047C4FC) -------------------------------------------------------- |
1459 | 3411 int __fastcall GetActorTintColor(int max_dimm, int min_dimm, float distance, int a4, RenderBillboard *a5) |
349 | 3412 { |
3413 //int v5; // esi@1 | |
0 | 3414 signed int v6; // edx@1 |
349 | 3415 //signed int result; // eax@2 |
0 | 3416 int v8; // eax@3 |
3417 double v9; // st7@12 | |
750 | 3418 //double v10; // ST0C_8@18 |
0 | 3419 int v11; // ecx@28 |
349 | 3420 //signed int v12; // edi@28 |
3421 //double v13; // ST0C_8@33 | |
3422 //double v14; // ST0C_8@34 | |
0 | 3423 double v15; // st7@44 |
349 | 3424 //double v16; // ST0C_8@44 |
3425 //double v17; // ST0C_8@44 | |
0 | 3426 int v18; // ST14_4@44 |
349 | 3427 //double v19; // ST0C_8@44 |
0 | 3428 signed int v20; // [sp+10h] [bp-4h]@10 |
3429 float a3a; // [sp+1Ch] [bp+8h]@33 | |
638 | 3430 //float a3b; // [sp+1Ch] [bp+8h]@34 |
0 | 3431 float a3c; // [sp+1Ch] [bp+8h]@44 |
349 | 3432 //float a3d; // [sp+1Ch] [bp+8h]@44 |
750 | 3433 //float a4b; // [sp+20h] [bp+Ch]@18 |
638 | 3434 //int a4a; // [sp+20h] [bp+Ch]@33 |
349 | 3435 //float a4c; // [sp+20h] [bp+Ch]@44 |
3436 //float a4d; // [sp+20h] [bp+Ch]@44 | |
0 | 3437 int a5a; // [sp+24h] [bp+10h]@44 |
3438 | |
349 | 3439 //v5 = a2; |
0 | 3440 v6 = 0; |
349 | 3441 |
3442 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
638 | 3443 return 8 * (31 - max_dimm) | ((8 * (31 - max_dimm) | ((31 - max_dimm) << 11)) << 8); |
3444 | |
349 | 3445 if (pParty->armageddon_timer) |
3446 return 0xFFFF0000; | |
3447 | |
750 | 3448 v8 = pWeather->bNight; |
638 | 3449 if (bUnderwater) |
0 | 3450 v8 = 0; |
3451 if ( v8 ) | |
3452 { | |
3453 v20 = 1; | |
349 | 3454 if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uExpireTime > 0 ) |
3455 v20 = pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uPower; | |
0 | 3456 v9 = (double)v20 * 1024.0; |
3457 if ( a4 ) | |
1901 | 3458 { |
3459 v6 = 216; | |
3460 goto LABEL_20; | |
3461 } | |
638 | 3462 if ( distance <= v9 ) |
3463 { | |
3464 if ( distance > 0.0 ) | |
3465 { | |
750 | 3466 //a4b = distance * 216.0 / v9; |
3467 //v10 = a4b + 6.7553994e15; | |
3468 //v6 = LODWORD(v10); | |
3469 v6 = floorf(0.5f + distance * 216.0 / v9); | |
3470 if (v6 > 216 ) | |
1901 | 3471 { |
3472 v6 = 216; | |
3473 goto LABEL_20; | |
3474 } | |
0 | 3475 } |
3476 } | |
3477 else | |
3478 { | |
3479 v6 = 216; | |
3480 } | |
638 | 3481 if ( distance != 0.0 ) |
0 | 3482 { |
3483 LABEL_20: | |
3484 if ( a5 ) | |
3485 v6 = 8 * _43F55F_get_billboard_light_level(a5, v6 >> 3); | |
3486 if ( v6 > 216 ) | |
3487 v6 = 216; | |
3488 return (255 - v6) | ((255 - v6) << 16) | ((255 - v6) << 8); | |
3489 } | |
1901 | 3490 //LABEL_19: |
0 | 3491 v6 = 216; |
3492 goto LABEL_20; | |
3493 } | |
349 | 3494 |
3495 | |
3496 | |
638 | 3497 if (fabsf(distance) < 1.0e-6f) |
349 | 3498 return 0xFFF8F8F8; |
3499 | |
638 | 3500 // dim in measured in 8-steps |
3501 v11 = 8 * (max_dimm - min_dimm); | |
349 | 3502 //v12 = v11; |
0 | 3503 if ( v11 >= 0 ) |
3504 { | |
3505 if ( v11 > 216 ) | |
349 | 3506 v11 = 216; |
3507 } | |
3508 else | |
3509 v11 = 0; | |
3510 | |
638 | 3511 float fog_density_mult = 216.0f; |
3512 if (a4) | |
1637 | 3513 fog_density_mult += distance / (double)pODMRenderParams->shading_dist_shade * 32.0; |
638 | 3514 |
3515 v6 = v11 + floorf(pOutdoor->fFogDensity * fog_density_mult + 0.5f); | |
3516 /*if ( a4 ) | |
3517 { | |
3518 //a3b = pOutdoor->fFogDensity * 216.0; | |
349 | 3519 //v14 = a3b + 6.7553994e15; |
638 | 3520 //a4a = floorf(a3b + 0.5f);//LODWORD(v14); |
3521 } | |
3522 else | |
3523 { | |
1637 | 3524 //a3a = (distance / (double)pODMRenderParams->shading_dist_shade * 32.0 + 216.0) * pOutdoor->fFogDensity; |
349 | 3525 //v13 = a3a + 6.7553994e15; |
638 | 3526 //a4a = floorf(a3a + 0.5f);//LODWORD(v13); |
3527 } | |
3528 v6 = a4a + v11;*/ | |
0 | 3529 if ( a5 ) |
3530 v6 = 8 * _43F55F_get_billboard_light_level(a5, v6 >> 3); | |
3531 if ( v6 > 216 ) | |
3532 v6 = 216; | |
349 | 3533 if ( v6 < v11 ) |
3534 v6 = v11; | |
638 | 3535 if ( v6 > 8 * pOutdoor->max_terrain_dimming_level ) |
3536 v6 = 8 * pOutdoor->max_terrain_dimming_level; | |
0 | 3537 if ( !bUnderwater ) |
3538 return (255 - v6) | ((255 - v6) << 16) | ((255 - v6) << 8); | |
349 | 3539 else |
3540 { | |
0 | 3541 v15 = (double)(255 - v6) * 0.0039215689; |
3542 a3c = v15; | |
349 | 3543 //a4c = v15 * 16.0; |
3544 //v16 = a4c + 6.7553994e15; | |
3545 a5a = floorf(v15 * 16.0 + 0.5f);//LODWORD(v16); | |
3546 //a4d = a3c * 194.0; | |
3547 //v17 = a4d + 6.7553994e15; | |
3548 v18 = floorf(a3c * 194.0 + 0.5f);//LODWORD(v17); | |
3549 //a3d = a3c * 153.0; | |
3550 //v19 = a3d + 6.7553994e15; | |
3551 return (int)floorf(a3c * 153.0 + 0.5f)/*LODWORD(v19)*/ | ((v18 | (a5a << 8)) << 8); | |
3552 } | |
0 | 3553 } |
3554 // 6BE3C4: using guessed type char bUnderwater; | |
3555 | |
3556 //----- (0047F44B) -------------------------------------------------------- | |
1412 | 3557 unsigned int WorldPosToGridCellX(int sWorldPosX) |
67 | 3558 { |
1412 | 3559 return (sWorldPosX >> 9) + 64; // sar is in original exe, resulting -880 / 512 = -1 |
3560 // and -880 sar 9 = -2 | |
0 | 3561 } |
3562 | |
3563 //----- (0047F458) -------------------------------------------------------- | |
1412 | 3564 unsigned int WorldPosToGridCellZ(int sWorldPosZ) |
67 | 3565 { |
1412 | 3566 return 64 - (sWorldPosZ >> 9); // sar is in original exe, resulting -880 / 512 = -1 |
3567 // and -880 sar 9 = -2 | |
0 | 3568 } |
3569 | |
3570 //----- (0047F469) -------------------------------------------------------- | |
1459 | 3571 int GridCellToWorldPosX(int a1) |
0 | 3572 { |
3573 return (a1 - 64) << 9; | |
3574 } | |
3575 | |
3576 //----- (0047F476) -------------------------------------------------------- | |
1459 | 3577 int GridCellToWorldPosZ(int a1) |
0 | 3578 { |
3579 return (64 - a1) << 9; | |
3580 } | |
3581 | |
3582 | |
3583 //----- (004811A3) -------------------------------------------------------- | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
3584 void Polygon::DrawBorderTiles() |
1338 | 3585 { |
3586 //__debugbreak(); | |
3587 | |
3588 pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, false); | |
0 | 3589 pRenderer->DrawTerrainPolygon(uNumVertices, this, |
1338 | 3590 pBitmaps_LOD->pHardwareTextures[pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_current_frame]], false, true); |
3591 | |
3592 pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, true); | |
3593 //pRenderer->DrawTerrainPolygon(uNumVertices, this, pBitmaps_LOD->pHardwareTextures[uTileBitmapID], true, true); | |
0 | 3594 } |
3595 | |
3596 | |
3597 //----- (00481ED9) -------------------------------------------------------- | |
1637 | 3598 void sub_481ED9_MessWithODMRenderParams() |
0 | 3599 { |
1544 | 3600 stru_8019C8._48616B_frustum_odm(65536, 0, 0, 0, 65536, 0); |
1637 | 3601 pODMRenderParams->uNumPolygons = 0; |
1642 | 3602 //pODMRenderParams->uNumEdges = 0; |
3603 //pODMRenderParams->uNumSpans = 0; | |
3604 //pODMRenderParams->uNumSurfs = 0; | |
1637 | 3605 pODMRenderParams->uNumBillboards = 0; |
3606 pODMRenderParams->field_44 = 0; | |
0 | 3607 } |
3608 | |
3609 //----- (004823F4) -------------------------------------------------------- | |
138 | 3610 bool IsTerrainSlopeTooHigh(int pos_x, int pos_z) |
3611 { | |
3612 //unsigned int v2; // ebx@1 | |
3613 //unsigned int v3; // edi@1 | |
3614 //int v4; // eax@1 | |
3615 //int v6; // esi@5 | |
3616 //int v7; // ecx@6 | |
3617 //int v8; // edx@6 | |
3618 //int v9; // eax@6 | |
3619 //int v10; // esi@10 | |
3620 //int v11; // [sp+14h] [bp-8h]@1 | |
3621 //int v12; // [sp+18h] [bp-4h]@1 | |
3622 | |
3623 //v12 = a1; | |
3624 //v11 = a2; | |
1980 | 3625 unsigned int grid_x = WorldPosToGridCellX(pos_x); |
3626 unsigned int grid_z = WorldPosToGridCellZ(pos_z) - 1; | |
3627 | |
3628 int party_grid_x1 = GridCellToWorldPosX(grid_x); | |
138 | 3629 //dword_76D56C_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(grid_x + 1); |
3630 //dword_76D570_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(grid_x + 1); | |
3631 //dword_76D574_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(grid_x); | |
1980 | 3632 int party_grid_z1 = GridCellToWorldPosZ(grid_z); |
138 | 3633 //dword_76D55C_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(grid_z); |
3634 //dword_76D560_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(grid_z + 1); | |
3635 //dword_76D564_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(grid_z + 1); | |
1980 | 3636 int party_x1z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z); |
3637 int party_x2z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z); | |
3638 int party_x2z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z + 1); | |
3639 int party_x1z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z + 1); | |
138 | 3640 //dword_76D554_terrain_cell_world_pos_around_party_y = v4; |
3641 if (party_x1z1_y == party_x2z1_y && | |
3642 party_x2z1_y == party_x2z2_y && | |
3643 party_x2z2_y == party_x1z2_y ) | |
3644 return false; | |
3645 | |
1980 | 3646 int dx = abs(pos_x - party_grid_x1), |
138 | 3647 dz = abs(party_grid_z1 - pos_z); |
3648 | |
3649 int y1, y2, y3; | |
3650 if (dz >= dx) | |
3651 { | |
3652 y1 = party_x1z2_y; // lower-left triangle | |
3653 y2 = party_x2z2_y; // y3 | \ | |
3654 y3 = party_x1z1_y; // | \ | |
3655 /* | \ | |
3656 |______ \ | |
3657 y1 y2 */ | |
3658 } | |
3659 else | |
3660 { | |
3661 y1 = party_x2z1_y; // upper-right | |
3662 y2 = party_x1z1_y; // y2_______ y1 | |
3663 y3 = party_x2z2_y; // \ | | |
3664 /* \ | | |
3665 \ | | |
3666 y3 */ | |
3667 } | |
3668 | |
3669 int y_min = min(y1, min(y2, y3)), | |
3670 y_max = max(y1, max(y2, y3)); | |
1545 | 3671 return (y_max - y_min) > 512; |
138 | 3672 |
3673 /*if ( y1 >= y2 ) | |
3674 { | |
3675 y_min = y2; | |
3676 if ( y2 < y3 ) | |
0 | 3677 goto LABEL_13; |
3678 LABEL_12: | |
138 | 3679 y_min = y3; |
0 | 3680 goto LABEL_13; |
3681 } | |
138 | 3682 else if ( y1 >= y3 ) |
0 | 3683 goto LABEL_12; |
138 | 3684 else |
3685 y_min = y1; | |
3686 | |
0 | 3687 LABEL_13: |
138 | 3688 if ( y1 <= y2 ) |
3689 { | |
3690 if ( y2 > y3 ) | |
3691 y3 = y2; | |
3692 } | |
3693 else | |
3694 { | |
3695 if ( y1 > y3 ) | |
3696 y3 = y1; | |
3697 } | |
3698 return y3 - v10 > 512;*/ | |
0 | 3699 } |
3700 | |
3701 //----- (0048257A) -------------------------------------------------------- | |
812 | 3702 int __fastcall GetTerrainHeightsAroundParty2(int a1, int a2, int *pIsOnWater, int bFloatAboveWater) |
3703 { | |
3704 //unsigned int v4; // ebx@1 | |
3705 //unsigned int v5; // edi@1 | |
0 | 3706 int result; // eax@9 |
812 | 3707 //int v7; // ebx@10 |
0 | 3708 int v8; // ebx@11 |
3709 int v9; // eax@11 | |
3710 int v10; // ecx@11 | |
812 | 3711 //int v11; // [sp+Ch] [bp-Ch]@1 |
3712 //int v12; // [sp+10h] [bp-8h]@1 | |
0 | 3713 int v13; // [sp+10h] [bp-8h]@11 |
3714 signed int v14; // [sp+14h] [bp-4h]@3 | |
3715 int v15; // [sp+24h] [bp+Ch]@11 | |
3716 | |
812 | 3717 //v11 = a1; |
3718 //v12 = a2; | |
1980 | 3719 unsigned int grid_x = WorldPosToGridCellX(a1); |
3720 unsigned int grid_z = WorldPosToGridCellZ(a2) - 1; | |
3721 | |
3722 int grid_x1 = GridCellToWorldPosX(grid_x), | |
812 | 3723 grid_x2 = GridCellToWorldPosX(grid_x + 1); |
1980 | 3724 int grid_z1 = GridCellToWorldPosZ(grid_z), |
812 | 3725 grid_z2 = GridCellToWorldPosZ(grid_z + 1); |
3726 | |
1980 | 3727 int y_x1z1 = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z), |
812 | 3728 y_x2z1 = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z), |
3729 y_x2z2 = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z + 1), | |
3730 y_x1z2 = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z + 1); | |
3731 //v4 = WorldPosToGridCellX(a1); | |
3732 //v5 = WorldPosToGridCellZ(v12) - 1; | |
3733 //dword_76D538_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v4); | |
3734 //dword_76D53C_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v4 + 1); | |
3735 //dword_76D540_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v4 + 1); | |
3736 //dword_76D544_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v4); | |
3737 //dword_76D528_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v5); | |
3738 //dword_76D52C_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v5); | |
3739 //dword_76D530_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v5 + 1); | |
3740 //dword_76D534_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v5 + 1); | |
3741 //dword_76D518_terrain_cell_world_pos_around_party_y = pOutdoor->DoGetHeightOnTerrain(v4, v5); | |
3742 //dword_76D51C_terrain_cell_world_pos_around_party_y = pOutdoor->DoGetHeightOnTerrain(v4 + 1, v5); | |
3743 //dword_76D520_terrain_cell_world_pos_around_party_y = pOutdoor->DoGetHeightOnTerrain(v4 + 1, v5 + 1); | |
3744 //dword_76D524_terrain_cell_world_pos_around_party_y = pOutdoor->DoGetHeightOnTerrain(v4, v5 + 1); | |
791 | 3745 *pIsOnWater = false; |
812 | 3746 if ( pOutdoor->ActuallyGetSomeOtherTileInfo(grid_x, grid_z) & 2 ) |
791 | 3747 *pIsOnWater = true; |
0 | 3748 v14 = 0; |
812 | 3749 if ( !bFloatAboveWater && *pIsOnWater ) |
0 | 3750 v14 = -60; |
812 | 3751 if ( y_x1z1 != y_x2z1 || |
3752 y_x2z1 != y_x2z2 || | |
3753 y_x2z2 != y_x1z2 ) | |
3754 { | |
3755 if ( abs(grid_z1 - a2) >= abs(a1 - grid_x1) ) | |
3756 { | |
3757 v8 = y_x1z2; | |
3758 v9 = y_x2z2; | |
3759 v10 = y_x1z1; | |
3760 v15 = a1 - grid_x1; | |
3761 v13 = a2 - grid_z2; | |
0 | 3762 } |
3763 else | |
3764 { | |
812 | 3765 v8 = y_x2z1; |
3766 v9 = y_x1z1; | |
3767 v10 = y_x2z2; | |
3768 v15 = grid_x2 - a1; | |
3769 v13 = grid_z1 - a2; | |
3770 } | |
1643 | 3771 return v14 + v8 + fixpoint_mul(v13, (v10 - v8) * 128) + fixpoint_mul(v15, (v9 - v8) * 128); |
812 | 3772 } |
3773 else | |
3774 return y_x1z1; | |
0 | 3775 } |
3776 | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
3777 |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
3778 |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
3779 |
0 | 3780 |
3781 //----- (00485F53) -------------------------------------------------------- | |
1458 | 3782 void sr_485F53(Vec2_int_ *v) |
0 | 3783 { |
3784 ++v->y; | |
3785 if ( v->y > 1000 ) | |
3786 v->y = 0; | |
3787 } | |
3788 | |
3789 //----- (0048607B) -------------------------------------------------------- | |
1427 | 3790 void Polygon::Create_48607B(stru149 *a2) |
0 | 3791 { |
3792 this->pTexture = 0; | |
3793 this->ptr_38 = a2; | |
3794 } | |
3795 | |
3796 //----- (00486089) -------------------------------------------------------- | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3797 void Polygon::_normalize_v_18() |
0 | 3798 { |
3799 double v2; // st7@1 | |
3800 double v3; // st6@1 | |
3801 double v5; // st5@1 | |
3802 | |
1025 | 3803 //v1 = this; |
0 | 3804 v2 = (double)this->v_18.x; |
3805 v3 = (double)this->v_18.y; | |
3806 v5 = (double)this->v_18.z; | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3807 float len = sqrt(v5 * v5 + v3 * v3 + v2 * v2); |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3808 if (fabsf(len) < 1e-6f) |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3809 { |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3810 v_18.x = 0; |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3811 v_18.y = 0; |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3812 v_18.z = 65536; |
0 | 3813 } |
3814 else | |
3815 { | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3816 v_18.x = round(v2 / len * 65536.0); |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3817 v_18.y = round(v3 / len * 65536.0); |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3818 v_18.y = round(v5 / len * 65536.0); |
0 | 3819 } |
3820 } | |
3821 | |
3822 //----- (0048616B) -------------------------------------------------------- | |
1544 | 3823 void stru149::_48616B_frustum_odm(int a2, int a3, int a4, int a5, int a6, int a7) |
0 | 3824 { |
3825 int v7; // ebx@1 | |
1544 | 3826 //int v8; // esi@1 |
0 | 3827 int v9; // edi@1 |
1544 | 3828 //int v10; // eax@1 |
0 | 3829 int v11; // edx@1 |
1544 | 3830 //int v12; // esi@2 |
3831 //int v13; // eax@2 | |
3832 //int v14; // ST10_4@3 | |
3833 //int v15; // esi@3 | |
3834 //int v16; // eax@5 | |
0 | 3835 int v17; // ST0C_4@6 |
1544 | 3836 //int v18; // eax@8 |
0 | 3837 int v19; // ST0C_4@9 |
1544 | 3838 //int v20; // eax@10 |
3839 //int v21; // edx@10 | |
3840 //int v22; // eax@10 | |
3841 //int result; // eax@10 | |
0 | 3842 int v24; // [sp+14h] [bp-14h]@1 |
3843 int v25; // [sp+18h] [bp-10h]@1 | |
1544 | 3844 //int v26; // [sp+1Ch] [bp-Ch]@1 |
0 | 3845 int v27; // [sp+24h] [bp-4h]@1 |
1544 | 3846 //int v28; // [sp+30h] [bp+8h]@10 |
3847 //int v29; // [sp+3Ch] [bp+14h]@10 | |
0 | 3848 |
1642 | 3849 v25 = pGame->pIndoorCameraD3D->int_cosine_x; |
3850 v7 = pGame->pIndoorCameraD3D->int_sine_y; | |
3851 v27 = pGame->pIndoorCameraD3D->int_sine_x; | |
1544 | 3852 //v8 = -pIndoorCamera->pos.y; |
1642 | 3853 v9 = pGame->pIndoorCameraD3D->int_cosine_y; |
1544 | 3854 //v26 = -pIndoorCamera->pos.z; |
1642 | 3855 v11 = pGame->pIndoorCameraD3D->int_cosine_y * -pGame->pIndoorCameraD3D->vPartyPos.x + pGame->pIndoorCameraD3D->int_sine_y * -pGame->pIndoorCameraD3D->vPartyPos.y; |
3856 v24 = pGame->pIndoorCameraD3D->int_cosine_y * -pGame->pIndoorCameraD3D->vPartyPos.y - pGame->pIndoorCameraD3D->int_sine_y * -pGame->pIndoorCameraD3D->vPartyPos.x; | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
3857 if (pGame->pIndoorCameraD3D->sRotationX) |
0 | 3858 { |
1643 | 3859 this->field_0_party_dir_x = fixpoint_mul(v11, pGame->pIndoorCameraD3D->int_cosine_x) + |
3860 fixpoint_mul((-pGame->pIndoorCameraD3D->vPartyPos.z) << 16, pGame->pIndoorCameraD3D->int_sine_x); | |
1544 | 3861 this->field_4_party_dir_y = v24; |
1643 | 3862 this->field_8_party_dir_z = fixpoint_mul((-pGame->pIndoorCameraD3D->vPartyPos.z) << 16, v25) - fixpoint_mul(v11, v27); |
0 | 3863 } |
3864 else | |
3865 { | |
755 | 3866 this->field_0_party_dir_x = v11; |
1544 | 3867 this->field_4_party_dir_y = v24; |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
3868 this->field_8_party_dir_z = (-pGame->pIndoorCameraD3D->vPartyPos.z) << 16; |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
3869 } |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
3870 |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
3871 if (pGame->pIndoorCameraD3D->sRotationX) |
1544 | 3872 { |
1643 | 3873 v17 = fixpoint_mul(a2, v9) + fixpoint_mul(a3, v7); |
3874 | |
1809 | 3875 this->angle_from_north = fixpoint_mul(v17, v25) + fixpoint_mul(a4, v27); |
3876 this->angle_from_west = fixpoint_mul(a3, v9) - fixpoint_mul(a2, v7); | |
1844 | 3877 this->viewing_angle_from_west_east = fixpoint_mul(a4, v25) - fixpoint_mul(v17, v27); |
0 | 3878 } |
3879 else | |
3880 { | |
1809 | 3881 this->angle_from_north = fixpoint_mul(a2, v9) + fixpoint_mul(a3, v7); |
3882 this->angle_from_west = fixpoint_mul(a3, v9) - fixpoint_mul(a2, v7); | |
1844 | 3883 this->viewing_angle_from_west_east = a4; |
1544 | 3884 } |
3885 | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
3886 if (pGame->pIndoorCameraD3D->sRotationX) |
1544 | 3887 { |
1643 | 3888 v19 = fixpoint_mul(a5, v9) + fixpoint_mul(a6, v7); |
3889 | |
1809 | 3890 this->angle_from_east = fixpoint_mul(v19, v25) + fixpoint_mul(a7, v27); |
3891 this->angle_from_south = fixpoint_mul(a6, v9) - fixpoint_mul(a5, v7); | |
1844 | 3892 this->viewing_angle_from_north_south = fixpoint_mul(a7, v25) - fixpoint_mul(v19, v27); |
0 | 3893 } |
3894 else | |
3895 { | |
1809 | 3896 this->angle_from_east = fixpoint_mul(a5, v9) + fixpoint_mul(a6, v7); |
3897 this->angle_from_south = fixpoint_mul(a6, v9) - fixpoint_mul(a5, v7); | |
1844 | 3898 this->viewing_angle_from_north_south = a7; |
1544 | 3899 } |
3900 | |
1809 | 3901 this->angle_from_east = -this->angle_from_east; |
3902 this->angle_from_south = -this->angle_from_south; | |
1844 | 3903 this->viewing_angle_from_north_south = -this->viewing_angle_from_north_south; |
1544 | 3904 |
1809 | 3905 this->field_24 = fixpoint_dot(this->angle_from_north, this->field_0_party_dir_x, |
3906 this->angle_from_west, this->field_4_party_dir_y, | |
1844 | 3907 this->viewing_angle_from_west_east, this->field_8_party_dir_z); |
1809 | 3908 this->field_28 = fixpoint_dot(this->angle_from_east, this->field_0_party_dir_x, |
3909 this->angle_from_south, this->field_4_party_dir_y, | |
1844 | 3910 this->viewing_angle_from_north_south, this->field_8_party_dir_z); |
0 | 3911 } |
3912 | |
3913 //----- (0048694B) -------------------------------------------------------- | |
1544 | 3914 void stru149::_48694B_frustum_sky() |
0 | 3915 { |
1809 | 3916 this->angle_from_east = -this->angle_from_east; |
3917 this->angle_from_south = -this->angle_from_south; | |
1844 | 3918 this->viewing_angle_from_north_south = -this->viewing_angle_from_north_south; |
1544 | 3919 |
1809 | 3920 this->field_24 = fixpoint_dot(this->angle_from_north, this->field_0_party_dir_x, |
3921 this->angle_from_west, this->field_4_party_dir_y, | |
1844 | 3922 this->viewing_angle_from_west_east, this->field_8_party_dir_z); |
1809 | 3923 this->field_28 = fixpoint_dot(this->angle_from_east, this->field_0_party_dir_x, |
3924 this->angle_from_south, this->field_4_party_dir_y, | |
1844 | 3925 this->viewing_angle_from_north_south, this->field_8_party_dir_z); |
0 | 3926 } |
3927 | |
3928 //----- (0044100D) -------------------------------------------------------- | |
994 | 3929 bool sub_44100D() |
0 | 3930 { |
569 | 3931 return pCurrentScreen == SCREEN_NPC_DIALOGUE || pCurrentScreen == SCREEN_CHARACTERS || |
3932 pCurrentScreen > SCREEN_LOADGAME && pCurrentScreen <= SCREEN_E || | |
3933 pCurrentScreen > SCREEN_VIDEO && pCurrentScreen <= SCREEN_INPUT_BLV || pCurrentScreen == SCREEN_CASTING; | |
0 | 3934 } |
3935 // 4E28F8: using guessed type int pCurrentScreen; | |
3936 | |
3937 //----- (00441A4E) -------------------------------------------------------- | |
910 | 3938 __int16 __fastcall sub_441A4E(int a1)//for blessing |
0 | 3939 { |
3940 __int16 result; // ax@1 | |
3941 int v2; // ebx@1 | |
3942 char *v3; // esi@1 | |
3943 int v4; // edi@4 | |
1110 | 3944 bool v5; // ecx@4 |
1523
53265d238d94
interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents:
1504
diff
changeset
|
3945 SpriteFrame *pFrame; // eax@6 |
53265d238d94
interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents:
1504
diff
changeset
|
3946 //SpriteFrame *v7; // edi@6 |
0 | 3947 int v8; // eax@6 |
3948 unsigned __int16 v9; // ax@6 | |
3949 RenderBillboardTransform_local0 v10; // [sp+Ch] [bp-5Ch]@1 | |
3950 int v11; // [sp+5Ch] [bp-Ch]@6 | |
3951 int v12; // [sp+60h] [bp-8h]@1 | |
3952 int v13; // [sp+64h] [bp-4h]@6 | |
3953 | |
2002 | 3954 v10.sParentBillboardID = -1; |
0 | 3955 v10.pTarget = pRenderer->pTargetSurface; |
3956 v10.pTargetZ = pRenderer->pActiveZBuffer; | |
3957 v10.uTargetPitch = pRenderer->field_10; | |
3958 result = 0; | |
3959 v2 = a1; | |
3960 v10.uViewportX = 0; | |
3961 v10.uViewportY = 0; | |
3962 v10.uViewportZ = 639; | |
3963 v10.uViewportW = 479; | |
3964 v12 = 0; | |
921 | 3965 //v3 = (char *)&pOtherOverlayList->pOverlays[0].field_C; |
3966 //do | |
3967 for ( uint i = 0; i < 50; ++i ) | |
3968 { | |
3969 if ( pOtherOverlayList->pOverlays[i].field_6 > 0 ) | |
3970 { | |
3971 result = pOtherOverlayList->pOverlays[i].field_0; | |
3972 if ( pOtherOverlayList->pOverlays[i].field_0 >= 300 ) | |
3973 { | |
3974 //v4 = result; | |
3975 v5 = pOtherOverlayList->pOverlays[i].field_0 == v2 + 320 | |
1110 | 3976 || pOtherOverlayList->pOverlays[i].field_0 == v2 + 330 |
3977 || pOtherOverlayList->pOverlays[i].field_0 == v2 + 340 | |
3978 || pOtherOverlayList->pOverlays[i].field_0 == v2 + 350; | |
921 | 3979 pOtherOverlayList->pOverlays[i].field_0 = v2 + 310; |
1110 | 3980 if ( pOtherOverlayList->pOverlays[i].field_0 == v2 + 310 || v5 ) |
921 | 3981 { |
3982 if ( !pOtherOverlayList->pOverlays[i].field_0 ) | |
3983 { | |
1523
53265d238d94
interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents:
1504
diff
changeset
|
3984 pFrame = pSpriteFrameTable->GetFrame(pOverlayList->pOverlays[pOtherOverlayList->pOverlays[i].field_2].uSpriteFramesetID, |
921 | 3985 pOtherOverlayList->pOverlays[i].field_4); |
1523
53265d238d94
interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents:
1504
diff
changeset
|
3986 //v7 = v6; |
921 | 3987 v11 = pOtherOverlayList->pOverlays[i].field_E; |
1523
53265d238d94
interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents:
1504
diff
changeset
|
3988 //v13 = pFrame->scale; |
53265d238d94
interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents:
1504
diff
changeset
|
3989 v13 = (unsigned __int64)(v11 * (signed __int64)pFrame->scale) >> 16; |
921 | 3990 v10.uScreenSpaceX = pOtherOverlayList->pOverlays[i].field_8; |
3991 v10.uScreenSpaceY = pOtherOverlayList->pOverlays[i].field_A; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
142
diff
changeset
|
3992 v10._screenspace_x_scaler_packedfloat = v13; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
142
diff
changeset
|
3993 v10._screenspace_y_scaler_packedfloat = v13; |
1523
53265d238d94
interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents:
1504
diff
changeset
|
3994 v10.pPalette = PaletteManager::Get_Dark_or_Red_LUT(pFrame->uPaletteIndex, 0, 1); |
921 | 3995 v8 = pOtherOverlayList->pOverlays[i].field_2; |
0 | 3996 v10.sZValue = 0; |
3997 v10.uFlags = 0; | |
3998 v9 = pOverlayList->pOverlays[v8].uOverlayType; | |
3999 if ( !v9 || v9 == 2 ) | |
1523
53265d238d94
interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents:
1504
diff
changeset
|
4000 v10.uScreenSpaceY += pSprites_LOD->pSpriteHeaders[pFrame->pHwSpriteIDs[0]].uHeight >> 1; |
53265d238d94
interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents:
1504
diff
changeset
|
4001 result = pSprites_LOD->pSpriteHeaders[pFrame->pHwSpriteIDs[0]]._4AD2D1(&v10, 0); |
0 | 4002 ++v12; |
4003 if ( v12 == 5 ) | |
4004 break; | |
4005 } | |
4006 } | |
4007 } | |
4008 } | |
921 | 4009 //v3 += 20; |
4010 } | |
4011 //while ( (signed int)v3 < (signed int)&pOverlayList->pOverlays ); | |
0 | 4012 return result; |
4013 } | |
4014 | |
4015 //----- (00443801) -------------------------------------------------------- | |
237 | 4016 void Initialize2DA() |
4017 { | |
4018 | |
4019 int i; | |
4020 char* test_string; | |
4021 unsigned char c; | |
4022 bool break_loop; | |
4023 unsigned int temp_str_len; | |
4024 char* tmp_pos; | |
4025 int decode_step; | |
4026 | |
4027 if ( p2DEventsTXT_Raw ) | |
1583 | 4028 free(p2DEventsTXT_Raw); |
237 | 4029 p2DEventsTXT_Raw = NULL; |
4030 p2DEventsTXT_Raw = (char *)pEvents_LOD->LoadRaw("2dEvents.txt", 0); | |
4031 strtok(p2DEventsTXT_Raw, "\r"); | |
4032 strtok(NULL, "\r"); | |
4033 | |
4034 for (i=0;i<525;++i) | |
4035 { | |
4036 test_string = strtok(NULL, "\r") + 1; | |
4037 break_loop = false; | |
4038 decode_step=0; | |
4039 do | |
4040 { | |
4041 c = *(unsigned char*)test_string; | |
4042 temp_str_len = 0; | |
4043 while((c!='\t')&&(c>0)) | |
4044 { | |
4045 ++temp_str_len; | |
4046 c=test_string[temp_str_len]; | |
4047 } | |
4048 tmp_pos=test_string+temp_str_len; | |
4049 if (*tmp_pos == 0) | |
4050 break_loop = true; | |
4051 *tmp_pos = 0; | |
4052 if (temp_str_len) | |
4053 { | |
4054 switch (decode_step) | |
4055 { | |
4056 case 2: | |
4057 { | |
4058 if ( !_strnicmp(test_string, "wea", 3) ) | |
4059 { | |
1411 | 4060 p2DEvents[i].uType = BuildingType_WeaponShop; |
237 | 4061 break; |
4062 } | |
4063 if ( !_strnicmp(test_string, "arm", 3) ) | |
4064 { | |
1411 | 4065 p2DEvents[i].uType = BuildingType_ArmorShop; |
237 | 4066 break; |
4067 } | |
4068 if ( !_strnicmp(test_string, "mag", 3) ) | |
4069 { | |
1411 | 4070 p2DEvents[i].uType = BuildingType_MagicShop; |
237 | 4071 break; |
4072 } | |
4073 if ( !_strnicmp(test_string, "alc", 3) ) | |
4074 { | |
1411 | 4075 p2DEvents[i].uType = BuildingType_AlchemistShop; |
237 | 4076 break; |
4077 } | |
4078 if ( !_strnicmp(test_string, "sta", 3) ) | |
4079 { | |
1411 | 4080 p2DEvents[i].uType = BuildingType_Stables; |
237 | 4081 break; |
4082 } | |
4083 if ( !_strnicmp(test_string, "boa", 3) ) | |
4084 { | |
1411 | 4085 p2DEvents[i].uType = BuildingType_Boats; |
237 | 4086 break; |
4087 } | |
4088 if ( !_strnicmp(test_string, "tem", 3) ) | |
4089 { | |
1411 | 4090 p2DEvents[i].uType = BuildingType_Temple; |
237 | 4091 break; |
4092 } | |
4093 if ( !_strnicmp(test_string, "tra", 3) ) | |
4094 { | |
1411 | 4095 p2DEvents[i].uType = BuildingType_Training; |
237 | 4096 break; |
4097 } | |
4098 if ( !_strnicmp(test_string, "tow", 3) ) | |
4099 { | |
1411 | 4100 p2DEvents[i].uType = BuildingType_TownHall; |
237 | 4101 break; |
4102 } | |
4103 | |
4104 if ( !_strnicmp(test_string, "tav", 3) ) | |
4105 { | |
1411 | 4106 p2DEvents[i].uType = BuildingType_Tavern; |
237 | 4107 break; |
4108 } | |
4109 if ( !_strnicmp(test_string, "ban", 3) ) | |
4110 { | |
1411 | 4111 p2DEvents[i].uType = BuildingType_Bank; |
237 | 4112 break; |
4113 } | |
4114 if ( !_strnicmp(test_string, "fir", 3) ) | |
4115 { | |
1411 | 4116 p2DEvents[i].uType = BuildingType_FireGuild; |
237 | 4117 break; |
4118 } | |
4119 if ( !_strnicmp(test_string, "air", 3) ) | |
4120 { | |
1411 | 4121 p2DEvents[i].uType = BuildingType_AirGuild; |
237 | 4122 break; |
4123 } | |
4124 if ( !_strnicmp(test_string, "wat", 3) ) | |
4125 { | |
1411 | 4126 p2DEvents[i].uType = BuildingType_WaterGuild; |
237 | 4127 break; |
4128 } | |
4129 if ( !_strnicmp(test_string, "ear", 3) ) | |
4130 { | |
1411 | 4131 p2DEvents[i].uType = BuildingType_EarthGuild; |
237 | 4132 break; |
4133 } | |
4134 if ( !_strnicmp(test_string, "spi", 3) ) | |
4135 { | |
1411 | 4136 p2DEvents[i].uType = BuildingType_SpiritGuild; |
237 | 4137 break; |
4138 } | |
4139 if ( !_strnicmp(test_string, "min", 3) ) | |
4140 { | |
1411 | 4141 p2DEvents[i].uType = BuildingType_MindGuild; |
237 | 4142 break; |
4143 } | |
4144 if ( !_strnicmp(test_string, "bod", 3) ) | |
4145 { | |
1411 | 4146 p2DEvents[i].uType = BuildingType_BodyGuild; |
237 | 4147 break; |
4148 } | |
4149 if ( !_strnicmp(test_string, "lig", 3) ) | |
4150 { | |
1411 | 4151 p2DEvents[i].uType = BuildingType_LightGuild; |
237 | 4152 break; |
4153 } | |
4154 if ( !_strnicmp(test_string, "dar", 3) ) | |
4155 { | |
1411 | 4156 p2DEvents[i].uType = BuildingType_DarkGuild; |
237 | 4157 break; |
4158 } | |
1644 | 4159 if ( !_strnicmp(test_string, "ele", 3) ) // "Element Guild" from mm6 |
237 | 4160 { |
1644 | 4161 p2DEvents[i].uType = BuildingType_ElementalGuild; |
237 | 4162 break; |
4163 } | |
4164 if ( !_strnicmp(test_string, "sel", 3) ) | |
4165 { | |
1644 | 4166 p2DEvents[i].uType = BuildingType_SelfGuild; |
237 | 4167 break; |
4168 } | |
4169 if ( !_strnicmp(test_string, "mir", 3) ) | |
4170 { | |
1411 | 4171 p2DEvents[i].uType = BuildingType_16; |
237 | 4172 break; |
4173 } | |
1644 | 4174 if ( !_strnicmp(test_string, "mer", 3) ) // "Merc Guild" from mm6 |
237 | 4175 { |
1411 | 4176 p2DEvents[i].uType = BuildingType_TownHall; |
237 | 4177 break; |
4178 } | |
1411 | 4179 p2DEvents[i].uType = BuildingType_18; |
237 | 4180 } |
4181 break; | |
4182 | |
4183 case 4: | |
4184 p2DEvents[i].uAnimationID = atoi(test_string); | |
4185 break; | |
4186 case 5: | |
4187 p2DEvents[i].pName = RemoveQuotes(test_string); | |
4188 break; | |
4189 case 6: | |
4190 p2DEvents[i].pProprieterName = RemoveQuotes(test_string); | |
4191 break; | |
4192 case 7: | |
4193 p2DEvents[i].pProprieterTitle = RemoveQuotes(test_string); | |
4194 break; | |
4195 case 8: | |
4196 p2DEvents[i].field_14 = atoi(test_string); | |
4197 break; | |
4198 case 9: | |
4199 p2DEvents[i]._state = atoi(test_string); | |
4200 break; | |
4201 case 10: | |
4202 p2DEvents[i]._rep = atoi(test_string); | |
4203 break; | |
4204 case 11: | |
4205 p2DEvents[i]._per = atoi(test_string); | |
4206 break; | |
4207 case 12: | |
4208 p2DEvents[i].fPriceMultiplier = atof(test_string); | |
4209 break; | |
4210 case 13: | |
4211 p2DEvents[i].flt_24 = atof(test_string); | |
4212 break; | |
4213 case 15: | |
4214 p2DEvents[i].field_1C = atoi(test_string); | |
4215 break; | |
4216 case 18: | |
4217 p2DEvents[i].uOpenTime = atoi(test_string); | |
4218 break; | |
4219 case 19: | |
4220 p2DEvents[i].uCloseTime = atoi(test_string); | |
4221 break; | |
4222 case 20: | |
4223 p2DEvents[i].uExitPicID = atoi(test_string); | |
4224 break; | |
4225 case 21: | |
4226 p2DEvents[i].uExitMapID = atoi(test_string); | |
4227 break; | |
4228 case 22: | |
4229 p2DEvents[i]._quest_related = atoi(test_string); | |
4230 break; | |
4231 case 23: | |
4232 p2DEvents[i].pEnterText = RemoveQuotes(test_string); | |
4233 break; | |
4234 } | |
4235 } | |
4236 ++decode_step; | |
4237 test_string=tmp_pos+1; | |
4238 } while ((decode_step<24)&&!break_loop); | |
4239 } | |
4240 | |
0 | 4241 } |
4242 | |
4243 //----- (00443E31) -------------------------------------------------------- | |
601 | 4244 void LoadLevel_InitializeLevelStr() |
4245 { | |
329 | 4246 |
4247 char Args[100]; | |
4248 int string_num; | |
4249 int max_string_length; | |
4250 int current_string_length; | |
4251 int prev_string_offset; | |
4252 | |
4253 if (sizeof(pLevelStrOffsets) != 2000) | |
0 | 4254 Log::Warning(L"pLevelStrOffsets: deserialization warning"); |
1202 | 4255 memset(pLevelStrOffsets.data(), 0, 2000); |
0 | 4256 |
329 | 4257 max_string_length = 0; |
4258 string_num = 1; | |
4259 prev_string_offset = 0; | |
336 | 4260 pLevelStrOffsets[0]=0; |
0 | 4261 for (uint i = 0; i < uLevelStrFileSize; ++i) |
4262 { | |
4263 if ( !pLevelStr[i] ) | |
4264 { | |
329 | 4265 pLevelStrOffsets[string_num] = i + 1; |
4266 ++string_num; | |
4267 if ( i - prev_string_offset > max_string_length ) | |
4268 max_string_length = i - prev_string_offset; | |
4269 prev_string_offset = i; | |
4270 } | |
4271 } | |
4272 | |
4273 uLevelStrNumStrings = string_num - 1; | |
4274 if ( max_string_length > 800 ) | |
1545 | 4275 Error("MAX_EVENT_TEXT_LENGTH needs to be increased to %lu", max_string_length+1); |
329 | 4276 |
4277 if ( uLevelStrNumStrings > 0 ) | |
4278 { | |
336 | 4279 for(uint i = 0; i <uLevelStrNumStrings ; ++i) |
329 | 4280 { |
4281 if ( RemoveQuotes(&pLevelStr[pLevelStrOffsets[i]]) != &pLevelStr[pLevelStrOffsets[i]] ) | |
4282 ++pLevelStrOffsets[i]; | |
4283 } | |
0 | 4284 } |
4285 } | |
4286 | |
4287 //----- (00443F95) -------------------------------------------------------- | |
1458 | 4288 void OnMapLeave() |
0 | 4289 { |
336 | 4290 _evt_raw *test_event; |
4291 if ( uLevelEVT_NumEvents > 0 ) | |
4292 { | |
4293 for (uint i = 0; i < uLevelEVT_NumEvents; ++i) | |
4294 { | |
4295 test_event=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[i].uEventOffsetInEVT]; | |
1052 | 4296 if ( test_event->_e_type == EVENT_OnMapLeave ) |
4297 { | |
4298 EventProcessor(pLevelEVT_Index[i].uEventID, 0, 1, pLevelEVT_Index[i].event_sequence_num); | |
336 | 4299 } |
4300 } | |
0 | 4301 } |
4302 } | |
4303 | |
4304 //----- (00443FDC) -------------------------------------------------------- | |
4305 void OnMapLoad() | |
781 | 4306 { |
363 | 4307 stru176 *v3; // esi@7 |
4308 __int16 v4; // cx@9 | |
4309 __int16 v5; // di@9 | |
4310 int v6; // eax@9 | |
4311 signed __int64 v8; // qax@26 | |
4312 unsigned int v9; // ecx@26 | |
4313 signed __int64 v10; // qax@26 | |
4314 signed __int64 v11; // qax@26 | |
4315 int v12; // ST50_4@26 | |
4316 signed __int64 v13; // qax@26 | |
4317 signed __int64 v14; // qax@26 | |
4318 int v15; // ST58_4@26 | |
4319 signed __int64 v16; // qax@26 | |
4320 int hours; // ebx@26 | |
4321 unsigned __int64 v18; // [sp+Ch] [bp-44h]@12 | |
4322 signed __int64 seconds; // [sp+14h] [bp-3Ch]@26 | |
4323 unsigned __int64 v20; // [sp+1Ch] [bp-34h]@7 | |
4324 int minutes; // [sp+2Ch] [bp-24h]@26 | |
4325 int years; // [sp+34h] [bp-1Ch]@26 | |
4326 int weeks; // [sp+38h] [bp-18h]@26 | |
4327 int v26; // [sp+3Ch] [bp-14h]@15 | |
4328 int days; // [sp+3Ch] [bp-14h]@26 | |
4329 int months; // [sp+40h] [bp-10h]@26 | |
4330 __int16 v29; // [sp+46h] [bp-Ah]@9 | |
4331 __int16 v30; // [sp+48h] [bp-8h]@9 | |
4332 __int16 v31; // [sp+4Ah] [bp-6h]@9 | |
4333 __int16 v32; // [sp+4Ch] [bp-4h]@9 | |
4334 __int16 v33; // [sp+4Eh] [bp-2h]@9 | |
4335 | |
4336 for (uint i = 0; i < uLevelEVT_NumEvents; ++i) | |
781 | 4337 { |
1980 | 4338 EventIndex pEvent = pLevelEVT_Index[i]; |
4339 | |
4340 _evt_raw* _evt = (_evt_raw *)(&pLevelEVT[pEvent.uEventOffsetInEVT]); | |
363 | 4341 |
4342 if (_evt->_e_type == EVENT_PlaySound) | |
781 | 4343 { |
601 | 4344 pSoundList->LoadSound(EVT_DWORD(_evt->v5), 0); |
781 | 4345 } |
363 | 4346 else if (_evt->_e_type == EVENT_OnMapReload) |
781 | 4347 { |
1052 | 4348 EventProcessor(pEvent.uEventID, 0, 0, pEvent.event_sequence_num); |
781 | 4349 } |
1052 | 4350 else if (_evt->_e_type == EVENT_OnTimer || _evt->_e_type == EVENT_Initialize) |
781 | 4351 { |
363 | 4352 v3 = &array_5B5928_timers[dword_5B65C8_timers_count]; |
810 | 4353 v20 = pOutdoor->loc_time.uLastVisitDay; |
363 | 4354 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) |
4355 v20 = pIndoor->stru1.uLastVisitDay; | |
4356 | |
4357 v3->timer_evt_type = _evt->_e_type; | |
4358 v3->timer_evt_ID = pEvent.uEventID; | |
4359 v3->timer_evt_seq_num = pEvent.event_sequence_num; | |
4360 | |
4361 v3->field_10 = _evt->v5; | |
4362 v3->field_12 = _evt->v6; | |
4363 v3->field_14 = _evt->v7; | |
4364 v3->field_16 = _evt->v8; | |
4365 v3->field_18 = _evt->v9; | |
4366 v3->field_1A = _evt->v10; | |
4367 | |
4368 | |
4369 v6 = ((unsigned short)_evt->v12 << 8) + _evt->v11; | |
4370 | |
789 | 4371 v3->time_left_to_fire = ((unsigned short)_evt->v12 << 8) + _evt->v11; |
4372 v3->fire_interval = ((unsigned short)_evt->v12 << 8) + _evt->v11; | |
1052 | 4373 if (v3->timer_evt_type == EVENT_Initialize && !(short)v6 ) |
781 | 4374 { |
363 | 4375 if ( v20 ) |
4376 v18 = pParty->uTimePlayed - v20; | |
4377 else | |
4378 v18 = 0i64; | |
4379 v26 = (signed int)(signed __int64)((double)(signed __int64)v18 * 0.234375) / 60 / 60 / 24; | |
4380 | |
4381 if ( v26 / 7 / 4 / 12 ) | |
781 | 4382 { |
363 | 4383 if ( v3->field_10 ) |
781 | 4384 { |
363 | 4385 ++dword_5B65C8_timers_count; |
789 | 4386 v3->next_fire_time = 0; |
363 | 4387 continue; |
4388 } | |
781 | 4389 } |
363 | 4390 if (v26 / 7 / 4 != 0 && v3->field_12 != 0 || |
4391 v26 / 7 != 0 && v3->field_14 != 0 || | |
4392 v26 != 0 || !v20) | |
781 | 4393 { |
363 | 4394 ++dword_5B65C8_timers_count; |
789 | 4395 v3->next_fire_time = 0; |
363 | 4396 continue; |
4397 } | |
781 | 4398 } |
363 | 4399 else |
781 | 4400 { |
363 | 4401 v8 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375); |
4402 v9 = v8; | |
4403 v10 = (signed int)v8 / 60; | |
4404 minutes = v10 % 60; | |
4405 v11 = (signed int)(v10 / 60); | |
4406 v12 = v11 % 24; | |
4407 v13 = (signed int)(v11 / 24); | |
4408 days = v13 % 7; | |
4409 v14 = (signed int)(v13 / 7); | |
4410 v15 = v14 % 4; | |
4411 v16 = (signed int)(v14 / 4); | |
4412 years = v16 / 12; | |
4413 | |
1980 | 4414 unsigned __int64 _1 = (unsigned __int64)((double)pParty->uTimePlayed * 0.234375) >> 32; |
4415 __int64 _2 = ((__int64)v9 << 32) | _1; | |
363 | 4416 |
4417 seconds = _2 % 60; | |
4418 //v19 = (signed __int64)__PAIR__((unsigned __int64)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) >> 32, | |
4419 // v9) | |
4420 // % 60; | |
4421 | |
4422 hours = v12; | |
4423 weeks = v15; | |
4424 months = v16 % 12; | |
4425 if ( v3->field_10 ) | |
781 | 4426 { |
363 | 4427 ++years; |
781 | 4428 } |
363 | 4429 else |
781 | 4430 { |
363 | 4431 if ( v3->field_12 ) |
781 | 4432 { |
4433 ++months; | |
4434 } | |
4435 else | |
4436 { | |
4437 if ( v3->field_14 ) | |
363 | 4438 { |
781 | 4439 ++weeks; |
363 | 4440 } |
781 | 4441 else |
363 | 4442 { |
4443 ++days; | |
4444 minutes = v3->field_18; | |
4445 hours = v3->field_16; | |
4446 seconds = v3->field_1A; | |
4447 } | |
4448 } | |
781 | 4449 } |
789 | 4450 v3->next_fire_time = (signed __int64)((double)((seconds |
363 | 4451 + 60 * minutes |
4452 + 3600 * hours | |
4453 + 0x93A80 * weeks | |
4454 + 0x15180 * days | |
4455 + 0x24EA00 * (months + 12i64 * years)) << 7) | |
4456 * 0.033333335); | |
4457 | |
4458 ++dword_5B65C8_timers_count; | |
4459 } | |
4460 } | |
4461 } | |
781 | 4462 } |
0 | 4463 |
4464 //----- (00444360) -------------------------------------------------------- | |
1411 | 4465 void Level_LoadEvtAndStr(const char *pLevelName) |
0 | 4466 { |
4467 char pContainerName[120]; // [sp+8h] [bp-98h]@1 | |
4468 | |
4469 sprintf(pContainerName, "%s.evt", pLevelName); | |
1541 | 4470 uLevelEVT_Size = LoadEventsToBuffer(pContainerName, pLevelEVT.data(), 9216); |
0 | 4471 |
4472 sprintf(pContainerName, "%s.str", pLevelName); | |
1541 | 4473 uLevelStrFileSize = LoadEventsToBuffer(pContainerName, pLevelStr.data(), 9216); |
0 | 4474 if (uLevelStrFileSize) |
4475 LoadLevel_InitializeLevelStr(); | |
4476 } | |
4477 | |
4478 //----- (00444D80) -------------------------------------------------------- | |
1411 | 4479 int GetTravelTime() |
0 | 4480 { |
4481 signed int v0; // esi@1 | |
4482 | |
4483 v0 = uDefaultTravelTime_ByFoot; | |
652 | 4484 if ( CheckHiredNPCSpeciality(Guide) ) |
0 | 4485 --v0; |
652 | 4486 if ( CheckHiredNPCSpeciality(Tracker) ) |
0 | 4487 v0 -= 2; |
652 | 4488 if ( CheckHiredNPCSpeciality(Pathfinder) ) |
0 | 4489 v0 -= 3; |
652 | 4490 if ( CheckHiredNPCSpeciality(Explorer) ) |
0 | 4491 --v0; |
4492 if ( v0 < 1 ) | |
4493 v0 = 1; | |
4494 return v0; | |
4495 } | |
4496 // 6BD07C: using guessed type int uDefaultTravelTime_ByFoot; | |
4497 | |
4498 //----- (004451A8) -------------------------------------------------------- | |
4499 void __fastcall sub_4451A8_press_any_key(int a1, int a2, int a4) | |
4500 { | |
4501 int v3; // esi@1 | |
4502 int v4; // edi@1 | |
4503 | |
4504 v3 = a2; | |
4505 v4 = a1; | |
4506 if ( !pGUIWindow2 ) | |
4507 { | |
4508 if ( pParty->uFlags & 2 ) | |
4509 pGame->Draw(); | |
1052 | 4510 pAudioPlayer->StopChannels(-1, -1); |
0 | 4511 pMiscTimer->Pause(); |
4512 pEventTimer->Pause(); | |
4513 dword_5C3418 = v4; | |
4514 dword_5C341C = v3; | |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
515
diff
changeset
|
4515 _591094_decoration = activeLevelDecoration; |
948 | 4516 pGUIWindow2 = GUIWindow::Create(0, 0, 640, 480, WINDOW_GreetingNPC, a4, 0); |
4517 pGUIWindow2->CreateButton( 61, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0); | |
4518 pGUIWindow2->CreateButton(177, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0); | |
4519 pGUIWindow2->CreateButton(292, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0); | |
4520 pGUIWindow2->CreateButton(407, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0); | |
0 | 4521 } |
4522 } | |
4523 | |
4524 //----- (004452BB) -------------------------------------------------------- | |
1546 | 4525 void sub_4452BB() |
0 | 4526 { |
4527 pGUIWindow2->Release(); | |
4528 pGUIWindow2 = 0; | |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
515
diff
changeset
|
4529 activeLevelDecoration = _591094_decoration; |
1052 | 4530 EventProcessor(dword_5C3418, 0, 1, dword_5C341C); |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
515
diff
changeset
|
4531 activeLevelDecoration = NULL; |
0 | 4532 pEventTimer->Resume(); |
4533 } | |
4534 | |
4535 //----- (004465DF) -------------------------------------------------------- | |
4536 int sub_4465DF_check_season(int a1) | |
4537 { | |
4538 unsigned int v1; // eax@1 | |
4539 unsigned int v2; // edx@1 | |
4540 int v3; // ecx@2 | |
4541 int v4; // ecx@3 | |
4542 char v6; // zf@9 | |
4543 | |
4544 v1 = pParty->uCurrentMonth + 1; | |
4545 v2 = pParty->uDaysPlayed + 1; | |
4546 if ( a1 ) | |
4547 { | |
4548 v3 = a1 - 1; | |
4549 if ( v3 ) | |
4550 { | |
4551 v4 = v3 - 1; | |
4552 if ( v4 ) | |
4553 { | |
4554 if ( v4 != 1 ) | |
4555 return 0; | |
4556 if ( v1 != 12 ) | |
4557 { | |
4558 if ( (signed int)v1 >= 1 && (signed int)v1 <= 2 ) | |
4559 return 1; | |
4560 v6 = v1 == 3; | |
4561 LABEL_24: | |
4562 if ( !v6 || (signed int)v2 >= 21 ) | |
4563 return 0; | |
4564 return 1; | |
4565 } | |
4566 } | |
4567 else | |
4568 { | |
4569 if ( v1 != 9 ) | |
4570 { | |
4571 if ( (signed int)v1 >= 10 && (signed int)v1 <= 11 ) | |
4572 return 1; | |
4573 v6 = v1 == 12; | |
4574 goto LABEL_24; | |
4575 } | |
4576 } | |
4577 } | |
4578 else | |
4579 { | |
4580 if ( v1 != 6 ) | |
4581 { | |
4582 if ( (signed int)v1 >= 7 && (signed int)v1 <= 8 ) | |
4583 return 1; | |
4584 v6 = v1 == 9; | |
4585 goto LABEL_24; | |
4586 } | |
4587 } | |
4588 } | |
4589 else | |
4590 { | |
4591 if ( v1 != 3 ) | |
4592 { | |
4593 if ( (signed int)v1 >= 4 && (signed int)v1 <= 5 ) | |
4594 return 1; | |
4595 v6 = v1 == 6; | |
4596 goto LABEL_24; | |
4597 } | |
4598 } | |
4599 if ( (signed int)v2 >= 21 ) | |
4600 return 1; | |
4601 return 0; | |
4602 } | |
4603 | |
4604 //----- (0044861E) -------------------------------------------------------- | |
4605 void __fastcall sub_44861E_set_texture(unsigned int uFaceCog, const char *pFilename) | |
4606 { | |
4607 unsigned int v2; // eax@2 | |
4608 unsigned __int16 v3; // di@2 | |
4609 signed int v4; // esi@5 | |
4610 BLVFace *v5; // eax@7 | |
4611 unsigned int *v6; // eax@8 | |
4612 char *v7; // eax@9 | |
4613 int v8; // edi@16 | |
4614 char *v9; // esi@16 | |
4615 ODMFace *v10; // eax@17 | |
4616 unsigned int *v11; // eax@19 | |
4617 unsigned __int16 v12; // [sp+Ch] [bp-18h]@2 | |
4618 const char *Str2; // [sp+10h] [bp-14h]@1 | |
4619 unsigned int v14; // [sp+14h] [bp-10h]@1 | |
4620 signed int v15; // [sp+18h] [bp-Ch]@14 | |
4621 int v16; // [sp+1Ch] [bp-8h]@15 | |
4622 signed int v17; // [sp+20h] [bp-4h]@4 | |
4623 signed int v18; // [sp+20h] [bp-4h]@16 | |
4624 | |
4625 Str2 = pFilename; | |
4626 v14 = uFaceCog; | |
4627 if ( uFaceCog ) | |
4628 { | |
4629 v2 = pBitmaps_LOD->LoadTexture(pFilename); | |
4630 v3 = v2; | |
4631 v12 = v2; | |
4632 if ( v2 != -1 ? (int)&pBitmaps_LOD->pTextures[v2] : 0 ) | |
4633 { | |
4634 pBitmaps_LOD->pTextures[v2].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[v2].palette_id1); | |
4635 | |
4636 if ( uCurrentlyLoadedLevelType == 1 ) | |
4637 { | |
4638 v17 = 1; | |
4639 if ( (signed int)pIndoor->uNumFaceExtras > 1 ) | |
4640 { | |
4641 v4 = 1; | |
4642 do | |
4643 { | |
4644 if ( pIndoor->pFaceExtras[v4].sCogNumber == v14 ) | |
4645 { | |
4646 v5 = &pIndoor->pFaces[pIndoor->pFaceExtras[v4].field_C]; | |
4647 if ( BYTE1(v5->uAttributes) & 0x40 ) | |
4648 { | |
4649 pIndoor->pFaces[pIndoor->pFaceExtras[v4].field_C].uBitmapID = pTextureFrameTable->FindTextureByName( | |
4650 Str2); | |
4651 v6 = (unsigned int *)&pIndoor->pFaces[pIndoor->pFaceExtras[v4].field_C].uBitmapID; | |
4652 if ( *(_WORD *)v6 ) | |
4653 { | |
4654 pTextureFrameTable->LoadAnimationSequenceAndPalettes(*(_WORD *)v6); | |
4655 } | |
4656 else | |
4657 { | |
4658 *(_WORD *)v6 = v3; | |
4659 v7 = (char *)&pIndoor->pFaces[pIndoor->pFaceExtras[v4].field_C].uAttributes; | |
4660 v7[1] &= 0xBFu; | |
4661 } | |
4662 } | |
4663 else | |
4664 { | |
4665 v5->uBitmapID = v3; | |
4666 } | |
4667 } | |
4668 ++v17; | |
4669 ++v4; | |
4670 } | |
4671 while ( v17 < (signed int)pIndoor->uNumFaceExtras ); | |
4672 } | |
4673 pParty->uFlags |= 2u; | |
4674 } | |
4675 else | |
4676 { | |
4677 v15 = 0; | |
4678 if ( (signed int)pOutdoor->uNumBModels > 0 ) | |
4679 { | |
4680 v16 = 0; | |
4681 do | |
4682 { | |
4683 v8 = 0; | |
4684 v9 = (char *)&pOutdoor->pBModels[v16].pVertices; | |
4685 v18 = 0; | |
4686 if ( (signed int)pOutdoor->pBModels[v16].uNumFaces > 0 ) | |
4687 { | |
4688 do | |
4689 { | |
4690 v10 = (ODMFace *)(v8 + *((_DWORD *)v9 + 4)); | |
4691 if ( v10->sCogNumber == v14 ) | |
4692 { | |
4693 if ( BYTE1(v10->uAttributes) & 0x40 ) | |
4694 { | |
4695 *(_WORD *)(*((_DWORD *)v9 + 4) + v8 + 272) = pTextureFrameTable->FindTextureByName( | |
4696 Str2); | |
4697 v11 = (unsigned int *)(*((_DWORD *)v9 + 4) + v8 + 272); | |
4698 if ( *(_WORD *)v11 ) | |
4699 { | |
4700 pTextureFrameTable->LoadAnimationSequenceAndPalettes(*(_WORD *)v11); | |
4701 } | |
4702 else | |
4703 { | |
4704 *(_WORD *)v11 = v12; | |
4705 *(_BYTE *)(*((_DWORD *)v9 + 4) + v8 + 29) &= 0xBFu; | |
4706 } | |
4707 } | |
4708 else | |
4709 { | |
4710 v10->uTextureID = v12; | |
4711 } | |
4712 } | |
4713 ++v18; | |
4714 v8 += 308; | |
4715 } | |
4716 while ( v18 < *((_DWORD *)v9 + 2) ); | |
4717 } | |
4718 ++v15; | |
4719 ++v16; | |
4720 } | |
4721 while ( v15 < (signed int)pOutdoor->uNumBModels ); | |
4722 } | |
4723 } | |
4724 pParty->uFlags |= 2u; | |
4725 } | |
4726 } | |
4727 } | |
4728 | |
4729 //----- (0044882F) -------------------------------------------------------- | |
1515 | 4730 void __fastcall SetDecorationSprite(uint16_t uCog, bool bHide, const char *pFileName) |
0 | 4731 { |
1515 | 4732 for (size_t i = 0; i < uNumLevelDecorations; i++) |
4733 { | |
4734 if (pLevelDecorations[i].uCog == uCog) | |
0 | 4735 { |
1515 | 4736 if (pFileName && strcmp(pFileName, "0")) |
0 | 4737 { |
1515 | 4738 pLevelDecorations[i].uDecorationDescID = pDecorationList->GetDecorIdByName(pFileName); |
4739 pDecorationList->InitializeDecorationSprite(pLevelDecorations[i].uDecorationDescID); | |
0 | 4740 } |
1515 | 4741 |
4742 if (bHide) | |
4743 pLevelDecorations[i].uFlags &= ~LEVEL_DECORATION_INVISIBLE; | |
4744 else | |
4745 pLevelDecorations[i].uFlags |= LEVEL_DECORATION_INVISIBLE; | |
4746 | |
4747 pParty->uFlags |= 2u; | |
0 | 4748 } |
4749 } | |
4750 } | |
4751 | |
4752 //----- (0044892E) -------------------------------------------------------- | |
4753 void __fastcall sub_44892E_set_faces_bit(int sCogNumber, int bit, int on) | |
4754 { | |
4755 signed int v3; // esi@2 | |
4756 signed int v4; // ecx@4 | |
4757 char *v5; // eax@6 | |
4758 int v6; // edi@13 | |
4759 char *v7; // esi@13 | |
4760 signed int v8; // ecx@13 | |
4761 ODMFace *v9; // eax@14 | |
4762 int v10; // [sp+0h] [bp-Ch]@1 | |
4763 signed int v11; // [sp+4h] [bp-8h]@11 | |
4764 int v12; // [sp+8h] [bp-4h]@12 | |
4765 | |
4766 v10 = sCogNumber; | |
4767 if ( sCogNumber ) | |
4768 { | |
4769 v3 = 1; | |
4770 if ( uCurrentlyLoadedLevelType == 1 ) | |
4771 { | |
4772 if ( (signed int)pIndoor->uNumFaceExtras > 1 ) | |
4773 { | |
4774 v4 = 1; | |
4775 do | |
4776 { | |
4777 if ( pIndoor->pFaceExtras[v4].sCogNumber == v10 ) | |
4778 { | |
4779 v5 = (char *)&pIndoor->pFaces[pIndoor->pFaceExtras[v4].field_C].uAttributes; | |
4780 if ( on ) | |
4781 *(_DWORD *)v5 |= bit; | |
4782 else | |
4783 *(_DWORD *)v5 &= ~bit; | |
4784 } | |
4785 ++v3; | |
4786 ++v4; | |
4787 } | |
4788 while ( v3 < (signed int)pIndoor->uNumFaceExtras ); | |
4789 } | |
4790 pParty->uFlags |= 2u; | |
4791 } | |
4792 else | |
4793 { | |
4794 v11 = 0; | |
4795 if ( (signed int)pOutdoor->uNumBModels > 0 ) | |
4796 { | |
4797 v12 = 0; | |
4798 do | |
4799 { | |
4800 v6 = 0; | |
4801 v7 = (char *)&pOutdoor->pBModels[v12].pVertices; | |
4802 v8 = 0; | |
4803 if ( (signed int)pOutdoor->pBModels[v12].uNumFaces > 0 ) | |
4804 { | |
4805 do | |
4806 { | |
4807 v9 = (ODMFace *)(v6 + *((_DWORD *)v7 + 4)); | |
4808 if ( v9->sCogNumber == v10 ) | |
4809 { | |
4810 if ( on ) | |
4811 v9->uAttributes |= bit; | |
4812 else | |
4813 v9->uAttributes &= ~bit; | |
4814 } | |
4815 ++v8; | |
4816 v6 += 308; | |
4817 } | |
4818 while ( v8 < *((_DWORD *)v7 + 2) ); | |
4819 } | |
4820 ++v11; | |
4821 ++v12; | |
4822 } | |
4823 while ( v11 < (signed int)pOutdoor->uNumBModels ); | |
4824 } | |
4825 } | |
4826 pParty->uFlags |= 2u; | |
4827 } | |
4828 } | |
4829 | |
4830 //----- (00448A98) -------------------------------------------------------- | |
4831 void __fastcall ToggleActorGroupFlag(unsigned int uGroupID, unsigned int uFlag, unsigned int bToggle) | |
4832 { | |
4833 unsigned int v3; // ebx@1 | |
4834 unsigned int v4; // ebp@1 | |
4835 signed int v5; // edi@1 | |
82 | 4836 Actor *v6; // esi@4 |
0 | 4837 size_t v7; // ecx@10 |
82 | 4838 Actor *v8; // eax@11 |
0 | 4839 unsigned __int16 v9; // dx@14 |
4840 | |
4841 v4 = uGroupID; | |
4842 v5 = Standing; | |
4843 v3 = uFlag; | |
4844 if ( uGroupID ) | |
4845 { | |
4846 if ( bToggle ) | |
4847 { | |
4848 if ( (signed int)uNumActors > Standing ) | |
4849 { | |
1202 | 4850 v6 = pActors.data();//[0].uAttributes; |
0 | 4851 do |
4852 { | |
82 | 4853 if ( v6->uGroup == v4 ) |
4854 { | |
4855 v6->uAttributes |= v3; | |
0 | 4856 if ( v3 == 0x10000 ) |
4857 { | |
82 | 4858 v6->uAIState = Disabled; |
4859 v6->UpdateAnimation(); | |
0 | 4860 } |
4861 } | |
4862 ++v5; | |
82 | 4863 ++v6; |
0 | 4864 } |
4865 while ( v5 < (signed int)uNumActors ); | |
4866 } | |
4867 } | |
4868 else | |
4869 { | |
4870 v7 = uNumActors; | |
4871 if ( (signed int)uNumActors > Standing ) | |
4872 { | |
1202 | 4873 v8 = pActors.data();//[0].uAIState; |
0 | 4874 do |
4875 { | |
82 | 4876 if ( v8->uGroup == v4 ) |
0 | 4877 { |
4878 if ( v3 == 0x10000 ) | |
4879 { | |
82 | 4880 v9 = v8->uAIState; |
4881 if ( v8->uAIState != Dead ) | |
0 | 4882 { |
4883 if ( v9 != 4 && v9 != 11 ) | |
82 | 4884 v8->uAIState = Standing; |
4885 } | |
4886 } | |
4887 LODWORD(v8->uAttributes) &= ~v3; | |
4888 } | |
4889 ++v8; | |
0 | 4890 --v7; |
4891 } | |
4892 while ( v7 ); | |
4893 } | |
4894 } | |
4895 } | |
4896 } | |
4897 | |
4898 //----- (00448B45) -------------------------------------------------------- | |
1458 | 4899 void GameUI_StatusBar_UpdateTimedString(unsigned int bForceHide) |
0 | 4900 { |
783 | 4901 if ( bForceHide || GameUI_Footer_TimeLeft && GetTickCount() >= GameUI_Footer_TimeLeft ) |
4902 GameUI_Footer_TimeLeft = 0; | |
0 | 4903 } |
4904 | |
4905 //----- (00448B67) -------------------------------------------------------- | |
790 | 4906 void OnTimer(int __unused) |
4907 { | |
789 | 4908 if (pEventTimer->bPaused) |
4909 return; | |
4910 | |
790 | 4911 if (__unused) |
4912 _5773C0_unused = 0; | |
789 | 4913 |
1980 | 4914 long long v13 = (signed __int64)(pParty->uTimePlayed - _5773B8_event_timer) / 128; |
789 | 4915 if (!v13) |
4916 return; | |
4917 | |
4918 //uint _v2v3 = pParty->uTimePlayed; | |
4919 //v3 = HIDWORD(pParty->uTimePlayed); | |
4920 //v2 = LODWORD(pParty->uTimePlayed); | |
4921 | |
4922 _5773B8_event_timer = pParty->uTimePlayed; | |
4923 | |
4924 for (uint i = 0; i < dword_5B65C8_timers_count; ++i) | |
4925 { | |
4926 //v4 = (char *)&array_5B5928_timers[0].field_C; | |
1980 | 4927 stru176* timer = &array_5B5928_timers[i]; |
789 | 4928 //while ( 1 ) |
4929 //{ | |
4930 //v5 = *(short *)v4; | |
4931 if (timer->time_left_to_fire) | |
4932 { | |
4933 if (v13 < timer->time_left_to_fire) | |
4934 timer->time_left_to_fire -= v13; | |
4935 else | |
4936 { | |
4937 timer->time_left_to_fire = timer->fire_interval; | |
1052 | 4938 EventProcessor(timer->timer_evt_ID, 0, 1, timer->timer_evt_seq_num); |
789 | 4939 } |
4940 } | |
4941 else | |
4942 { | |
4943 if (timer->next_fire_time < pParty->uTimePlayed) | |
4944 { | |
4945 uint next_trigger_time = 1 * 60 * 60 * 24; // 1 day | |
4946 if (timer->field_10) | |
4947 next_trigger_time = 336 * 60 * 60 * 24; // 1 year | |
4948 else if (timer->field_12) | |
4949 next_trigger_time = 28 * 60 * 60 * 24; // 1 month | |
4950 else if (timer->field_14) | |
4951 next_trigger_time = 7 * 60 * 60 * 24; // 1 week | |
4952 | |
4953 timer->next_fire_time += (next_trigger_time * 128) / 3.0f; | |
1052 | 4954 if (timer->next_fire_time < pParty->uTimePlayed) // make sure in wont fire several times in a row if big time interval has lapsed |
789 | 4955 timer->next_fire_time = pParty->uTimePlayed; |
4956 | |
1052 | 4957 EventProcessor(timer->timer_evt_ID, 0, 1, timer->timer_evt_seq_num); |
0 | 4958 } |
4959 } | |
4960 } | |
4961 } | |
4962 | |
4963 //----- (00481D77) -------------------------------------------------------- | |
4964 void _outdoor_project(RenderVertexSoft *v) | |
4965 { | |
4966 double v1; // st7@1 | |
4967 double v2; // st7@1 | |
4968 | |
4969 v1 = 1.0 / (v->vWorldViewPosition.x + 0.0000001); | |
168 | 4970 v->_rhw = v1; |
1637 | 4971 v2 = v1 * (double)pODMRenderParams->int_fov_rad; |
0 | 4972 v->vWorldViewProjX = (double)pViewport->uScreenCenterX - v2 * v->vWorldViewPosition.y; |
4973 v->vWorldViewProjY = (double)pViewport->uScreenCenterY - v2 * v->vWorldViewPosition.z; | |
4974 } | |
4975 | |
4976 //----- (00448CF4) -------------------------------------------------------- | |
4977 void __fastcall sub_448CF4_spawn_monsters(__int16 typeindex, __int16 level, int count, int x, int y, int z, int group, unsigned int uUniqueName) | |
4978 { | |
4979 __int16 v8; // di@1 | |
4980 __int16 v9; // si@1 | |
4981 unsigned int v10; // eax@1 | |
4982 size_t v11; // ebx@2 | |
4983 signed int v12; // esi@2 | |
35 | 4984 Actor *pActor;//Actor_uYawAngle_cr *v13; // ebx@3 |
0 | 4985 AIDirection a3; // [sp+Ch] [bp-50h]@2 |
4986 AIDirection v15; // [sp+28h] [bp-34h]@2 | |
4987 //SpawnPointMM7 v16; // [sp+44h] [bp-18h]@1 | |
4988 | |
4989 v8 = typeindex; | |
4990 v9 = level; | |
4991 | |
4992 SpawnPointMM7 v16; // [sp+44h] [bp-18h]@1 | |
4993 //SpawnPointMM7::SpawnPointMM7(&v16); | |
4994 | |
4995 v16.vPosition.x = x; | |
4996 v16.vPosition.y = y; | |
4997 v16.vPosition.z = z; | |
4998 v16.uGroup = group; | |
4999 v16.uRadius = 32; | |
5000 v16.uKind = 3; | |
5001 v16.uIndex = v8 + 2 * v9 + v9; | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1470
diff
changeset
|
5002 v10 = pMapStats->GetMapInfo(pCurrentMapName); |
0 | 5003 if ( v10 ) |
5004 { | |
5005 v11 = uNumActors; | |
1546 | 5006 SpawnEncounter(&pMapStats->pInfos[v10], &v16, 0, count, 0); |
1910
8d3723ca71e6
Actor::GetDirectionInfo changed the signature to a less confusing one
Grumpy7
parents:
1905
diff
changeset
|
5007 Actor::GetDirectionInfo(PID(OBJECT_Actor, v11), 4u, &v15, 1); |
0 | 5008 v12 = v11; |
5009 if ( (signed int)v11 < (signed int)uNumActors ) | |
5010 { | |
35 | 5011 for ( pActor = &pActors[v11]; v12 < (signed int)uNumActors; ++pActor ) |
5012 { | |
5013 pActor->PrepareSprites(0); | |
0 | 5014 ++v12; |
35 | 5015 pActor->uYawAngle = v15.uYawAngle; |
5016 pActor->dword_000334_unique_name = uUniqueName; | |
5017 } | |
0 | 5018 } |
5019 } | |
5020 } | |
5021 | |
5022 | |
5023 //----- (0044987B) -------------------------------------------------------- | |
783 | 5024 void sub_44987B(const char *pMapName, MapStartPoint start_point) |
0 | 5025 { |
5026 const char *v2; // edi@1 | |
5027 | |
5028 v2 = pMapName; | |
5029 pAudioPlayer->StopChannels(-1, -1); | |
434 | 5030 pGameLoadingUI_ProgressBar->Initialize(GUIProgressBar::TYPE_None); |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1470
diff
changeset
|
5031 if ( _stricmp(pCurrentMapName, v2) ) |
0 | 5032 SaveGame(1, 0); |
783 | 5033 |
978 | 5034 uGameState = GAME_STATE_2; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1470
diff
changeset
|
5035 strcpy(pCurrentMapName, v2); |
783 | 5036 uLevel_StartingPointType = start_point; |
0 | 5037 } |
5038 // 6BE35C: using guessed type int uLevel_StartingPointType; | |
5039 | |
5040 //----- (004498D5) -------------------------------------------------------- | |
783 | 5041 void TeleportToStartingPoint(MapStartPoint point) |
5042 { | |
5043 //unsigned int v1; // ecx@2 | |
5044 //int v2; // ecx@3 | |
5045 //int v3; // ecx@4 | |
0 | 5046 unsigned __int16 v4; // ax@11 |
5047 signed int v5; // ecx@12 | |
5048 LevelDecoration *v6; // edx@13 | |
5049 signed int v7; // ecx@17 | |
5050 int v8; // eax@17 | |
5051 int v9; // ecx@17 | |
5052 const char *v10; // [sp-4h] [bp-84h]@6 | |
5053 char pName[128]; // [sp+8h] [bp-78h]@11 | |
5054 | |
783 | 5055 switch (point) |
5056 { | |
5057 case MapStartPoint_Party: v10 = "Party Start"; break; | |
5058 case MapStartPoint_North: v10 = "North Start"; break; | |
5059 case MapStartPoint_South: v10 = "South Start"; break; | |
5060 case MapStartPoint_East: v10 = "East Start"; break; | |
5061 case MapStartPoint_West: v10 = "West Start"; break; | |
1546 | 5062 default: |
5063 Error("Invalid enum value: %u", point); | |
783 | 5064 } |
5065 | |
0 | 5066 strcpy(pName, v10); |
5067 v4 = pDecorationList->GetDecorIdByName(pName); | |
5068 if ( v4 ) | |
5069 { | |
5070 v5 = 0; | |
5071 if ( (signed int)uNumLevelDecorations > 0 ) | |
5072 { | |
1202 | 5073 v6 = pLevelDecorations.data(); |
0 | 5074 while ( v6->uDecorationDescID != (signed __int16)v4 ) |
5075 { | |
5076 ++v5; | |
5077 ++v6; | |
5078 if ( v5 >= (signed int)uNumLevelDecorations ) | |
5079 goto LABEL_20; | |
5080 } | |
5081 v7 = v5; | |
5082 pParty->vPosition.x = pLevelDecorations[v7].vPosition.x; | |
5083 pParty->vPosition.y = pLevelDecorations[v7].vPosition.y; | |
5084 pParty->vPosition.z = pLevelDecorations[v7].vPosition.z; | |
5085 pParty->uFallStartY = pParty->vPosition.z; | |
5086 v8 = (signed int)(stru_5C6E00->uIntegerHalfPi * pLevelDecorations[v7].field_1A) / 90; | |
5087 v9 = pLevelDecorations[v7].field_10_y_rot; | |
5088 pParty->sRotationY = v8; | |
5089 if ( v9 ) | |
5090 pParty->sRotationY = v9; | |
5091 pParty->sRotationX = 0; | |
5092 pParty->uFallSpeed = 0; | |
5093 } | |
5094 LABEL_20: | |
5095 if ( dword_5B65C0 ) | |
5096 { | |
5097 if ( _5B65A8_npcdata_uflags_or_other ) | |
5098 pParty->vPosition.x = _5B65A8_npcdata_uflags_or_other; | |
5099 if ( _5B65AC_npcdata_fame_or_other ) | |
5100 pParty->vPosition.y = _5B65AC_npcdata_fame_or_other; | |
5101 if ( _5B65B0_npcdata_rep_or_other ) | |
5102 { | |
5103 pParty->vPosition.z = _5B65B0_npcdata_rep_or_other; | |
5104 pParty->uFallStartY = _5B65B0_npcdata_rep_or_other; | |
5105 } | |
1516
f3cd08b89476
Fix assertion error when exiting Harmondale's castle. Possibly original bug.
yoctozepto
parents:
1515
diff
changeset
|
5106 if ( _5B65B4_npcdata_loword_house_or_other != -1 ) |
0 | 5107 pParty->sRotationY = _5B65B4_npcdata_loword_house_or_other; |
5108 if ( _5B65B8_npcdata_hiword_house_or_other ) | |
5109 pParty->sRotationX = _5B65B8_npcdata_hiword_house_or_other; | |
5110 if ( dword_5B65BC ) | |
5111 pParty->uFallSpeed = dword_5B65BC; | |
5112 } | |
5113 _5B65B4_npcdata_loword_house_or_other = -1; | |
5114 dword_5B65C0 = 0; | |
5115 dword_5B65BC = 0; | |
5116 _5B65B8_npcdata_hiword_house_or_other = 0; | |
5117 _5B65B0_npcdata_rep_or_other = 0; | |
5118 _5B65AC_npcdata_fame_or_other = 0; | |
5119 _5B65A8_npcdata_uflags_or_other = 0; | |
5120 } | |
5121 } | |
1035 | 5122 |
5123 | |
0 | 5124 |
5125 //----- (00449A49) -------------------------------------------------------- | |
5126 __int16 __fastcall sub_449A49_door_switch_animation(unsigned int uDoorID, int a2) | |
5127 { | |
5128 int v2; // eax@1 | |
5129 int v3; // ebx@1 | |
5130 signed int v4; // esi@2 | |
5131 int v5; // edx@2 | |
5132 BLVDoor *v6; // ecx@8 | |
5133 unsigned int v7; // edx@18 | |
5134 signed int v8; // esi@19 | |
5135 int v9; // eax@19 | |
1545 | 5136 //char Args; // [sp+Ch] [bp-78h]@6 |
0 | 5137 |
5138 LOWORD(v2) = LOWORD(pIndoor->pDoors); | |
5139 v3 = a2; | |
5140 if ( !pIndoor->pDoors ) | |
5141 return v2; | |
5142 v4 = 0; | |
5143 v5 = (int)&pIndoor->pDoors->uDoorID; | |
5144 do | |
5145 { | |
5146 if ( *(int *)v5 == uDoorID ) | |
5147 break; | |
5148 ++v4; | |
5149 v5 += 80; | |
5150 } | |
5151 while ( v4 < 200 ); | |
5152 if ( v4 >= 200 ) | |
5153 { | |
1545 | 5154 Error("Unable to find Door ID: %i!", uDoorID); |
0 | 5155 } |
5156 v6 = &pIndoor->pDoors[v4]; | |
5157 if ( v3 == 2 ) | |
5158 { | |
5159 LOWORD(v2) = v6->uState; | |
5160 if ( (short)v2 == 3 || (short)v2 == 1 ) | |
5161 return v2; | |
5162 if ( (short)v2 ) | |
5163 goto LABEL_14; | |
5164 } | |
5165 else | |
5166 { | |
5167 if ( !v3 ) | |
5168 { | |
5169 LABEL_14: | |
5170 LOWORD(v2) = v6->uState; | |
5171 if ( (short)v2 && (short)v2 != 3 ) | |
5172 { | |
5173 v6->uState = BLVDoor::Closing; | |
5174 if ( (short)v2 == 2 ) | |
5175 { | |
5176 LABEL_17: | |
5177 v6->uTimeSinceTriggered = 0; | |
5178 return v2; | |
5179 } | |
5180 v7 = v6->uTimeSinceTriggered; | |
5181 v2 = 15360; | |
5182 if ( v7 != 15360 ) | |
5183 { | |
5184 v8 = v6->uOpenSpeed; | |
5185 v9 = v6->uCloseSpeed; | |
5186 LABEL_26: | |
5187 v2 = (v6->uMoveLength << 7) / v8 - ((signed int)(v7 * v9) / 128 << 7) / v8; | |
5188 goto LABEL_27; | |
5189 } | |
5190 goto LABEL_27; | |
5191 } | |
5192 return v2; | |
5193 } | |
5194 if ( v3 != 1 ) | |
5195 return v2; | |
5196 } | |
5197 LOWORD(v2) = v6->uState; | |
5198 if ( (short)v2 != 2 && (short)v2 != 1 ) | |
5199 { | |
5200 v6->uState = BLVDoor::Opening; | |
5201 if ( !(short)v2 ) | |
5202 goto LABEL_17; | |
5203 v7 = v6->uTimeSinceTriggered; | |
5204 v2 = 15360; | |
5205 if ( v7 != 15360 ) | |
5206 { | |
5207 v8 = v6->uCloseSpeed; | |
5208 v9 = v6->uOpenSpeed; | |
5209 goto LABEL_26; | |
5210 } | |
5211 LABEL_27: | |
5212 v6->uTimeSinceTriggered = v2; | |
5213 } | |
5214 return v2; | |
5215 } | |
5216 | |
5217 //----- (00449B57) -------------------------------------------------------- | |
521 | 5218 bool _449B57_test_bit( unsigned __int8 *a1, __int16 a2 ) |
1035 | 5219 { |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1112
diff
changeset
|
5220 return (a1[(a2 - 1) >> 3] & (0x80u >> (a2 - 1) % 8)) != 0; |
0 | 5221 } |
5222 | |
5223 //----- (00449B7E) -------------------------------------------------------- | |
501 | 5224 void _449B7E_toggle_bit(unsigned char *pArray, __int16 a2, unsigned __int16 bToggle) |
0 | 5225 { |
5226 signed int v3; // esi@1 | |
501 | 5227 unsigned char set_bit; // edx@1 |
0 | 5228 |
5229 v3 = a2 - 1; | |
501 | 5230 set_bit = 0x80 >> v3 % 8; |
0 | 5231 if ( bToggle ) |
501 | 5232 pArray[v3 / 8] |= set_bit; |
5233 else | |
5234 pArray[v3 / 8] &= ~set_bit; | |
0 | 5235 } |
5236 | |
5237 //----- (0044C175) -------------------------------------------------------- | |
1160 | 5238 void ShowStatusBarString( const char *pString, unsigned int uNumSeconds ) |
1546 | 5239 { |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
5240 strcpy(GameUI_Footer_TimedString.data(), pString); |
1546 | 5241 GameUI_Footer_TimeLeft = 1000 * uNumSeconds + GetTickCount(); |
5242 | |
5243 for (int i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()); | |
0 | 5244 i > 450; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
5245 i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()) ) |
1470 | 5246 GameUI_Footer_TimedString[strlen(GameUI_Footer_TimedString.data()) - 1] = 0; |
0 | 5247 } |
5248 | |
5249 //----- (0044C1D0) -------------------------------------------------------- | |
1035 | 5250 void ShowNothingHereStatus() |
0 | 5251 { |
783 | 5252 if ( !GameUI_Footer_TimeLeft ) |
1546 | 5253 ShowStatusBarString(pGlobalTXT_LocalizationStrings[521], 2);// Nothing here |
0 | 5254 } |
5255 | |
5256 //----- (0044C28B) -------------------------------------------------------- | |
1459 | 5257 int const_2() |
0 | 5258 { |
5259 return 2; | |
5260 } | |
5261 | |
5262 //----- (0044C28F) -------------------------------------------------------- | |
1459 | 5263 bool TeleportToNWCDungeon() |
0 | 5264 { |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1470
diff
changeset
|
5265 if (!_stricmp("nwc.blv", pCurrentMapName)) |
1459 | 5266 return false; |
5267 | |
5268 _5B65A8_npcdata_uflags_or_other = 0; | |
5269 _5B65AC_npcdata_fame_or_other = 0; | |
5270 _5B65B0_npcdata_rep_or_other = 0; | |
5271 _5B65B4_npcdata_loword_house_or_other = 0; | |
5272 _5B65B8_npcdata_hiword_house_or_other = 0; | |
5273 dword_5B65BC = 0; | |
5274 dword_5B65C0 = 0; | |
5275 | |
5276 pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen; | |
5277 sub_44987B("nwc.blv", MapStartPoint_Party); | |
5278 pCurrentScreen = SCREEN_GAME; | |
5279 return true; | |
0 | 5280 } |
5281 | |
5282 //----- (00401000) -------------------------------------------------------- | |
1458 | 5283 void mm7__vector_constructor(void *a1, int objSize, int numObjs, int ( *constructor)(int)) |
0 | 5284 { |
5285 void *v4; // esi@2 | |
5286 int v5; // edi@2 | |
5287 | |
5288 if ( numObjs - 1 >= 0 ) | |
5289 { | |
5290 v4 = a1; | |
5291 v5 = numObjs; | |
5292 do | |
5293 { | |
5294 constructor((int)v4); | |
5295 v4 = (char *)v4 + objSize; | |
5296 --v5; | |
5297 } | |
5298 while ( v5 ); | |
5299 } | |
5300 } | |
5301 | |
5302 //----- (0040261D) -------------------------------------------------------- | |
1546 | 5303 void stru298::Add(__int16 uID, __int16 a3, __int16 x, __int16 y, __int16 z, char a7, char a8) |
0 | 5304 { |
1546 | 5305 if (count < 100) |
5306 { | |
5307 pIDs[count] = uID; | |
5308 pXs[count] = x; | |
5309 pYs[count] = y; | |
5310 pZs[count] = z; | |
5311 field_324[count] = a3; | |
5312 field_3EC[count] = a8; | |
5313 field_450[count++] = a7; | |
5314 } | |
0 | 5315 } |
5316 | |
5317 //----- (00402CAE) -------------------------------------------------------- | |
323 | 5318 int stru193_math::Cos(int angle) |
0 | 5319 { |
5320 int v2; // eax@1 | |
5321 | |
5322 //a2: (angle - uIntegerHalfPi) for sin(angle) | |
5323 // (angle) for cos(angle) | |
5324 | |
5325 v2 = uDoublePiMask & angle; | |
5326 | |
5327 if ( v2 > uIntegerPi ) | |
5328 v2 = uIntegerDoublePi - v2; | |
5329 if ( v2 >= uIntegerHalfPi ) | |
5330 return -pCosTable[uIntegerPi - v2]; | |
5331 else | |
5332 return pCosTable[v2]; | |
5333 } | |
5334 |