Mercurial > mm7
annotate mm7_3.cpp @ 2065:87be06553c76
rename int _47F223_LooksLikeGenerateMonsterLoot() to void ArrangeSpriteObjects()
author | Ritor1 |
---|---|
date | Mon, 02 Dec 2013 23:19:22 +0600 |
parents | b2a434d65344 |
children | 48b790721bdc 52abdea20b9e 7cc14d9d966d |
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 //----- (00472866) -------------------------------------------------------- | |
1455 void BLV_ProcessPartyActions() | |
1456 { | |
1457 int v1; // ebx@1 | |
1458 int v2; // edi@1 | |
831 | 1459 //int v6; // eax@18 |
1460 //signed __int64 v8; // qax@27 | |
1461 //int v9; // eax@27 | |
0 | 1462 double v10; // st7@27 |
1463 unsigned int v12; // eax@49 | |
1464 double v13; // st7@50 | |
831 | 1465 //int v14; // eax@51 |
1466 //signed __int64 v15; // qax@53 | |
1467 //double v16; // st7@54 | |
0 | 1468 int v17; // eax@62 |
1469 double v18; // st7@62 | |
1470 int v19; // ST40_4@62 | |
1471 int v20; // eax@65 | |
1472 double v21; // st7@65 | |
1473 int v22; // ST40_4@65 | |
1474 int v23; // eax@66 | |
1475 double v24; // st7@66 | |
1476 int v25; // ST40_4@66 | |
1477 int v26; // eax@67 | |
1478 double v27; // st7@67 | |
1479 int v28; // ST40_4@67 | |
1480 unsigned int v35; // eax@74 | |
1481 int v36; // ecx@88 | |
1482 int new_party_z; // esi@96 | |
1483 int v38; // eax@96 | |
1484 int v39; // ecx@106 | |
1485 int v40; // eax@106 | |
1486 Player **v41; // esi@113 | |
1487 int v42; // eax@120 | |
1488 signed int v43; // ecx@123 | |
1489 BLVFace *v44; // esi@126 | |
1490 PolygonType v45; // al@126 | |
1491 int v46; // ecx@133 | |
1492 char v47; // zf@133 | |
1493 int v48; // eax@133 | |
1494 int v49; // ST40_4@136 | |
1495 int v50; // ST40_4@140 | |
1496 int v51; // eax@140 | |
1497 int v52; // eax@140 | |
1498 signed int v53; // edi@146 | |
1499 int v54; // ebx@146 | |
1500 int v55; // ST30_4@146 | |
1501 AudioPlayer *v56; // ecx@162 | |
1502 SoundID v57; // [sp-20h] [bp-80h]@163 | |
1503 signed int v58; // [sp-1Ch] [bp-7Ch]@161 | |
1504 unsigned int v59; // [sp-18h] [bp-78h]@161 | |
1505 signed int v60; // [sp-14h] [bp-74h]@161 | |
1506 signed int v61; // [sp-10h] [bp-70h]@161 | |
1507 int v62; // [sp-Ch] [bp-6Ch]@161 | |
1508 int v63; // [sp-8h] [bp-68h]@75 | |
1509 unsigned int v64; // [sp-8h] [bp-68h]@161 | |
1510 int v65; // [sp-4h] [bp-64h]@75 | |
1511 int v66; // [sp-4h] [bp-64h]@161 | |
831 | 1512 //int v68; // [sp+10h] [bp-50h]@45 |
0 | 1513 int v69; // [sp+10h] [bp-50h]@140 |
1514 unsigned int uFaceEvent; // [sp+14h] [bp-4Ch]@1 | |
831 | 1515 //signed int v71; // [sp+18h] [bp-48h]@1 |
0 | 1516 signed int v72; // [sp+1Ch] [bp-44h]@1 |
1517 signed int v73; // [sp+20h] [bp-40h]@100 | |
1518 int v74; // [sp+20h] [bp-40h]@140 | |
1519 bool bFeatherFall; // [sp+24h] [bp-3Ch]@15 | |
1520 unsigned int uSectorID; // [sp+28h] [bp-38h]@1 | |
1521 int v78; // [sp+2Ch] [bp-34h]@1 | |
1522 unsigned int uFaceID; // [sp+30h] [bp-30h]@1 | |
1523 int v80; // [sp+34h] [bp-2Ch]@1 | |
1524 int v81; // [sp+38h] [bp-28h]@47 | |
1525 int v82; // [sp+3Ch] [bp-24h]@47 | |
1526 int _view_angle; // [sp+40h] [bp-20h]@47 | |
1527 int bJumping; // [sp+44h] [bp-1Ch]@1 | |
1528 int new_party_y; // [sp+48h] [bp-18h]@1 | |
1529 int new_party_x; // [sp+4Ch] [bp-14h]@1 | |
1530 int party_z; // [sp+50h] [bp-10h]@1 | |
717 | 1531 //int v89; // [sp+58h] [bp-8h]@1 |
0 | 1532 int angle; // [sp+5Ch] [bp-4h]@47 |
1533 | |
1534 uFaceEvent = 0; | |
717 | 1535 //v89 = pParty->uFallSpeed; |
0 | 1536 v1 = 0; |
1537 v2 = 0; | |
1538 new_party_x = pParty->vPosition.x; | |
717 | 1539 new_party_y = pParty->vPosition.y; |
0 | 1540 party_z = pParty->vPosition.z; |
1541 uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z); | |
1542 v72 = 0; | |
1543 v78 = 0; | |
1544 bJumping = 0; | |
792 | 1545 |
1546 uFaceID = -1; | |
1980 | 1547 int floor_level = collide_against_floor(new_party_x, new_party_y, party_z + 40, &uSectorID, &uFaceID); |
792 | 1548 |
0 | 1549 if ( pParty->bFlying ) |
1550 { | |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
1551 pParty->bFlying = false; |
0 | 1552 if (pParty->FlyActive()) |
554
9caf59edb1ee
Cave and Temple load and even doesn't crash (for a while).
Nomad
parents:
526
diff
changeset
|
1553 pOtherOverlayList->pOverlays[pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID - 1].field_E |= 1; |
831 | 1554 } |
1555 | |
1556 if ( floor_level == -30000 || uFaceID == -1) | |
1557 { | |
1558 floor_level = collide_against_floor_approximate(new_party_x, new_party_y, party_z + 40, &uSectorID, &uFaceID); | |
1559 if ( floor_level == -30000 || uFaceID == -1) | |
1560 { | |
1561 __debugbreak(); // level built with errors | |
0 | 1562 pParty->vPosition.x = blv_prev_party_x; |
1563 pParty->vPosition.y = blv_prev_party_z; | |
1564 pParty->vPosition.z = blv_prev_party_y; | |
1565 pParty->uFallStartY = blv_prev_party_y; | |
1566 return; | |
1567 } | |
1568 } | |
831 | 1569 |
0 | 1570 blv_prev_party_x = pParty->vPosition.x; |
1571 blv_prev_party_z = pParty->vPosition.y; | |
1572 blv_prev_party_y = pParty->vPosition.z; | |
1573 if (!pParty->bTurnBasedModeOn) | |
1574 { | |
1980 | 1575 int v67 = GetTickCount() / 500; |
0 | 1576 if (dword_720CDC != v67 ) |
1577 { | |
1285 | 1578 dword_4F8580[3 * dword_4F8580[1]] = pParty->vPosition.x; |
1579 dword_4F8580[3 * dword_4F8580[2]] = pParty->vPosition.y; | |
1580 dword_4F8580[3 * dword_4F8580[3]] = pParty->vPosition.z; | |
0 | 1581 if ( dword_4F8580[0] > 60 ) |
1582 dword_4F8580[0] = 1; | |
1583 } | |
1584 dword_720CDC = v67; | |
1585 } | |
831 | 1586 |
1587 uint fall_start; | |
0 | 1588 if (!pParty->FeatherFallActive()) |
1589 { | |
1590 bFeatherFall = false; | |
1563 | 1591 if (!pParty->pPlayers[0].WearsItemAnyWhere(ITEM_ARTIFACT_LADYS_ESCORT) && // grants feather fall |
1592 !pParty->pPlayers[1].WearsItemAnyWhere(ITEM_ARTIFACT_LADYS_ESCORT) && | |
1593 !pParty->pPlayers[2].WearsItemAnyWhere(ITEM_ARTIFACT_LADYS_ESCORT) && | |
1594 !pParty->pPlayers[3].WearsItemAnyWhere(ITEM_ARTIFACT_LADYS_ESCORT)) | |
831 | 1595 { |
1596 fall_start = pParty->uFallStartY; | |
1597 } | |
1598 } | |
1599 else | |
1600 { | |
1601 fall_start = floor_level; | |
0 | 1602 bFeatherFall = true; |
831 | 1603 pParty->uFallStartY = floor_level; |
1604 } | |
1605 | |
1606 | |
1607 if (fall_start - party_z > 512 && !bFeatherFall && party_z <= floor_level + 1) | |
1608 { | |
1609 assert(~pParty->uFlags & PARTY_FLAGS_1_LANDING); // why land in indoor? | |
569 | 1610 if (pParty->uFlags & PARTY_FLAGS_1_LANDING) |
1611 pParty->uFlags &= ~PARTY_FLAGS_1_LANDING; | |
0 | 1612 else for (uint i = 0; i < 4; ++i) |
1613 { // receive falling damage | |
1980 | 1614 Player* player = &pParty->pPlayers[i]; |
1080 | 1615 if (!player->HasEnchantedItemEquipped(72) && !player->WearsItem(ITEM_ARTIFACT_HERMES_SANDALS, EQUIP_BOOTS)) |
831 | 1616 { |
1036 | 1617 player->ReceiveDamage((pParty->uFallStartY - party_z) * (0.1f * player->GetMaxHealth()) / 256, DMGT_PHISYCAL); |
1618 v10 = (double)(20 - player->GetParameterBonus(player->GetActualEndurance())) * flt_6BE3A4_debug_recmod1 * 2.133333333333333; | |
831 | 1619 player->SetRecoveryTime((signed __int64)v10); |
1620 } | |
1621 } | |
1622 } | |
1623 | |
1624 if ( party_z > floor_level + 1 ) | |
0 | 1625 bJumping = 1; |
831 | 1626 |
1627 bool jumping_up = false; | |
1628 | |
1629 if ( party_z - floor_level <= 32 ) | |
1630 { | |
0 | 1631 pParty->uFallStartY = party_z; |
831 | 1632 jumping_up = true; |
1633 } | |
1634 | |
1635 if (bWalkSound && pParty->walk_sound_timer) | |
1636 { | |
1637 if (pParty->walk_sound_timer > pEventTimer->uTimeElapsed) | |
1638 pParty->walk_sound_timer -= pEventTimer->uTimeElapsed; | |
1639 else pParty->walk_sound_timer = 0; | |
1640 } | |
1641 | |
1642 | |
1643 if (party_z <= floor_level + 1) | |
1644 { | |
1645 party_z = floor_level + 1; | |
1646 pParty->uFallStartY = floor_level + 1; | |
1647 | |
1648 if (!bJumping && pParty->floor_face_pid != uFaceID) | |
1649 { | |
1980 | 1650 BLVFace* pFace = &pIndoor->pFaces[uFaceID]; |
831 | 1651 if (pFace->uAttributes & FACE_PRESSURE_PLATE) |
1652 uFaceEvent = pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID; | |
1653 } | |
1654 } | |
1655 if (!bJumping) | |
1656 pParty->floor_face_pid = uFaceID; | |
1657 | |
1658 bool on_water = false; | |
1659 if ( pIndoor->pFaces[uFaceID].Fluid()) | |
1660 on_water = true; | |
1661 | |
0 | 1662 v81 = pParty->uWalkSpeed; |
1663 angle = pParty->sRotationY; | |
1664 _view_angle = pParty->sRotationX; | |
831 | 1665 v82 = (unsigned __int64)(pEventTimer->dt_in_some_format * (signed __int64)((signed int)(pParty->y_rotation_speed * stru_5C6E00->uIntegerPi) |
0 | 1666 / 180)) >> 16; |
809 | 1667 //LABEL_87: |
0 | 1668 while ( pPartyActionQueue->uNumActions ) |
1669 { | |
1670 switch ( pPartyActionQueue->Next() ) | |
1671 { | |
1672 case PARTY_TurnLeft: | |
831 | 1673 if (uTurnSpeed) |
1674 angle = stru_5C6E00->uDoublePiMask & (angle + uTurnSpeed); | |
1675 else | |
1676 angle = stru_5C6E00->uDoublePiMask & (angle + (int)(v82 * fTurnSpeedMultiplier)); | |
809 | 1677 break; |
0 | 1678 case PARTY_TurnRight: |
831 | 1679 if (uTurnSpeed) |
809 | 1680 angle = stru_5C6E00->uDoublePiMask & (angle - uTurnSpeed); |
831 | 1681 else |
1682 angle = stru_5C6E00->uDoublePiMask & (angle - (int)(v82 * fTurnSpeedMultiplier)); | |
809 | 1683 break; |
831 | 1684 |
0 | 1685 case PARTY_FastTurnLeft: |
831 | 1686 if (uTurnSpeed) |
1687 angle = stru_5C6E00->uDoublePiMask & (angle + uTurnSpeed); | |
0 | 1688 else |
831 | 1689 angle = stru_5C6E00->uDoublePiMask & (angle + (int)(2.0f * fTurnSpeedMultiplier * (double)v82)); |
809 | 1690 break; |
831 | 1691 |
0 | 1692 case PARTY_FastTurnRight: |
831 | 1693 if (uTurnSpeed) |
1694 angle = stru_5C6E00->uDoublePiMask & (angle - uTurnSpeed); | |
1695 else | |
1696 angle = stru_5C6E00->uDoublePiMask & (angle - (int)(2.0f * fTurnSpeedMultiplier * (double)v82)); | |
809 | 1697 break; |
831 | 1698 |
809 | 1699 case PARTY_StrafeLeft: |
1643 | 1700 v2 -= fixpoint_mul(stru_5C6E00->Sin(angle), v81 * fWalkSpeedMultiplier / 2); |
1701 v1 += fixpoint_mul(stru_5C6E00->Cos(angle), v81 * fWalkSpeedMultiplier / 2); | |
717 | 1702 v78 = 1; |
809 | 1703 break; |
0 | 1704 case PARTY_StrafeRight: |
1643 | 1705 v2 += fixpoint_mul(stru_5C6E00->Sin(angle), v81 * fWalkSpeedMultiplier / 2); |
1706 v1 -= fixpoint_mul(stru_5C6E00->Cos(angle), v81 * fWalkSpeedMultiplier / 2); | |
717 | 1707 v78 = 1; |
809 | 1708 break; |
0 | 1709 case PARTY_WalkForward: |
1643 | 1710 v2 += fixpoint_mul(stru_5C6E00->Cos(angle), 5 * v81 * fWalkSpeedMultiplier); |
1711 v1 += fixpoint_mul(stru_5C6E00->Sin(angle), 5 * v81 * fWalkSpeedMultiplier); | |
717 | 1712 v78 = 1; |
809 | 1713 break; |
0 | 1714 case PARTY_WalkBackward: |
1643 | 1715 v2 -= fixpoint_mul(stru_5C6E00->Cos(angle), v81 * fBackwardWalkSpeedMultiplier); |
1716 v1 -= fixpoint_mul(stru_5C6E00->Sin(angle), v81 * fBackwardWalkSpeedMultiplier); | |
0 | 1717 v78 = 1; |
809 | 1718 break; |
0 | 1719 case PARTY_RunForward: |
1643 | 1720 v2 += fixpoint_mul(stru_5C6E00->Cos(angle), 2 * v81 * fWalkSpeedMultiplier); |
1721 v1 += fixpoint_mul(stru_5C6E00->Sin(angle), 2 * v81 * fWalkSpeedMultiplier); | |
0 | 1722 v72 = 1; |
809 | 1723 break; |
0 | 1724 case PARTY_RunBackward: |
1725 //v32 = stru_5C6E00->SinCos(angle); | |
1726 //v33 = (double)v81; | |
1727 //v88 = (double)v81; | |
1643 | 1728 v2 -= fixpoint_mul(stru_5C6E00->Cos(angle), v81 * fBackwardWalkSpeedMultiplier); |
0 | 1729 //v34 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); |
1643 | 1730 v1 -= fixpoint_mul(stru_5C6E00->Sin(angle), v81 * fBackwardWalkSpeedMultiplier); |
0 | 1731 v72 = 1; |
807 | 1732 break; |
0 | 1733 case PARTY_LookUp: |
1734 _view_angle += (signed __int64)(flt_6BE150_look_up_down_dangle * 25.0); | |
1735 if ( _view_angle > 128 ) | |
1736 _view_angle = 128; | |
1737 v35 = uActiveCharacter; | |
809 | 1738 if ( uActiveCharacter ) |
1739 pPlayers[v35]->PlaySound((PlayerSpeech)SPEECH_63, 0); | |
717 | 1740 break; |
0 | 1741 case PARTY_LookDown: |
1742 _view_angle += (signed __int64)(flt_6BE150_look_up_down_dangle * -25.0); | |
1743 if ( _view_angle < -128 ) | |
1744 _view_angle = -128; | |
1745 v35 = uActiveCharacter; | |
1746 if ( uActiveCharacter ) | |
717 | 1747 pPlayers[v35]->PlaySound((PlayerSpeech)SPEECH_64, 0); |
0 | 1748 break; |
1749 case PARTY_CenterView: | |
1750 _view_angle = 0; | |
1751 break; | |
1752 case PARTY_Jump: | |
831 | 1753 if ( (!bJumping || party_z <= floor_level + 6 && pParty->uFallSpeed <= 0) && pParty->field_24 ) |
0 | 1754 { |
1755 bJumping = 1; | |
717 | 1756 pParty->uFallSpeed = (signed __int64)((double)(pParty->field_24 << 6) * 1.5 + (double)pParty->uFallSpeed); |
0 | 1757 } |
1758 break; | |
1759 default: | |
809 | 1760 break; |
0 | 1761 } |
1762 } | |
1763 v36 = 0; | |
1764 pParty->sRotationY = angle; | |
1765 pParty->sRotationX = _view_angle; | |
1766 if ( bJumping ) | |
1767 { | |
1418 | 1768 pParty->uFallSpeed += -2 * pEventTimer->uTimeElapsed * GetGravityStrength(); |
1769 if ( bJumping != v36 && pParty->uFallSpeed <= v36 ) | |
1770 { | |
1771 if ( pParty->uFallSpeed < -500 && !pParty->bFlying ) | |
1772 { | |
1773 v41 = &pPlayers[1]; | |
1774 do | |
1775 { | |
1776 if ( !(*v41)->HasEnchantedItemEquipped(72) && !(*v41)->WearsItem(ITEM_ARTIFACT_HERMES_SANDALS, EQUIP_BOOTS) ) //was 8 | |
1777 (*v41)->PlayEmotion(CHARACTER_EXPRESSION_SCARED, 0); | |
1778 ++v41; | |
1779 } | |
1780 while ( (signed int)v41 <= (signed int)&pPlayers[4] ); | |
1781 } | |
1782 } | |
1783 else | |
1784 pParty->uFallStartY = party_z; | |
0 | 1785 } |
1786 else | |
1787 { | |
831 | 1788 if ( pIndoor->pFaces[uFaceID].pFacePlane_old.vNormal.z < 32768 ) |
0 | 1789 { |
717 | 1790 pParty->uFallSpeed -= pEventTimer->uTimeElapsed * GetGravityStrength(); |
1418 | 1791 pParty->uFallStartY = party_z; |
0 | 1792 } |
1418 | 1793 else |
1794 { | |
1795 if (! (pParty->uFlags & PARTY_FLAGS_1_LANDING) ) | |
1796 pParty->uFallSpeed = 0; | |
1797 pParty->uFallStartY = party_z; | |
1798 } | |
1799 } | |
0 | 1800 if ( v2 * v2 + v1 * v1 < 400 ) |
1801 { | |
1802 v1 = 0; | |
1803 v2 = 0; | |
1804 } | |
1805 stru_721530.field_84 = -1; | |
1806 stru_721530.field_70 = 0; | |
1546 | 1807 stru_721530.prolly_normal_d = pParty->field_14_radius; |
1808 stru_721530.field_8_radius = pParty->field_14_radius / 2; | |
1980 | 1809 int v83 = 0; |
0 | 1810 stru_721530.field_0 = 1; |
1546 | 1811 stru_721530.height = pParty->uPartyHeight - 32; |
0 | 1812 while ( 1 ) |
1813 { | |
1814 new_party_z = party_z; | |
1546 | 1815 stru_721530.position.x = new_party_x; |
0 | 1816 stru_721530.normal.x = new_party_x; |
1546 | 1817 stru_721530.velocity.x = v2; |
1818 stru_721530.position.y = new_party_y; | |
0 | 1819 stru_721530.normal.y = new_party_y; |
1546 | 1820 stru_721530.velocity.y = v1; |
0 | 1821 stru_721530.normal.z = stru_721530.prolly_normal_d + party_z + 1; |
1546 | 1822 stru_721530.position.z = stru_721530.height + party_z + 1; |
1823 stru_721530.velocity.z = pParty->uFallSpeed; | |
0 | 1824 stru_721530.uSectorID = uSectorID; |
1825 v38 = 0; | |
1340 | 1826 if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->turn_stage == 3 ) |
0 | 1827 v38 = 13312; |
1828 if ( stru_721530._47050A(v38) ) | |
1829 break; | |
1830 v73 = 0; | |
1831 do | |
1832 { | |
1833 _46E44E_collide_against_faces_and_portals(1u); | |
1834 _46E0B2_collide_against_decorations(); | |
1835 for ( v80 = 0; v80 < (signed int)uNumActors; ++v80 ) | |
1897
436553b0603c
_46DF1A_collide_against_actor cleaned up, moved to Actor.h
Grumpy7
parents:
1861
diff
changeset
|
1836 Actor::_46DF1A_collide_against_actor(v80, 0); |
0 | 1837 if ( _46F04E_collide_against_portals() ) |
1838 break; | |
1839 ++v73; | |
1840 } | |
1841 while ( v73 < 100 ); | |
1842 if ( stru_721530.field_7C >= stru_721530.field_6C ) | |
1843 { | |
1844 v39 = stru_721530.normal2.x; | |
1845 uSectorID = stru_721530.normal2.y; | |
1846 v40 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1; | |
1847 } | |
1848 else | |
1849 { | |
1546 | 1850 v39 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.x) >> 16) + new_party_x; |
1851 uSectorID = new_party_y + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.y) >> 16); | |
1852 v40 = new_party_z + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.z) >> 16); | |
0 | 1853 } |
783 | 1854 v42 = collide_against_floor(v39, uSectorID, v40 + 40, &stru_721530.uSectorID, &uFaceID); |
0 | 1855 if ( v42 == -30000 || v42 - new_party_z > 128 ) |
1856 return; | |
1857 if ( stru_721530.field_7C >= stru_721530.field_6C ) | |
1858 { | |
1859 new_party_x = stru_721530.normal2.x; | |
1860 new_party_y = stru_721530.normal2.y; | |
1861 new_party_z = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1; | |
1862 break; | |
1863 } | |
1546 | 1864 new_party_x += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.x) >> 16; |
1865 new_party_y += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.y) >> 16; | |
0 | 1866 v43 = stru_721530.uFaceID; |
1867 uSectorID = stru_721530.uSectorID; | |
1868 stru_721530.field_70 += stru_721530.field_7C; | |
1980 | 1869 unsigned long long v87 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.z) >> 16) + new_party_z; |
848 | 1870 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Actor) |
0 | 1871 { |
1167 | 1872 if ( SHIDWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) >= 0 |
1873 && (SHIDWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime)) ) | |
1874 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); | |
0 | 1875 viewparams->bRedrawGameUI = 1; |
1876 } | |
1418 | 1877 else if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Decoration) |
0 | 1878 { |
295 | 1879 v53 = integer_sqrt(v2 * v2 + v1 * v1); |
0 | 1880 v80 = v53; |
717 | 1881 v54 = stru_5C6E00->Atan2(new_party_x - pLevelDecorations[stru_721530.uFaceID >> 3].vPosition.x, |
0 | 1882 new_party_y - pLevelDecorations[stru_721530.uFaceID >> 3].vPosition.y); |
323 | 1883 v2 = (unsigned __int64)(stru_5C6E00->Cos(v54) * (signed __int64)v53) >> 16; |
1884 v55 = stru_5C6E00->Sin(v54); | |
0 | 1885 v1 = (unsigned __int64)(v55 * (signed __int64)v80) >> 16; |
1886 } | |
1887 else | |
1888 { | |
848 | 1889 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_BModel) |
0 | 1890 { |
1891 v44 = &pIndoor->pFaces[(signed int)stru_721530.uFaceID >> 3]; | |
1892 v45 = v44->uPolygonType; | |
1893 if ( v45 == 3 ) | |
1894 { | |
717 | 1895 if ( pParty->uFallSpeed < 0 ) |
1896 pParty->uFallSpeed = 0; | |
0 | 1897 v87 = pIndoor->pVertices[*v44->pVertexIDs].z + 1; |
1898 if ( pParty->uFallStartY - v87 < 512 ) | |
1899 pParty->uFallStartY = v87; | |
1900 if ( v2 * v2 + v1 * v1 < 400 ) | |
1901 { | |
1902 v1 = 0; | |
1903 v2 = 0; | |
1904 } | |
831 | 1905 if ( pParty->floor_face_pid != PID_ID(v43) && BYTE3(v44->uAttributes) & 4 ) |
717 | 1906 uFaceEvent = pIndoor->pFaceExtras[v44->uFaceExtraID].uEventID; |
1907 } | |
1418 | 1908 else |
1909 { | |
1910 v46 = pParty->uFallSpeed * v44->pFacePlane_old.vNormal.z; | |
1911 v47 = v45 == 4; | |
1912 v48 = v44->pFacePlane_old.vNormal.x; | |
1913 if ( !v47 ) | |
1914 { | |
1915 v80 = abs(v1 * v44->pFacePlane_old.vNormal.y + v46 + v2 * v48) >> 16; | |
1546 | 1916 if ((stru_721530.speed >> 3) > v80 ) |
1917 v80 = stru_721530.speed >> 3; | |
1418 | 1918 v50 = (unsigned __int64)(v80 * (signed __int64)v44->pFacePlane_old.vNormal.x) >> 16; |
1919 v81 = v44->pFacePlane_old.vNormal.y; | |
1920 v81 = (unsigned __int64)(v80 * (signed __int64)v81) >> 16; | |
1921 v82 = v44->pFacePlane_old.vNormal.z; | |
1922 v82 = (unsigned __int64)(v80 * (signed __int64)v82) >> 16; | |
1923 v2 += v50; | |
1924 pParty->uFallSpeed += v82; | |
1925 v74 = v44->pFacePlane_old.vNormal.z; | |
1926 v51 = v44->pFacePlane_old.vNormal.y; | |
1927 v69 = v44->pFacePlane_old.vNormal.x; | |
1928 v80 = v51; | |
1929 v1 += v81; | |
1930 v52 = stru_721530.prolly_normal_d - ((v44->pFacePlane_old.dist + v87 * v74 + new_party_y * v51 + new_party_x * v69) >> 16); | |
1931 if ( v52 > 0 ) | |
1932 { | |
1933 new_party_x += v52 * v69 >> 16; | |
1934 new_party_y += v52 * v80 >> 16; | |
1935 v87 += v52 * v74 >> 16; | |
1936 } | |
1937 v43 = stru_721530.uFaceID; | |
1938 if ( pParty->floor_face_pid != PID_ID(v43) && BYTE3(v44->uAttributes) & 4 ) | |
1939 uFaceEvent = pIndoor->pFaceExtras[v44->uFaceExtraID].uEventID; | |
1940 } | |
1941 else | |
1942 { | |
1943 v80 = abs(v1 * v44->pFacePlane_old.vNormal.y + v46 + v2 * v48) >> 16; | |
1546 | 1944 if ((stru_721530.speed >> 3) > v80 ) |
1945 v80 = stru_721530.speed >> 3; | |
1418 | 1946 v49 = (unsigned __int64)(v80 * (signed __int64)v44->pFacePlane_old.vNormal.x) >> 16; |
1947 v81 = v44->pFacePlane_old.vNormal.y; | |
1948 v81 = (unsigned __int64)(v80 * (signed __int64)v81) >> 16; | |
1949 v82 = v44->pFacePlane_old.vNormal.z; | |
1950 v82 = (unsigned __int64)(v80 * (signed __int64)v82) >> 16; | |
1951 v2 += v49; | |
1952 v1 += v81; | |
1953 pParty->uFallSpeed += v82; | |
1954 if ( v2 * v2 + v1 * v1 >= 400 ) | |
1955 { | |
1956 v43 = stru_721530.uFaceID; | |
1957 if ( pParty->floor_face_pid != PID_ID(v43) && BYTE3(v44->uAttributes) & 4 ) | |
1958 uFaceEvent = pIndoor->pFaceExtras[v44->uFaceExtraID].uEventID; | |
1959 } | |
1960 else | |
1961 { | |
1962 v2 = 0; | |
1963 v1 = 0; | |
1964 pParty->uFallSpeed = 0; | |
1965 } | |
1966 } | |
1967 } | |
0 | 1968 } |
1969 } | |
1970 v2 = (unsigned __int64)(58500i64 * v2) >> 16; | |
1971 v1 = (unsigned __int64)(58500i64 * v1) >> 16; | |
1972 ++v83; | |
717 | 1973 pParty->uFallSpeed = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16; |
0 | 1974 if ( v83 >= 100 ) |
1975 { | |
1976 new_party_z = v87; | |
1977 break; | |
1978 } | |
1979 } | |
831 | 1980 if ( bWalkSound && !pParty->walk_sound_timer) |
0 | 1981 { |
295 | 1982 if ( integer_sqrt((pParty->vPosition.x - new_party_x) * (pParty->vPosition.x - new_party_x) + (pParty->vPosition.y - new_party_y) |
717 | 1983 * (pParty->vPosition.y - new_party_y) + (pParty->vPosition.z - new_party_z) |
1984 * (pParty->vPosition.z - new_party_z)) <= 16 ) | |
1418 | 1985 { |
1986 pAudioPlayer->_4AA258(804); | |
1987 pParty->walk_sound_timer = 64; | |
1988 } | |
1989 else if ( v72 && (!bJumping || jumping_up) ) | |
0 | 1990 { |
1991 v66 = 0; | |
1992 v64 = 0; | |
1993 v62 = 0; | |
1994 v61 = 0; | |
1995 v60 = -1; | |
1996 v59 = 1; | |
1997 v58 = 804; | |
831 | 1998 if ( !on_water ) |
0 | 1999 { |
2000 v56 = pAudioPlayer; | |
2001 if ( BYTE2(pIndoor->pFaces[uFaceID].uAttributes) & 0x20 ) | |
2002 v57 = (SoundID)50; | |
2003 else | |
2004 v57 = (SoundID)64; | |
1418 | 2005 pAudioPlayer->PlaySound(v57, v58, v59, v60, v61, v62, v64, v66); |
0 | 2006 } |
1418 | 2007 else |
2008 { | |
2009 v57 = (SoundID)63; | |
2010 v56 = pAudioPlayer; | |
2011 pAudioPlayer->PlaySound(v57, v58, v59, v60, v61, v62, v64, v66); | |
2012 } | |
0 | 2013 } |
1418 | 2014 else if ( v78 && (!bJumping || jumping_up) ) |
0 | 2015 { |
2016 v66 = 0; | |
2017 v64 = 0; | |
2018 v62 = 0; | |
2019 v61 = 0; | |
2020 v60 = -1; | |
2021 v59 = 1; | |
2022 v58 = 804; | |
831 | 2023 if ( on_water ) |
0 | 2024 { |
2025 v57 = (SoundID)102; | |
717 | 2026 v56 = pAudioPlayer; |
0 | 2027 } |
1418 | 2028 else |
2029 { | |
2030 v56 = pAudioPlayer; | |
2031 if ( BYTE2(pIndoor->pFaces[uFaceID].uAttributes) & 0x20 ) | |
2032 v57 = (SoundID)89; | |
2033 else | |
2034 v57 = (SoundID)103; | |
2035 } | |
0 | 2036 pAudioPlayer->PlaySound(v57, v58, v59, v60, v61, v62, v64, v66); |
2037 } | |
2038 else | |
2039 { | |
2040 pAudioPlayer->_4AA258(804); | |
831 | 2041 pParty->walk_sound_timer = 64; |
2042 } | |
2043 } | |
2044 if ( !bJumping || jumping_up ) | |
569 | 2045 pParty->uFlags &= ~PARTY_FLAGS_1_FALLING; |
2046 else | |
2047 pParty->uFlags |= PARTY_FLAGS_1_FALLING; | |
2048 pParty->uFlags &= ~0x200; | |
0 | 2049 pParty->vPosition.x = new_party_x; |
2050 pParty->vPosition.z = new_party_z; | |
2051 pParty->vPosition.y = new_party_y; | |
717 | 2052 //pParty->uFallSpeed = v89; |
0 | 2053 if ( !bJumping && BYTE3(pIndoor->pFaces[uFaceID].uAttributes) & 0x40 ) |
569 | 2054 pParty->uFlags |= 0x200; |
0 | 2055 if (uFaceEvent) |
2056 EventProcessor(uFaceEvent, 0, 1); | |
2057 } | |
2058 | |
2059 //----- (0047531C) -------------------------------------------------------- | |
2060 bool __fastcall sub_47531C(int a1, int *a2, int a3, int a4, int a5, int a6, int a7, int a8, BLVFace *a9, int a10) | |
2061 { | |
2062 BLVFace *v10; // ebx@1 | |
2063 int v11; // ST1C_4@3 | |
2064 int v12; // edi@3 | |
2065 int v13; // esi@3 | |
2066 int v14; // edi@4 | |
2067 signed __int64 v15; // qtt@6 | |
2068 __int16 v16; // si@7 | |
2069 int *v18; // [sp+Ch] [bp-Ch]@1 | |
2070 int v19; // [sp+10h] [bp-8h]@1 | |
2071 int a7a; // [sp+30h] [bp+18h]@7 | |
2072 int a9b; // [sp+38h] [bp+20h]@3 | |
2073 int a9a; // [sp+38h] [bp+20h]@3 | |
2074 int a10b; // [sp+3Ch] [bp+24h]@3 | |
2075 signed int a10a; // [sp+3Ch] [bp+24h]@4 | |
2076 int a10c; // [sp+3Ch] [bp+24h]@5 | |
2077 | |
2078 v10 = a9; | |
2079 v18 = a2; | |
2080 v19 = a1; | |
2081 if ( a10 && BYTE3(a9->uAttributes) & 0x20 ) | |
2082 return 0; | |
2083 v11 = (unsigned __int64)(a6 * (signed __int64)a9->pFacePlane_old.vNormal.x) >> 16; | |
2084 a10b = (unsigned __int64)(a7 * (signed __int64)a9->pFacePlane_old.vNormal.y) >> 16; | |
2085 a9b = (unsigned __int64)(a8 * (signed __int64)a9->pFacePlane_old.vNormal.z) >> 16; | |
2086 v12 = v11 + a9b + a10b; | |
2087 a9a = v11 + a9b + a10b; | |
2088 v13 = (a1 << 16) | |
2089 - a3 * v10->pFacePlane_old.vNormal.x | |
2090 - a4 * v10->pFacePlane_old.vNormal.y | |
2091 - a5 * v10->pFacePlane_old.vNormal.z | |
2092 - v10->pFacePlane_old.dist; | |
2093 if ( abs((a1 << 16) | |
2094 - a3 * v10->pFacePlane_old.vNormal.x | |
2095 - a4 * v10->pFacePlane_old.vNormal.y | |
2096 - a5 * v10->pFacePlane_old.vNormal.z - v10->pFacePlane_old.dist) >= a1 << 16 ) | |
2097 { | |
2098 a10c = abs(v13) >> 14; | |
2099 if ( a10c > abs(v12) ) | |
2100 return 0; | |
2101 LODWORD(v15) = v13 << 16; | |
2102 HIDWORD(v15) = v13 >> 16; | |
2103 v14 = v19; | |
2104 a10a = v15 / a9a; | |
2105 } | |
2106 else | |
2107 { | |
2108 a10a = 0; | |
2109 v14 = abs(v13) >> 16; | |
2110 } | |
2111 v16 = a4 + ((unsigned int)((unsigned __int64)(a10a * (signed __int64)a7) >> 16) >> 16); | |
2112 LOWORD(a7a) = (short)a3 | |
2113 + ((unsigned int)((unsigned __int64)(a10a * (signed __int64)a6) >> 16) >> 16) | |
2114 - ((unsigned int)(v14 * v10->pFacePlane_old.vNormal.x) >> 16); | |
2115 HIWORD(a7a) = v16 - ((unsigned int)(v14 * v10->pFacePlane_old.vNormal.y) >> 16); | |
2116 if ( !sub_475665( | |
2117 v10, | |
2118 a7a, | |
2119 (short)a5 | |
2120 + ((unsigned int)((unsigned __int64)(a10a * (signed __int64)a8) >> 16) >> 16) | |
2121 - ((unsigned int)(v14 * v10->pFacePlane_old.vNormal.z) >> 16)) ) | |
2122 return 0; | |
2123 *v18 = a10a >> 16; | |
2124 if ( a10a >> 16 < 0 ) | |
2125 *v18 = 0; | |
2126 return 1; | |
2127 } | |
2128 | |
2129 //----- (004754BF) -------------------------------------------------------- | |
2130 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) | |
2131 { | |
2132 BLVFace *v11; // ebx@1 | |
2133 int v12; // ST1C_4@3 | |
2134 int v13; // edi@3 | |
2135 int v14; // esi@3 | |
2136 int v15; // edi@4 | |
2137 signed __int64 v16; // qtt@6 | |
2138 __int16 v17; // si@7 | |
2139 int *v19; // [sp+Ch] [bp-Ch]@1 | |
2140 int v20; // [sp+10h] [bp-8h]@1 | |
2141 int a7a; // [sp+30h] [bp+18h]@7 | |
2142 int a1b; // [sp+38h] [bp+20h]@3 | |
2143 int a1a; // [sp+38h] [bp+20h]@3 | |
2144 int a11b; // [sp+40h] [bp+28h]@3 | |
2145 signed int a11a; // [sp+40h] [bp+28h]@4 | |
2146 int a11c; // [sp+40h] [bp+28h]@5 | |
2147 | |
2148 v11 = a9; | |
2149 v19 = a2; | |
2150 v20 = a1; | |
2151 if ( a11 && BYTE3(a9->uAttributes) & 0x20 ) | |
2152 return 0; | |
2153 v12 = (unsigned __int64)(a6 * (signed __int64)a9->pFacePlane_old.vNormal.x) >> 16; | |
2154 a11b = (unsigned __int64)(a7 * (signed __int64)a9->pFacePlane_old.vNormal.y) >> 16; | |
2155 a1b = (unsigned __int64)(a8 * (signed __int64)a9->pFacePlane_old.vNormal.z) >> 16; | |
2156 v13 = v12 + a1b + a11b; | |
2157 a1a = v12 + a1b + a11b; | |
2158 v14 = (a1 << 16) | |
2159 - a3 * v11->pFacePlane_old.vNormal.x | |
2160 - a4 * v11->pFacePlane_old.vNormal.y | |
2161 - a5 * v11->pFacePlane_old.vNormal.z | |
2162 - v11->pFacePlane_old.dist; | |
2163 if ( abs((a1 << 16) | |
2164 - a3 * v11->pFacePlane_old.vNormal.x | |
2165 - a4 * v11->pFacePlane_old.vNormal.y | |
2166 - a5 * v11->pFacePlane_old.vNormal.z - v11->pFacePlane_old.dist) >= a1 << 16 ) | |
2167 { | |
2168 a11c = abs(v14) >> 14; | |
2169 if ( a11c > abs(v13) ) | |
2170 return 0; | |
2171 LODWORD(v16) = v14 << 16; | |
2172 HIDWORD(v16) = v14 >> 16; | |
2173 v15 = v20; | |
2174 a11a = v16 / a1a; | |
2175 } | |
2176 else | |
2177 { | |
2178 a11a = 0; | |
2179 v15 = abs(v14) >> 16; | |
2180 } | |
2181 v17 = a4 + ((unsigned int)((unsigned __int64)(a11a * (signed __int64)a7) >> 16) >> 16); | |
2182 LOWORD(a7a) = (short)a3 | |
2183 + ((unsigned int)((unsigned __int64)(a11a * (signed __int64)a6) >> 16) >> 16) | |
2184 - ((unsigned int)(v15 * v11->pFacePlane_old.vNormal.x) >> 16); | |
2185 HIWORD(a7a) = v17 - ((unsigned int)(v15 * v11->pFacePlane_old.vNormal.y) >> 16); | |
2186 if ( !sub_4759C9( | |
2187 v11, | |
2188 a10, | |
2189 a7a, | |
2190 (short)a5 | |
2191 + ((unsigned int)((unsigned __int64)(a11a * (signed __int64)a8) >> 16) >> 16) | |
2192 - ((unsigned int)(v15 * v11->pFacePlane_old.vNormal.z) >> 16)) ) | |
2193 return 0; | |
2194 *v19 = a11a >> 16; | |
2195 if ( a11a >> 16 < 0 ) | |
2196 *v19 = 0; | |
2197 return 1; | |
2198 } | |
2199 | |
2200 //----- (00475665) -------------------------------------------------------- | |
1459 | 2201 int sub_475665(BLVFace *_this, int a2, __int16 a3) |
0 | 2202 { |
2203 unsigned int v3; // eax@1 | |
2204 Vec3_short_ *v4; // edx@3 | |
2205 signed int v5; // eax@4 | |
2206 int v6; // esi@4 | |
2207 signed int v7; // eax@7 | |
2208 Vec3_short_ *v8; // edx@8 | |
2209 signed int v9; // eax@9 | |
2210 int v10; // esi@9 | |
2211 signed int v11; // eax@11 | |
2212 Vec3_short_ *v12; // edx@12 | |
2213 signed int v13; // eax@13 | |
2214 int v14; // esi@13 | |
2215 int v15; // esi@14 | |
2216 bool v16; // edi@14 | |
2217 int v17; // ecx@16 | |
2218 signed int v18; // edx@16 | |
2219 int v19; // eax@17 | |
2220 signed int v20; // ebx@18 | |
2221 int v21; // edi@20 | |
2222 signed int v22; // ST14_4@22 | |
2223 signed __int64 v23; // qtt@22 | |
2224 signed int result; // eax@25 | |
2225 int v25; // [sp+14h] [bp-10h]@14 | |
2226 int v26; // [sp+1Ch] [bp-8h]@2 | |
2227 signed int v27; // [sp+20h] [bp-4h]@2 | |
2228 signed int v28; // [sp+30h] [bp+Ch]@2 | |
2229 signed int v29; // [sp+30h] [bp+Ch]@7 | |
2230 signed int v30; // [sp+30h] [bp+Ch]@11 | |
2231 signed int v31; // [sp+30h] [bp+Ch]@14 | |
2232 | |
2233 v3 = _this->uAttributes; | |
2234 if ( BYTE1(v3) & 1 ) | |
2235 { | |
2236 v28 = 0; | |
2237 v26 = (signed __int16)a2; | |
2238 v27 = SHIWORD(a2); | |
2239 if ( _this->uNumVertices ) | |
2240 { | |
2241 v4 = pIndoor->pVertices; | |
2242 do | |
2243 { | |
2244 v5 = v28; | |
2245 v6 = 2 * v28; | |
2246 word_720C10_intercepts_xs[2 * v28] = _this->pXInterceptDisplacements[v28] + v4[_this->pVertexIDs[v28]].x; | |
2247 word_720B40_intercepts_zs[2 * v28] = _this->pYInterceptDisplacements[v5] + v4[_this->pVertexIDs[v5]].y; | |
2248 word_720C10_intercepts_xs[2 * v28++ + 1] = _this->pXInterceptDisplacements[v5 + 1] | |
2249 + v4[_this->pVertexIDs[v5 + 1]].x; | |
2250 word_720B40_intercepts_zs[v6 + 1] = _this->pYInterceptDisplacements[v5 + 1] + v4[_this->pVertexIDs[v5 + 1]].y; | |
2251 } | |
2252 while ( v28 < _this->uNumVertices ); | |
2253 } | |
2254 } | |
2255 else | |
2256 { | |
2257 if ( BYTE1(v3) & 2 ) | |
2258 { | |
2259 v26 = (signed __int16)a2; | |
2260 v7 = a3; | |
2261 v29 = 0; | |
2262 v27 = v7; | |
2263 if ( _this->uNumVertices ) | |
2264 { | |
2265 v8 = pIndoor->pVertices; | |
2266 do | |
2267 { | |
2268 v9 = v29; | |
2269 v10 = 2 * v29; | |
2270 word_720C10_intercepts_xs[2 * v29] = _this->pXInterceptDisplacements[v29] + v8[_this->pVertexIDs[v29]].x; | |
2271 word_720B40_intercepts_zs[2 * v29] = _this->pZInterceptDisplacements[v9] + v8[_this->pVertexIDs[v9]].z; | |
2272 word_720C10_intercepts_xs[2 * v29++ + 1] = _this->pXInterceptDisplacements[v9 + 1] + v8[_this->pVertexIDs[v9 + 1]].x; | |
2273 word_720B40_intercepts_zs[v10 + 1] = _this->pZInterceptDisplacements[v9 + 1] + v8[_this->pVertexIDs[v9 + 1]].z; | |
2274 } | |
2275 while ( v29 < _this->uNumVertices ); | |
2276 } | |
2277 } | |
2278 else | |
2279 { | |
2280 v26 = SHIWORD(a2); | |
2281 v11 = a3; | |
2282 v30 = 0; | |
2283 v27 = v11; | |
2284 if ( _this->uNumVertices ) | |
2285 { | |
2286 v12 = pIndoor->pVertices; | |
2287 do | |
2288 { | |
2289 v13 = v30; | |
2290 v14 = 2 * v30; | |
2291 word_720C10_intercepts_xs[2 * v30] = _this->pYInterceptDisplacements[v30] + v12[_this->pVertexIDs[v30]].y; | |
2292 word_720B40_intercepts_zs[2 * v30] = _this->pZInterceptDisplacements[v13] + v12[_this->pVertexIDs[v13]].z; | |
2293 word_720C10_intercepts_xs[2 * v30++ + 1] = _this->pYInterceptDisplacements[v13 + 1] + v12[_this->pVertexIDs[v13 + 1]].y; | |
2294 word_720B40_intercepts_zs[v14 + 1] = _this->pZInterceptDisplacements[v13 + 1] + v12[_this->pVertexIDs[v13 + 1]].z; | |
2295 } | |
2296 while ( v30 < _this->uNumVertices ); | |
2297 } | |
2298 } | |
2299 } | |
2300 v15 = 2 * _this->uNumVertices; | |
2301 v31 = 0; | |
2302 word_720C10_intercepts_xs[2 * _this->uNumVertices] = word_720C10_intercepts_xs[0]; | |
2303 word_720B40_intercepts_zs[v15] = word_720B40_intercepts_zs[0]; | |
2304 v25 = 0; | |
2305 v16 = word_720B40_intercepts_zs[0] >= v27; | |
2306 if ( v15 <= 0 ) | |
1418 | 2307 return 0; |
0 | 2308 do |
2309 { | |
2310 if ( v31 >= 2 ) | |
2311 break; | |
2312 v17 = v25; | |
2313 v18 = word_720B40_intercepts_zs[v25 + 1]; | |
1110 | 2314 if ( v16 ^ (v18 >= v27) ) |
0 | 2315 { |
2316 v19 = word_720C10_intercepts_xs[v17 + 1]; | |
2317 if ( v19 >= v26 ) | |
2318 v20 = 0; | |
2319 else | |
2320 v20 = 2; | |
1110 | 2321 v21 = v20 | (word_720C10_intercepts_xs[v17] < v26); |
0 | 2322 if ( v21 != 3 ) |
2323 { | |
2324 if ( !v21 | |
2325 || (v22 = v19 - word_720C10_intercepts_xs[v17], | |
2326 LODWORD(v23) = v22 << 16, | |
2327 HIDWORD(v23) = v22 >> 16, | |
2328 word_720C10_intercepts_xs[v17] | |
2329 + ((signed int)(((unsigned __int64)(v23 | |
2330 / (v18 - word_720B40_intercepts_zs[v17]) | |
2331 * ((v27 - (signed int)word_720B40_intercepts_zs[v17]) << 16)) >> 16) | |
2332 + 32768) >> 16) >= v26) ) | |
2333 ++v31; | |
2334 } | |
2335 } | |
2336 ++v25; | |
2337 v16 = v18 >= v27; | |
2338 } | |
2339 while ( v25 < v15 ); | |
2340 result = 1; | |
2341 if ( v31 != 1 ) | |
2342 result = 0; | |
2343 return result; | |
2344 } | |
2345 | |
2346 //----- (004759C9) -------------------------------------------------------- | |
2347 bool __fastcall sub_4759C9(BLVFace *a1, int a2, int a3, __int16 a4) | |
2348 { | |
2349 unsigned int v4; // eax@1 | |
2350 int v5; // edx@4 | |
2351 __int16 v6; // si@4 | |
2352 int v7; // edx@9 | |
2353 __int16 v8; // si@9 | |
2354 int v9; // edx@13 | |
2355 __int16 v10; // si@13 | |
2356 int v11; // esi@14 | |
2357 bool v12; // edi@14 | |
2358 int v13; // ecx@16 | |
2359 signed int v14; // edx@16 | |
2360 int v15; // eax@17 | |
2361 signed int v16; // ebx@18 | |
2362 int v17; // edi@20 | |
2363 signed int v18; // ST14_4@22 | |
2364 signed __int64 v19; // qtt@22 | |
2365 bool result; // eax@25 | |
2366 int v21; // [sp+14h] [bp-10h]@14 | |
2367 signed int v22; // [sp+18h] [bp-Ch]@1 | |
2368 int v23; // [sp+1Ch] [bp-8h]@2 | |
2369 signed int v24; // [sp+20h] [bp-4h]@2 | |
2370 Vec3_int_ **a4a; // [sp+30h] [bp+Ch]@3 | |
2371 Vec3_int_ **a4b; // [sp+30h] [bp+Ch]@8 | |
2372 Vec3_int_ **a4c; // [sp+30h] [bp+Ch]@12 | |
2373 signed int a4d; // [sp+30h] [bp+Ch]@14 | |
2374 | |
2375 v4 = a1->uAttributes; | |
2376 v22 = 0; | |
2377 if ( BYTE1(v4) & 1 ) | |
2378 { | |
2379 v23 = (signed __int16)a3; | |
2380 v24 = SHIWORD(a3); | |
2381 if ( a1->uNumVertices ) | |
2382 { | |
2383 a4a = &pOutdoor->pBModels[a2].pVertices.pVertices; | |
2384 do | |
2385 { | |
2386 v5 = 2 * v22; | |
2387 word_720A70_intercepts_xs_plus_xs[2 * v22] = a1->pXInterceptDisplacements[v22] + LOWORD((*a4a)[a1->pVertexIDs[v22]].x); | |
2388 word_7209A0_intercepts_ys_plus_ys[2 * v22] = a1->pYInterceptDisplacements[v22] + LOWORD((*a4a)[a1->pVertexIDs[v22]].y); | |
2389 word_720A70_intercepts_xs_plus_xs[2 * v22 + 1] = a1->pXInterceptDisplacements[v22 + 1] + LOWORD((*a4a)[a1->pVertexIDs[v22 + 1]].x); | |
2390 word_7209A0_intercepts_ys_plus_ys[v5 + 1] = v6 = a1->pYInterceptDisplacements[v22 + 1] + LOWORD((*a4a)[a1->pVertexIDs[v22 + 1]].y); | |
2391 ++v22; | |
2392 } | |
2393 while ( v22 < a1->uNumVertices ); | |
2394 } | |
2395 } | |
2396 else | |
2397 { | |
2398 if ( BYTE1(v4) & 2 ) | |
2399 { | |
2400 v23 = (signed __int16)a3; | |
2401 v24 = a4; | |
2402 if ( a1->uNumVertices ) | |
2403 { | |
2404 a4b = &pOutdoor->pBModels[a2].pVertices.pVertices; | |
2405 do | |
2406 { | |
2407 v7 = 2 * v22; | |
2408 word_720A70_intercepts_xs_plus_xs[2 * v22] = a1->pXInterceptDisplacements[v22] + LOWORD((*a4b)[a1->pVertexIDs[v22]].x); | |
2409 word_7209A0_intercepts_ys_plus_ys[2 * v22] = a1->pZInterceptDisplacements[v22] + LOWORD((*a4b)[a1->pVertexIDs[v22]].z); | |
2410 word_720A70_intercepts_xs_plus_xs[2 * v22 + 1] = a1->pXInterceptDisplacements[v22 + 1] + LOWORD((*a4b)[a1->pVertexIDs[v22 + 1]].x); | |
2411 word_7209A0_intercepts_ys_plus_ys[v7 + 1] = v8 = a1->pZInterceptDisplacements[v22 + 1] + LOWORD((*a4b)[a1->pVertexIDs[v22 + 1]].z); | |
2412 ++v22; | |
2413 } | |
2414 while ( v22 < a1->uNumVertices ); | |
2415 } | |
2416 } | |
2417 else | |
2418 { | |
2419 v23 = SHIWORD(a3); | |
2420 v24 = a4; | |
2421 if ( a1->uNumVertices ) | |
2422 { | |
2423 a4c = &pOutdoor->pBModels[a2].pVertices.pVertices; | |
2424 do | |
2425 { | |
2426 v9 = 2 * v22; | |
2427 word_720A70_intercepts_xs_plus_xs[2 * v22] = a1->pYInterceptDisplacements[v22] + LOWORD((*a4c)[a1->pVertexIDs[v22]].y); | |
2428 word_7209A0_intercepts_ys_plus_ys[2 * v22] = a1->pZInterceptDisplacements[v22] + LOWORD((*a4c)[a1->pVertexIDs[v22]].z); | |
2429 word_720A70_intercepts_xs_plus_xs[2 * v22 + 1] = a1->pYInterceptDisplacements[v22 + 1] + LOWORD((*a4c)[a1->pVertexIDs[v22 + 1]].y); | |
2430 word_7209A0_intercepts_ys_plus_ys[v9 + 1] = v10 = a1->pZInterceptDisplacements[v22 + 1] + LOWORD((*a4c)[a1->pVertexIDs[v22 + 1]].z); | |
2431 ++v22; | |
2432 } | |
2433 while ( v22 < a1->uNumVertices ); | |
2434 } | |
2435 } | |
2436 } | |
2437 v11 = 2 * a1->uNumVertices; | |
2438 a4d = 0; | |
2439 word_720A70_intercepts_xs_plus_xs[2 * a1->uNumVertices] = word_720A70_intercepts_xs_plus_xs[0]; | |
2440 word_7209A0_intercepts_ys_plus_ys[v11] = word_7209A0_intercepts_ys_plus_ys[0]; | |
2441 v21 = 0; | |
2442 v12 = word_7209A0_intercepts_ys_plus_ys[0] >= v24; | |
2443 if ( v11 <= 0 ) | |
1418 | 2444 return 0; |
0 | 2445 do |
2446 { | |
2447 if ( a4d >= 2 ) | |
2448 break; | |
2449 v13 = v21; | |
2450 v14 = word_7209A0_intercepts_ys_plus_ys[v21 + 1]; | |
1110 | 2451 if ( v12 ^ (v14 >= v24) ) |
0 | 2452 { |
2453 v15 = word_720A70_intercepts_xs_plus_xs[v13 + 1]; | |
2454 if ( v15 >= v23 ) | |
2455 v16 = 0; | |
2456 else | |
2457 v16 = 2; | |
1110 | 2458 v17 = v16 | (word_720A70_intercepts_xs_plus_xs[v13] < v23); |
0 | 2459 if ( v17 != 3 ) |
2460 { | |
2461 if ( !v17 | |
2462 || (v18 = v15 - word_720A70_intercepts_xs_plus_xs[v13], | |
2463 LODWORD(v19) = v18 << 16, | |
2464 HIDWORD(v19) = v18 >> 16, | |
2465 word_720A70_intercepts_xs_plus_xs[v13] | |
2466 + ((signed int)(((unsigned __int64)(v19 | |
2467 / (v14 - word_7209A0_intercepts_ys_plus_ys[v13]) | |
2468 * ((v24 - (signed int)word_7209A0_intercepts_ys_plus_ys[v13]) << 16)) >> 16) | |
2469 + 32768) >> 16) >= v23) ) | |
2470 ++a4d; | |
2471 } | |
2472 } | |
2473 ++v21; | |
2474 v12 = v14 >= v24; | |
2475 } | |
2476 while ( v21 < v11 ); | |
2477 result = 1; | |
2478 if ( a4d != 1 ) | |
2479 result = 0; | |
2480 return result; | |
2481 } | |
2482 | |
2483 //----- (00475D85) -------------------------------------------------------- | |
2484 bool __fastcall sub_475D85(Vec3_int_ *a1, Vec3_int_ *a2, int *a3, BLVFace *a4) | |
2485 { | |
2486 BLVFace *v4; // ebx@1 | |
2487 int v5; // ST24_4@2 | |
2488 int v6; // ST28_4@2 | |
2489 int v7; // edi@2 | |
2490 int v8; // eax@5 | |
2491 signed int v9; // esi@5 | |
2492 signed __int64 v10; // qtt@10 | |
2493 Vec3_int_ *v11; // esi@11 | |
2494 int v12; // ST14_4@11 | |
2495 Vec3_int_ *v14; // [sp+Ch] [bp-18h]@1 | |
2496 Vec3_int_ *v15; // [sp+14h] [bp-10h]@1 | |
2497 int v16; // [sp+18h] [bp-Ch]@2 | |
2498 int v17; // [sp+20h] [bp-4h]@10 | |
2499 int a4b; // [sp+30h] [bp+Ch]@2 | |
2500 int a4c; // [sp+30h] [bp+Ch]@9 | |
2501 signed int a4a; // [sp+30h] [bp+Ch]@10 | |
2502 | |
2503 v4 = a4; | |
2504 v15 = a2; | |
2505 v14 = a1; | |
2506 if ( BYTE3(a4->uAttributes) & 0x20 | |
2507 || (v5 = (unsigned __int64)(a2->x * (signed __int64)a4->pFacePlane_old.vNormal.x) >> 16, | |
2508 a4b = (unsigned __int64)(a2->y * (signed __int64)a4->pFacePlane_old.vNormal.y) >> 16, | |
2509 v6 = (unsigned __int64)(a2->z * (signed __int64)v4->pFacePlane_old.vNormal.z) >> 16, | |
2510 v7 = v5 + v6 + a4b, | |
2511 (v16 = v5 + v6 + a4b) == 0) | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
675
diff
changeset
|
2512 || v7 > 0 && !v4->Portal()) |
0 | 2513 return 0; |
2514 v8 = v4->pFacePlane_old.vNormal.z * a1->z; | |
2515 v9 = -(v4->pFacePlane_old.dist + v8 + a1->y * v4->pFacePlane_old.vNormal.y + a1->x * v4->pFacePlane_old.vNormal.x); | |
2516 if ( v7 <= 0 ) | |
2517 { | |
2518 if ( v4->pFacePlane_old.dist + v8 + a1->y * v4->pFacePlane_old.vNormal.y + a1->x * v4->pFacePlane_old.vNormal.x < 0 ) | |
2519 return 0; | |
2520 } | |
2521 else | |
2522 { | |
2523 if ( v9 < 0 ) | |
2524 return 0; | |
2525 } | |
2526 a4c = abs(-(v4->pFacePlane_old.dist + v8 + a1->y * v4->pFacePlane_old.vNormal.y + a1->x * v4->pFacePlane_old.vNormal.x)) >> 14; | |
2527 if ( a4c > abs(v7) | |
2528 || (LODWORD(v10) = v9 << 16, HIDWORD(v10) = v9 >> 16, a4a = v10 / v16, v17 = v10 / v16, v17 > *a3 << 16) | |
2529 || (v11 = v14, | |
2530 LOWORD(v12) = LOWORD(v14->x) | |
2531 + (((unsigned int)((unsigned __int64)(v17 * (signed __int64)v15->x) >> 16) + 32768) >> 16), | |
2532 HIWORD(v12) = LOWORD(v11->y) | |
2533 + (((unsigned int)((unsigned __int64)(v17 * (signed __int64)v15->y) >> 16) + 32768) >> 16), | |
2534 !sub_475665( | |
2535 v4, | |
2536 v12, | |
2537 LOWORD(v11->z) + (((unsigned int)((unsigned __int64)(v17 * (signed __int64)v15->z) >> 16) + 32768) >> 16))) ) | |
2538 return 0; | |
2539 *a3 = a4a >> 16; | |
2540 return 1; | |
2541 } | |
2542 | |
2543 //----- (00475F30) -------------------------------------------------------- | |
2544 bool __fastcall sub_475F30(int *a1, BLVFace *a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9) | |
2545 { | |
2546 BLVFace *v9; // ebx@1 | |
2547 int v10; // ST20_4@2 | |
2548 int v11; // ST28_4@2 | |
2549 int v12; // ST24_4@2 | |
2550 char v13; // zf@2 | |
2551 int v14; // edi@2 | |
2552 int v15; // eax@5 | |
2553 signed int v16; // esi@5 | |
2554 int v17; // ST20_4@9 | |
2555 signed __int64 v18; // qtt@10 | |
2556 int v19; // ST14_4@11 | |
2557 int *v21; // [sp+14h] [bp-10h]@1 | |
2558 int v22; // [sp+1Ch] [bp-8h]@2 | |
2559 int v23; // [sp+1Ch] [bp-8h]@10 | |
2560 signed int v24; // [sp+20h] [bp-4h]@10 | |
2561 | |
2562 v9 = a2; | |
2563 v21 = a1; | |
2564 if ( BYTE3(a2->uAttributes) & 0x20 | |
2565 || (v10 = (unsigned __int64)(a6 * (signed __int64)a2->pFacePlane_old.vNormal.x) >> 16, | |
2566 v11 = (unsigned __int64)(a7 * (signed __int64)a2->pFacePlane_old.vNormal.y) >> 16, | |
2567 v12 = (unsigned __int64)(a8 * (signed __int64)a2->pFacePlane_old.vNormal.z) >> 16, | |
2568 v13 = v10 + v12 + v11 == 0, | |
2569 v14 = v10 + v12 + v11, | |
2570 v22 = v10 + v12 + v11, | |
2571 v13) | |
676
ecfb1b3c9a39
BLV: when standing right on the portal (orange wall) everything looks fine
Nomad
parents:
675
diff
changeset
|
2572 || v14 > 0 && !a2->Portal()) |
0 | 2573 return 0; |
2574 v15 = a4 * a2->pFacePlane_old.vNormal.y; | |
2575 v16 = -(a2->pFacePlane_old.dist + v15 + a3 * a2->pFacePlane_old.vNormal.x + a5 * a2->pFacePlane_old.vNormal.z); | |
2576 if ( v14 <= 0 ) | |
2577 { | |
2578 if ( a2->pFacePlane_old.dist + v15 + a3 * a2->pFacePlane_old.vNormal.x + a5 * a2->pFacePlane_old.vNormal.z < 0 ) | |
2579 return 0; | |
2580 } | |
2581 else | |
2582 { | |
2583 if ( v16 < 0 ) | |
2584 return 0; | |
2585 } | |
2586 v17 = abs(-(a2->pFacePlane_old.dist + v15 + a3 * a2->pFacePlane_old.vNormal.x + a5 * a2->pFacePlane_old.vNormal.z)) >> 14; | |
2587 if ( v17 > abs(v14) | |
2588 || (LODWORD(v18) = v16 << 16, HIDWORD(v18) = v16 >> 16, v24 = v18 / v22, v23 = v18 / v22, v23 > *v21 << 16) | |
2589 || (LOWORD(v19) = a3 + (((unsigned int)((unsigned __int64)(v23 * (signed __int64)a6) >> 16) + 32768) >> 16), | |
2590 HIWORD(v19) = a4 + (((unsigned int)((unsigned __int64)(v23 * (signed __int64)a7) >> 16) + 32768) >> 16), | |
2591 !sub_4759C9( | |
2592 v9, | |
2593 a9, | |
2594 v19, | |
2595 a5 + (((unsigned int)((unsigned __int64)(v23 * (signed __int64)a8) >> 16) + 32768) >> 16))) ) | |
2596 return 0; | |
2597 *v21 = v24 >> 16; | |
2598 return 1; | |
2599 } | |
2600 | |
2601 //----- (004760D5) -------------------------------------------------------- | |
2602 PartyAction ActionQueue::Next() | |
2603 { | |
2604 if (!uNumActions) | |
2605 return PARTY_INVALID; | |
2606 | |
1980 | 2607 PartyAction result = pActions[0]; |
0 | 2608 for (unsigned int i = 0; i < uNumActions - 1; ++i) |
2609 pActions[i] = pActions[i + 1]; | |
2610 --uNumActions; | |
2611 | |
2612 return result; | |
2613 } | |
2614 | |
2615 //----- (004775ED) -------------------------------------------------------- | |
2616 int stru6_stru1_indoor_sw_billboard::_4775ED(float a2) | |
2617 { | |
2618 char *v2; // edi@1 | |
2619 int v3; // eax@1 | |
2620 char *v4; // edx@2 | |
2621 char *v5; // esi@3 | |
2622 double v6; // st7@6 | |
2623 signed __int64 v7; // ST84_8@6 | |
2624 double v8; // ST0C_8@6 | |
2625 int v9; // esi@6 | |
2626 double v10; // ST44_8@6 | |
2627 int v11; // ecx@6 | |
2628 double v12; // ST34_8@6 | |
2629 int v13; // ecx@6 | |
2630 double v14; // ST14_8@6 | |
2631 double v15; // st7@8 | |
2632 unsigned int v16; // ecx@8 | |
2633 signed __int64 v17; // ST64_8@8 | |
2634 double v18; // ST24_8@8 | |
2635 int v19; // edi@8 | |
2636 double v20; // ST3C_8@8 | |
2637 int v21; // ecx@8 | |
2638 double v22; // ST2C_8@8 | |
2639 int v23; // ST9C_4@8 | |
2640 double v24; // ST1C_8@8 | |
2641 int *v25; // edi@8 | |
2642 int v26; // esi@8 | |
2643 int *v27; // edi@10 | |
2644 int v28; // esi@10 | |
2645 int result; // eax@12 | |
2646 __int64 v30; // [sp+A8h] [bp-30h]@8 | |
2647 float v31; // [sp+B0h] [bp-28h]@6 | |
2648 float v32; // [sp+B4h] [bp-24h]@6 | |
2649 int v33; // [sp+B8h] [bp-20h]@6 | |
2650 int v34; // [sp+BCh] [bp-1Ch]@2 | |
2651 stru6_stru1_indoor_sw_billboard *v35; // [sp+C0h] [bp-18h]@1 | |
2652 float v36; // [sp+C4h] [bp-14h]@6 | |
2653 int v37; // [sp+C8h] [bp-10h]@6 | |
2654 int v38; // [sp+CCh] [bp-Ch]@1 | |
2655 float v39; // [sp+D0h] [bp-8h]@6 | |
2656 int *v40; // [sp+D4h] [bp-4h]@2 | |
2657 | |
1390 | 2658 v2 = (char *)&this->field_64[4 * this->uNumVertices]; |
0 | 2659 v38 = 0; |
1390 | 2660 *(int *)v2 = this->field_64[0]; |
0 | 2661 v2 += 4; |
1390 | 2662 *(int *)v2 = this->field_64[1]; |
0 | 2663 v2 += 4; |
1390 | 2664 *(int *)v2 = this->field_64[2]; |
2665 *((int *)v2 + 1) = this->field_64[3]; | |
2666 v3 = this->uNumVertices; | |
0 | 2667 v35 = this; |
2668 if ( v3 > 0 ) | |
2669 { | |
1390 | 2670 v40 = &this->field_64[20]; |
2671 v4 = (char *)&this->field_64[3] + 3; | |
0 | 2672 v34 = v3; |
2673 while ( 1 ) | |
2674 { | |
2675 v5 = v4 - 15; | |
2676 if ( *(float *)(v4 - 15) <= (double)a2 && *(float *)(v4 + 1) <= (double)a2 ) | |
1418 | 2677 { |
2678 v4 += 16; | |
2679 --v34; | |
2680 if ( !v34 ) | |
2681 return this->uNumVertices = v38; | |
2682 continue; | |
2683 } | |
0 | 2684 if ( *(float *)v5 <= (double)a2 ) |
1418 | 2685 { |
2686 v6 = (a2 - *(float *)v5) / (*(float *)(v4 + 1) - *(float *)v5); | |
2687 v7 = (unsigned __int8)v4[16] - (unsigned int)(unsigned __int8)*v4; | |
2688 v36 = v6; | |
2689 v31 = (*(float *)(v4 + 5) - *(float *)(v4 - 11)) * v6 + *(float *)(v4 - 11); | |
2690 v32 = (*(float *)(v4 + 9) - *(float *)(v4 - 7)) * v6 + *(float *)(v4 - 7); | |
2691 *(float *)&v37 = (double)v7 * v6; | |
2692 v8 = *(float *)&v37 + 6.7553994e15; | |
2693 v9 = (unsigned __int8)*v4; | |
2694 *(float *)&v37 = (double)((unsigned __int8)v4[15] - (unsigned int)(unsigned __int8)*(v4 - 1)) * v36; | |
2695 v10 = *(float *)&v37 + 6.7553994e15; | |
2696 v11 = (unsigned __int8)*(v4 - 2); | |
2697 v37 = LODWORD(v10) + (unsigned __int8)*(v4 - 1); | |
2698 v39 = (double)((unsigned int)(unsigned __int8)v4[14] - v11) * v36; | |
2699 v12 = v39 + 6.7553994e15; | |
2700 v13 = LODWORD(v12) + (unsigned __int8)*(v4 - 2); | |
2701 v39 = (double)((*(int *)(v4 + 13) & 0xFF) - (*(int *)(v4 - 3) & 0xFFu)) * v36; | |
2702 v14 = v39 + 6.7553994e15; | |
2703 v33 = (LODWORD(v14) + (*(int *)(v4 - 3) & 0xFF)) | ((v13 | ((v37 | ((LODWORD(v8) + v9) << 8)) << 8)) << 8); | |
2704 //this = v35; | |
2705 v5 = (char *)&v30 + 4; | |
2706 } | |
2707 else if ( *(float *)(v4 + 1) <= (double)a2 ) | |
0 | 2708 { |
2709 v15 = (a2 - *(float *)v5) / (*(float *)(v4 + 1) - *(float *)v5); | |
2710 v16 = (unsigned __int8)*v4; | |
2711 HIDWORD(v30) = LODWORD(a2); | |
2712 v17 = (unsigned __int8)v4[16] - v16; | |
2713 v36 = v15; | |
2714 v31 = (*(float *)(v4 + 5) - *(float *)(v4 - 11)) * v15 + *(float *)(v4 - 11); | |
2715 v32 = (*(float *)(v4 + 9) - *(float *)(v4 - 7)) * v15 + *(float *)(v4 - 7); | |
2716 v39 = (double)v17 * v15; | |
2717 v18 = v39 + 6.7553994e15; | |
2718 v19 = (unsigned __int8)*v4; | |
2719 v39 = (double)((unsigned __int8)v4[15] - (unsigned int)(unsigned __int8)*(v4 - 1)) * v36; | |
2720 v20 = v39 + 6.7553994e15; | |
2721 v21 = (unsigned __int8)*(v4 - 2); | |
2722 v37 = LODWORD(v20) + (unsigned __int8)*(v4 - 1); | |
2723 v39 = (double)((unsigned int)(unsigned __int8)v4[14] - v21) * v36; | |
2724 v22 = v39 + 6.7553994e15; | |
2725 v23 = LODWORD(v22) + (unsigned __int8)*(v4 - 2); | |
2726 v39 = (double)((*(int *)(v4 + 13) & 0xFF) - (*(int *)(v4 - 3) & 0xFFu)) * v36; | |
2727 v24 = v39 + 6.7553994e15; | |
2728 v33 = (LODWORD(v24) + (*(int *)(v4 - 3) & 0xFF)) | ((v23 | ((v37 | ((LODWORD(v18) + v19) << 8)) << 8)) << 8); | |
2729 v25 = v40; | |
2730 *v40 = *(int *)v5; | |
2731 v26 = (int)(v5 + 4); | |
2732 ++v25; | |
2733 *v25 = *(int *)v26; | |
2734 v26 += 4; | |
2735 ++v25; | |
2736 ++v38; | |
2737 v40 += 4; | |
2738 *v25 = *(int *)v26; | |
2739 v25[1] = *(int *)(v26 + 4); | |
1418 | 2740 v5 = (char *)&v30 + 4; |
0 | 2741 } |
2742 v27 = v40; | |
2743 ++v38; | |
2744 *v40 = *(int *)v5; | |
2745 v28 = (int)(v5 + 4); | |
2746 ++v27; | |
2747 *v27 = *(int *)v28; | |
2748 v28 += 4; | |
2749 ++v27; | |
2750 v40 += 4; | |
2751 *v27 = *(int *)v28; | |
2752 v27[1] = *(int *)(v28 + 4); | |
2753 v4 += 16; | |
2754 --v34; | |
2755 if ( !v34 ) | |
1418 | 2756 return this->uNumVertices = v38; |
0 | 2757 } |
1418 | 2758 } |
1390 | 2759 return this->uNumVertices = v38; |
0 | 2760 } |
2761 | |
2762 //----- (00477927) -------------------------------------------------------- | |
2763 int stru6_stru1_indoor_sw_billboard::_477927(float a2) | |
2764 { | |
2765 char *v2; // edi@1 | |
2766 int v3; // eax@1 | |
2767 char *v4; // edx@2 | |
2768 char *v5; // esi@3 | |
2769 double v6; // st7@6 | |
2770 signed __int64 v7; // ST84_8@6 | |
2771 double v8; // ST0C_8@6 | |
2772 int v9; // esi@6 | |
2773 double v10; // ST44_8@6 | |
2774 int v11; // ecx@6 | |
2775 double v12; // ST34_8@6 | |
2776 int v13; // ecx@6 | |
2777 double v14; // ST14_8@6 | |
2778 double v15; // st7@8 | |
2779 unsigned int v16; // ecx@8 | |
2780 signed __int64 v17; // ST64_8@8 | |
2781 double v18; // ST24_8@8 | |
2782 int v19; // edi@8 | |
2783 double v20; // ST3C_8@8 | |
2784 int v21; // ecx@8 | |
2785 double v22; // ST2C_8@8 | |
2786 int v23; // ST9C_4@8 | |
2787 double v24; // ST1C_8@8 | |
2788 int *v25; // edi@8 | |
2789 int v26; // esi@8 | |
2790 int *v27; // edi@10 | |
2791 int v28; // esi@10 | |
2792 int result; // eax@12 | |
2793 __int64 v30; // [sp+A8h] [bp-30h]@8 | |
2794 float v31; // [sp+B0h] [bp-28h]@6 | |
2795 float v32; // [sp+B4h] [bp-24h]@6 | |
2796 int v33; // [sp+B8h] [bp-20h]@6 | |
2797 int v34; // [sp+BCh] [bp-1Ch]@2 | |
2798 stru6_stru1_indoor_sw_billboard *v35; // [sp+C0h] [bp-18h]@1 | |
2799 float v36; // [sp+C4h] [bp-14h]@6 | |
2800 int v37; // [sp+C8h] [bp-10h]@6 | |
2801 int v38; // [sp+CCh] [bp-Ch]@1 | |
2802 float v39; // [sp+D0h] [bp-8h]@6 | |
2803 int *v40; // [sp+D4h] [bp-4h]@2 | |
2804 | |
1390 | 2805 v2 = (char *)&this->field_64[4 * this->uNumVertices]; |
0 | 2806 v38 = 0; |
1390 | 2807 *(int *)v2 = this->field_64[0]; |
0 | 2808 v2 += 4; |
1390 | 2809 *(int *)v2 = this->field_64[1]; |
0 | 2810 v2 += 4; |
1390 | 2811 *(int *)v2 = this->field_64[2]; |
2812 *((int *)v2 + 1) = this->field_64[3]; | |
2813 v3 = this->uNumVertices; | |
0 | 2814 v35 = this; |
2815 if ( v3 > 0 ) | |
2816 { | |
1390 | 2817 v40 = &this->field_64[20]; |
2818 v4 = (char *)&this->field_64[3] + 3; | |
0 | 2819 v34 = v3; |
2820 while ( 1 ) | |
2821 { | |
2822 v5 = v4 - 15; | |
2823 if ( *(float *)(v4 - 15) >= (double)a2 && *(float *)(v4 + 1) >= (double)a2 ) | |
1418 | 2824 { |
2825 v4 += 16; | |
2826 --v34; | |
2827 if ( !v34 ) | |
2828 return this->uNumVertices = v38; | |
2829 continue; | |
2830 } | |
0 | 2831 if ( *(float *)v5 >= (double)a2 ) |
1418 | 2832 { |
2833 v6 = (a2 - *(float *)v5) / (*(float *)(v4 + 1) - *(float *)v5); | |
2834 v7 = (unsigned __int8)v4[16] - (unsigned int)(unsigned __int8)*v4; | |
2835 v36 = v6; | |
2836 v31 = (*(float *)(v4 + 5) - *(float *)(v4 - 11)) * v6 + *(float *)(v4 - 11); | |
2837 v32 = (*(float *)(v4 + 9) - *(float *)(v4 - 7)) * v6 + *(float *)(v4 - 7); | |
2838 *(float *)&v37 = (double)v7 * v6; | |
2839 v8 = *(float *)&v37 + 6.7553994e15; | |
2840 v9 = (unsigned __int8)*v4; | |
2841 *(float *)&v37 = (double)((unsigned __int8)v4[15] - (unsigned int)(unsigned __int8)*(v4 - 1)) * v36; | |
2842 v10 = *(float *)&v37 + 6.7553994e15; | |
2843 v11 = (unsigned __int8)*(v4 - 2); | |
2844 v37 = LODWORD(v10) + (unsigned __int8)*(v4 - 1); | |
2845 v39 = (double)((unsigned int)(unsigned __int8)v4[14] - v11) * v36; | |
2846 v12 = v39 + 6.7553994e15; | |
2847 v13 = LODWORD(v12) + (unsigned __int8)*(v4 - 2); | |
2848 v39 = (double)((*(int *)(v4 + 13) & 0xFF) - (*(int *)(v4 - 3) & 0xFFu)) * v36; | |
2849 v14 = v39 + 6.7553994e15; | |
2850 v33 = (LODWORD(v14) + (*(int *)(v4 - 3) & 0xFF)) | ((v13 | ((v37 | ((LODWORD(v8) + v9) << 8)) << 8)) << 8); | |
2851 //this = v35; | |
2852 v5 = (char *)&v30 + 4; | |
2853 } | |
2854 else if ( *(float *)(v4 + 1) >= (double)a2 ) | |
0 | 2855 { |
2856 v15 = (a2 - *(float *)v5) / (*(float *)(v4 + 1) - *(float *)v5); | |
2857 v16 = (unsigned __int8)*v4; | |
2858 HIDWORD(v30) = LODWORD(a2); | |
2859 v17 = (unsigned __int8)v4[16] - v16; | |
2860 v36 = v15; | |
2861 v31 = (*(float *)(v4 + 5) - *(float *)(v4 - 11)) * v15 + *(float *)(v4 - 11); | |
2862 v32 = (*(float *)(v4 + 9) - *(float *)(v4 - 7)) * v15 + *(float *)(v4 - 7); | |
2863 v39 = (double)v17 * v15; | |
2864 v18 = v39 + 6.7553994e15; | |
2865 v19 = (unsigned __int8)*v4; | |
2866 v39 = (double)((unsigned __int8)v4[15] - (unsigned int)(unsigned __int8)*(v4 - 1)) * v36; | |
2867 v20 = v39 + 6.7553994e15; | |
2868 v21 = (unsigned __int8)*(v4 - 2); | |
2869 v37 = LODWORD(v20) + (unsigned __int8)*(v4 - 1); | |
2870 v39 = (double)((unsigned int)(unsigned __int8)v4[14] - v21) * v36; | |
2871 v22 = v39 + 6.7553994e15; | |
2872 v23 = LODWORD(v22) + (unsigned __int8)*(v4 - 2); | |
2873 v39 = (double)((*(int *)(v4 + 13) & 0xFF) - (*(int *)(v4 - 3) & 0xFFu)) * v36; | |
2874 v24 = v39 + 6.7553994e15; | |
2875 v33 = (LODWORD(v24) + (*(int *)(v4 - 3) & 0xFF)) | ((v23 | ((v37 | ((LODWORD(v18) + v19) << 8)) << 8)) << 8); | |
2876 v25 = v40; | |
2877 *v40 = *(int *)v5; | |
2878 v26 = (int)(v5 + 4); | |
2879 ++v25; | |
2880 *v25 = *(int *)v26; | |
2881 v26 += 4; | |
2882 ++v25; | |
2883 ++v38; | |
2884 v40 += 4; | |
2885 *v25 = *(int *)v26; | |
2886 v25[1] = *(int *)(v26 + 4); | |
1418 | 2887 v5 = (char *)&v30 + 4; |
0 | 2888 } |
2889 v27 = v40; | |
2890 ++v38; | |
2891 *v40 = *(int *)v5; | |
2892 v28 = (int)(v5 + 4); | |
2893 ++v27; | |
2894 *v27 = *(int *)v28; | |
2895 v28 += 4; | |
2896 ++v27; | |
2897 v40 += 4; | |
2898 *v27 = *(int *)v28; | |
2899 v27[1] = *(int *)(v28 + 4); | |
2900 v4 += 16; | |
2901 --v34; | |
2902 if ( !v34 ) | |
1418 | 2903 return this->uNumVertices = v38; |
0 | 2904 } |
1418 | 2905 } |
1390 | 2906 return this->uNumVertices = v38; |
0 | 2907 } |
2908 | |
2909 //----- (00477C61) -------------------------------------------------------- | |
2910 int stru6_stru1_indoor_sw_billboard::sub_477C61() | |
2911 { | |
998 | 2912 //stru6_stru1_indoor_sw_billboard *v1; // ebx@1 |
0 | 2913 int v2; // ecx@2 |
2914 int v3; // eax@3 | |
2915 double v4; // st7@4 | |
2916 double v5; // st7@5 | |
2917 double v6; // st6@5 | |
2918 double v7; // st5@6 | |
2919 float v8; // ST30_4@8 | |
2920 float v9; // ST24_4@8 | |
2921 double v10; // st7@8 | |
2922 double v11; // st6@8 | |
2923 double v12; // st5@8 | |
2924 float v13; // ST24_4@13 | |
2925 int v14; // esi@13 | |
2926 char *v15; // esi@15 | |
1638
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
2927 //signed int v16; // eax@16 |
0 | 2928 __int16 v17; // fps@16 |
2929 unsigned __int8 v18; // c2@16 | |
2930 unsigned __int8 v19; // c3@16 | |
2931 double v20; // st6@16 | |
2932 float v21; // ST18_4@17 | |
2933 float v22; // ST2C_4@17 | |
2934 float v23; // ST34_4@17 | |
2935 float v24; // ST24_4@17 | |
2936 double v25; // st7@17 | |
2937 double v26; // st6@17 | |
2938 float v27; // ST34_4@18 | |
2939 float v28; // ST30_4@18 | |
2940 int v29; // eax@19 | |
2941 signed int v31; // [sp+8h] [bp-28h]@15 | |
2942 float v32; // [sp+Ch] [bp-24h]@16 | |
2943 float v33; // [sp+14h] [bp-1Ch]@16 | |
2944 float v34; // [sp+18h] [bp-18h]@16 | |
2945 float v35; // [sp+1Ch] [bp-14h]@17 | |
2946 float v36; // [sp+20h] [bp-10h]@4 | |
2947 float v37; // [sp+24h] [bp-Ch]@4 | |
2948 float v38; // [sp+24h] [bp-Ch]@16 | |
2949 float v39; // [sp+28h] [bp-8h]@9 | |
2950 float v40; // [sp+28h] [bp-8h]@16 | |
2951 float v41; // [sp+2Ch] [bp-4h]@6 | |
2952 float v42; // [sp+2Ch] [bp-4h]@9 | |
2953 | |
998 | 2954 //v1 = this; |
0 | 2955 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) |
2956 { | |
2957 v2 = 0; | |
1390 | 2958 if ( this->uNumVertices > 0 ) |
998 | 2959 { |
2960 v3 = (int)&this->field_14[1]; | |
0 | 2961 do |
2962 { | |
2963 v4 = *(float *)(v3 - 4); | |
2964 LODWORD(v37) = *(int *)v3; | |
2965 LODWORD(v36) = *(int *)(v3 + 4); | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2966 if (pGame->pIndoorCameraD3D->sRotationX) |
0 | 2967 { |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2968 v5 = v4 - (double)pGame->pIndoorCameraD3D->vPartyPos.x; |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2969 v6 = v37 - (double)pGame->pIndoorCameraD3D->vPartyPos.y; |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2970 //if ( pRenderer->pRenderD3D ) |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2971 //{ |
1642 | 2972 v41 = pGame->pIndoorCameraD3D->fRotationYSine * v6 + pGame->pIndoorCameraD3D->fRotationYCosine * v5; |
2973 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
|
2974 /*} |
0 | 2975 else |
2976 { | |
2977 v41 = pBLVRenderParams->fCosineY * v5 - pBLVRenderParams->fSineY * v6; | |
2978 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
|
2979 }*/ |
0 | 2980 v8 = v7; |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2981 v9 = v36 - (double)pGame->pIndoorCameraD3D->vPartyPos.z; |
1642 | 2982 v10 = pGame->pIndoorCameraD3D->fRotationXCosine * v41 - pGame->pIndoorCameraD3D->fRotationXSine * v9; |
0 | 2983 v11 = v8; |
1642 | 2984 v12 = pGame->pIndoorCameraD3D->fRotationXCosine * v9 + pGame->pIndoorCameraD3D->fRotationXSine * v41; |
0 | 2985 } |
2986 else | |
2987 { | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2988 v42 = v4 - (double)pGame->pIndoorCameraD3D->vPartyPos.x; |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2989 v39 = v37 - (double)pGame->pIndoorCameraD3D->vPartyPos.y; |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2990 //if ( pRenderer->pRenderD3D ) |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2991 //{ |
1642 | 2992 v10 = pGame->pIndoorCameraD3D->fRotationYSine * v39 + pGame->pIndoorCameraD3D->fRotationYCosine * v42; |
2993 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
|
2994 /*} |
0 | 2995 else |
2996 { | |
2997 v10 = pBLVRenderParams->fCosineY * v42 - pBLVRenderParams->fSineY * v39; | |
2998 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
|
2999 }*/ |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
3000 v12 = v36 - (double)pGame->pIndoorCameraD3D->vPartyPos.z; |
0 | 3001 } |
3002 v13 = v12; | |
3003 ++v2; | |
3004 *(int *)(v3 + 84) = LODWORD(v13); | |
3005 v14 = *(int *)(v3 + 8); | |
3006 *(float *)(v3 + 76) = v10; | |
3007 *(int *)(v3 + 88) = v14; | |
3008 *(float *)(v3 + 80) = v11; | |
3009 v3 += 16; | |
3010 } | |
1390 | 3011 while ( v2 < this->uNumVertices ); |
0 | 3012 } |
3013 } | |
3014 else | |
3015 { | |
3016 v15 = (char *)&this->field_14[1]; | |
3017 v31 = 3; | |
3018 do | |
3019 { | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
3020 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
|
3021 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
|
3022 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
|
3023 v33 = (double)stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationY) * 0.0000152587890625; |
1638
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
3024 //v16 = stru_5C6E00->Sin(pODMRenderParams->rotation_y); |
0 | 3025 LODWORD(v38) = *(int *)v15; |
3026 //UNDEF(v17); | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
3027 v20 = *((float *)v15 - 1) - (double)pGame->pIndoorCameraD3D->vPartyPos.x; |
1090 | 3028 //if ( v19 | v18 ) |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
3029 if (pGame->pIndoorCameraD3D->vPartyPos.x == 0) |
0 | 3030 { |
3031 v27 = v20; | |
3032 LODWORD(v35) = *((int *)v15 + 1); | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
3033 v28 = v38 - (double)pGame->pIndoorCameraD3D->vPartyPos.y; |
0 | 3034 v25 = v33 * v28 + v34 * v27; |
3035 v26 = v34 * v28 - v33 * v27; | |
3036 } | |
3037 else | |
3038 { | |
3039 v21 = v20; | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
3040 v22 = v38 - (double)pGame->pIndoorCameraD3D->vPartyPos.y; |
0 | 3041 v23 = v33 * v22 + v34 * v21; |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
3042 v24 = *((float *)v15 + 1) - (double)pGame->pIndoorCameraD3D->vPartyPos.z; |
0 | 3043 v25 = v32 * v24 + v40 * v23; |
3044 v26 = v34 * v22 - v33 * v21; | |
3045 v35 = v40 * v24 - v32 * v23; | |
3046 } | |
3047 *((int *)v15 + 21) = LODWORD(v35); | |
3048 v29 = *((int *)v15 + 2); | |
3049 *((float *)v15 + 19) = v25; | |
3050 *((int *)v15 + 22) = v29; | |
3051 *((float *)v15 + 20) = v26; | |
3052 v15 += 16; | |
3053 --v31; | |
3054 } | |
3055 while ( v31 ); | |
3056 } | |
1390 | 3057 this->uNumVertices = 3; |
0 | 3058 return 1; |
3059 } | |
3060 | |
3061 //----- (00477F63) -------------------------------------------------------- | |
3062 bool stru6_stru1_indoor_sw_billboard::sub_477F63() | |
3063 { | |
3064 signed int v1; // ebx@1 | |
3065 stru6_stru1_indoor_sw_billboard *v2; // esi@1 | |
3066 double v3; // st7@2 | |
3067 int v4; // edx@4 | |
3068 char *v5; // ecx@5 | |
3069 int v6; // edi@5 | |
3070 float v7; // ST08_4@13 | |
3071 signed int v9; // [sp+Ch] [bp-8h]@1 | |
3072 float v10; // [sp+10h] [bp-4h]@2 | |
3073 | |
1980 | 3074 stru6_stru1_indoor_sw_billboard* a1 = this; |
0 | 3075 |
3076 v1 = 0; | |
3077 v2 = a1; | |
3078 v9 = 0; | |
3079 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) | |
3080 { | |
3081 v10 = 16192.0; | |
1641 | 3082 v3 = (double)pBLVRenderParams->fov_rad_fixpoint * 0.000015258789; |
0 | 3083 } |
3084 else | |
3085 { | |
1637 | 3086 v10 = (double)pODMRenderParams->shading_dist_mist; |
0 | 3087 v3 = 8.0; |
3088 } | |
1390 | 3089 v4 = a1->uNumVertices; |
0 | 3090 if ( v4 <= 0 ) |
1418 | 3091 { |
3092 memcpy(&v2->field_14[40], &v2->field_14[20], 16 * v4); | |
3093 return v2->uNumVertices != 0; | |
3094 } | |
0 | 3095 v5 = (char *)&a1->field_14[20]; |
3096 v6 = v4; | |
3097 do | |
3098 { | |
3099 if ( v3 >= *(float *)v5 || *(float *)v5 >= (double)v10 ) | |
3100 { | |
3101 if ( v3 < *(float *)v5 ) | |
3102 v9 = 1; | |
3103 else | |
3104 v1 = 1; | |
3105 } | |
3106 v5 += 16; | |
3107 --v6; | |
3108 } | |
3109 while ( v6 ); | |
3110 if ( !v1 ) | |
3111 { | |
3112 if ( v9 ) | |
3113 { | |
3114 v2->_477927(v10); | |
1390 | 3115 return v2->uNumVertices != 0; |
0 | 3116 } |
3117 memcpy(&v2->field_14[40], &v2->field_14[20], 16 * v4); | |
1390 | 3118 return v2->uNumVertices != 0; |
0 | 3119 } |
3120 v7 = v3; | |
3121 _4775ED(v7); | |
1390 | 3122 return v2->uNumVertices != 0; |
0 | 3123 } |
3124 | |
3125 //----- (0047802A) -------------------------------------------------------- | |
3126 int stru6_stru1_indoor_sw_billboard::sub_47802A() | |
3127 { | |
3128 double v6; // st7@4 | |
3129 double v12; // st7@16 | |
3130 signed int v16; // [sp+38h] [bp-Ch]@1 | |
3131 int a6; // [sp+3Ch] [bp-8h]@5 | |
3132 int a5; // [sp+40h] [bp-4h]@5 | |
3133 | |
1980 | 3134 stru6_stru1_indoor_sw_billboard* a1 = this; |
0 | 3135 |
3136 v16 = 0; | |
3137 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) | |
3138 { | |
1390 | 3139 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
|
3140 { |
1641 | 3141 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
|
3142 if ( pRenderer->pRenderD3D ) |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
3143 { |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
3144 pGame->pIndoorCameraD3D->Project( |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
3145 round(a1->field_B4[i*4]), |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
3146 round(a1->field_B4[i*4+1]), |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
3147 round(a1->field_B4[i*4+2]), |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
3148 &a5, |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
3149 &a6); |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
3150 a1->field_B4[i*4+16] = (double)a5; |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
3151 a1->field_B4[i*4+17] = (double)a6; |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
3152 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
|
3153 } |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
3154 else |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
3155 { |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
3156 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
|
3157 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
|
3158 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
|
3159 } |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
3160 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
|
3161 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
|
3162 && (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
|
3163 && (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
|
3164 && (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
|
3165 v16 = 1; |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
3166 } |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
3167 } |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
3168 else |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
3169 { |
1390 | 3170 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
|
3171 { |
1637 | 3172 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
|
3173 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
|
3174 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
|
3175 *((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
|
3176 *((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
|
3177 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
|
3178 && (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
|
3179 && (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
|
3180 && (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
|
3181 v16 = 1; |
0 | 3182 } |
3183 } | |
3184 return v16; | |
3185 } | |
3186 | |
3187 // 73C84C: using guessed type char static_RenderBuildingsD3D_byte_73C84C_init_flag; | |
3188 | |
3189 //----- (00479089) -------------------------------------------------------- | |
323 | 3190 bool __fastcall IsBModelVisible(unsigned int uModelID, int *reachable) |
0 | 3191 { |
3192 BSPModel *v2; // eax@1 | |
3193 int v3; // edi@1 | |
3194 int v4; // ebx@1 | |
3195 int v5; // ST28_4@1 | |
3196 int v6; // ecx@1 | |
3197 int v7; // ebx@3 | |
3198 int v8; // eax@3 | |
3199 int v9; // eax@3 | |
323 | 3200 //int v10; // ebx@3 |
0 | 3201 signed int v11; // esi@6 |
3202 int v12; // esi@8 | |
3203 bool result; // eax@9 | |
323 | 3204 //unsigned int v14; // [sp+Ch] [bp-20h]@1 |
0 | 3205 int v15; // [sp+Ch] [bp-20h]@5 |
323 | 3206 //int *v16; // [sp+10h] [bp-1Ch]@1 |
0 | 3207 int v17; // [sp+1Ch] [bp-10h]@1 |
3208 int v18; // [sp+20h] [bp-Ch]@1 | |
3209 int v19; // [sp+20h] [bp-Ch]@3 | |
3210 int angle; // [sp+24h] [bp-8h]@1 | |
3211 int v21; // [sp+28h] [bp-4h]@1 | |
323 | 3212 //int v22; // [sp+28h] [bp-4h]@3 |
3213 | |
3214 //v16 = unused; | |
1637 | 3215 angle = (signed int)(pODMRenderParams->uCameraFovInDegrees << 11) / 360 >> 1; |
323 | 3216 //v14 = uModelID; |
0 | 3217 v2 = &pOutdoor->pBModels[uModelID]; |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
3218 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
|
3219 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
|
3220 v5 = stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationY); |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
3221 v21 = stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationY); |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
3222 v18 = stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX); |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
3223 stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX); |
0 | 3224 v6 = v5; |
3225 v17 = v3 * v5 + v4 * v21; | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
3226 if (pGame->pIndoorCameraD3D->sRotationX) |
0 | 3227 v17 = (unsigned __int64)(v17 * (signed __int64)v18) >> 16; |
3228 v19 = v4 * v6 - v3 * v21; | |
3229 v7 = abs(v4); | |
3230 v8 = abs(v3); | |
322 | 3231 v9 = int_get_vector_length(v8, v7, 0); |
323 | 3232 //v10 = v14 * 188; |
3233 //v22 = v9; | |
3234 *reachable = false; | |
3235 if ( v9 < pOutdoor->pBModels[uModelID].sBoundingRadius + 256 ) | |
3236 *reachable = true; | |
3237 v15 = stru_5C6E00->Sin(angle); | |
0 | 3238 if ( v19 >= 0 ) |
323 | 3239 v11 = ((unsigned __int64)(v15 * (signed __int64)v17) >> 16) - ((unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)v19) >> 16); |
3240 else | |
3241 v11 = ((unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)v19) >> 16) + ((unsigned __int64)(v15 * (signed __int64)v17) >> 16); | |
0 | 3242 v12 = v11 >> 16; |
1637 | 3243 if ( v9 <= pODMRenderParams->shading_dist_mist + 2048 ) |
0 | 3244 { |
79 | 3245 //if ( abs(v12) > *(int *)((char *)&pOutdoor->pBModels->sBoundingRadius + v10) + 512 ) |
323 | 3246 if ( abs(v12) > pOutdoor->pBModels[uModelID].sBoundingRadius + 512 ) |
0 | 3247 { |
3248 result = v12 < 0; | |
3249 LOBYTE(result) = v12 >= 0; | |
323 | 3250 return result; |
3251 } | |
3252 else | |
3253 return true; | |
3254 } | |
3255 return false; | |
0 | 3256 } |
3257 | |
3258 //----- (00479295) -------------------------------------------------------- | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
3259 int Polygon::_479295() |
0 | 3260 { |
3261 ODMFace *v2; // esi@1 | |
3262 int v3; // ecx@4 | |
3263 int v4; // eax@4 | |
3264 int v5; // edx@4 | |
3265 int v6; // ST14_4@5 | |
3266 int v7; // ST04_4@5 | |
3267 stru149 *v8; // ecx@5 | |
3268 Vec3_int_ thisa; // [sp+Ch] [bp-10h]@8 | |
3269 int v11; // [sp+18h] [bp-4h]@4 | |
3270 | |
3271 v2 = this->pODMFace; | |
3272 if ( !v2->pFacePlane.vNormal.z ) | |
3273 { | |
3274 v3 = v2->pFacePlane.vNormal.x; | |
3275 v4 = -v2->pFacePlane.vNormal.y; | |
3276 v5 = 0; | |
3277 v11 = 65536; | |
1418 | 3278 } |
3279 else if ( (v2->pFacePlane.vNormal.x || v2->pFacePlane.vNormal.y) && abs(v2->pFacePlane.vNormal.z) < 59082 ) | |
0 | 3280 { |
3281 thisa.x = -v2->pFacePlane.vNormal.y; | |
3282 thisa.y = v2->pFacePlane.vNormal.x; | |
3283 thisa.z = 0; | |
3284 thisa.Normalize_float(); | |
3285 v4 = thisa.x; | |
3286 v3 = thisa.y; | |
1418 | 3287 v5 = 0; |
3288 v11 = 65536; | |
3289 } | |
3290 else | |
3291 { | |
3292 v3 = 0; | |
3293 v4 = 65536; | |
3294 v11 = 0; | |
3295 v5 = -65536; | |
3296 } | |
0 | 3297 v6 = v11; |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
3298 sTextureDeltaU = v2->sTextureDeltaU; |
0 | 3299 v7 = v3; |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
3300 v8 = ptr_38; |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
3301 sTextureDeltaV = v2->sTextureDeltaV; |
1544 | 3302 v8->_48616B_frustum_odm(v4, v7, 0, 0, v5, v6); |
0 | 3303 return 1; |
3304 } | |
3305 | |
3306 | |
168 | 3307 unsigned short *LoadTgaTexture(const wchar_t *filename, int *out_width = nullptr, int *out_height = nullptr) |
3308 { | |
3309 #pragma pack(push, 1) | |
3310 struct TGAHeader | |
3311 { | |
3312 unsigned char tgaSkip; | |
3313 unsigned char colourmaptype; // type of colour map 0=none, 1=has palette | |
3314 unsigned char tgaType; // type of image 0=none,1=indexed,2=rgb,3=grey,+8=rle packed | |
3315 | |
3316 short colourmapstart; // first colour map entry in palette | |
3317 short colourmaplength; // number of colours in palette | |
3318 char colourmapbits; // number of bits per palette entry 15,16,24,32 | |
3319 | |
3320 //unsigned char tgaDontCare2[9]; | |
3321 short xstart; // image x origin | |
3322 short ystart; // image y origin | |
3323 | |
3324 unsigned short tgaWidth; | |
3325 unsigned short tgaHeight; | |
3326 unsigned char tgaBPP; | |
3327 | |
3328 char descriptor; // image descriptor bits: 00vhaaaa | |
3329 // h horizontal flip | |
3330 // v vertical flip | |
3331 // a alpha bits | |
3332 }; | |
3333 #pragma pack(pop) | |
3334 | |
3335 if (out_width) | |
3336 *out_width = 0; | |
3337 if (out_height) | |
3338 *out_height = 0; | |
3339 | |
3340 DWORD w; | |
1980 | 3341 void* file = CreateFileW(filename, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr); |
168 | 3342 if (file == INVALID_HANDLE_VALUE) |
3343 return nullptr; | |
3344 | |
3345 TGAHeader header; | |
3346 ReadFile(file, &header, sizeof(header), &w, nullptr); | |
3347 SetFilePointer(file, header.tgaSkip, nullptr, FILE_CURRENT); | |
3348 | |
3349 if (header.tgaBPP != 24 || header.tgaType != 2) | |
3350 { | |
3351 CloseHandle(file); | |
3352 return nullptr; | |
3353 } | |
3354 | |
3355 int imgSize = header.tgaWidth * header.tgaHeight * 3; | |
1980 | 3356 unsigned char* pixels = new unsigned char[imgSize]; |
168 | 3357 ReadFile(file, pixels, imgSize, &w, nullptr); |
3358 CloseHandle(file); | |
3359 | |
3360 if (w != imgSize) | |
3361 { | |
3362 delete [] pixels; | |
3363 return nullptr; | |
3364 } | |
3365 | |
3366 if (out_width) | |
3367 *out_width = header.tgaWidth; | |
3368 if (out_height) | |
3369 *out_height = header.tgaHeight; | |
3370 | |
1980 | 3371 unsigned short* pixels_16bit = new unsigned short[imgSize / 3]; |
168 | 3372 for (int i = 0; i < imgSize / 3; ++i) |
3373 { | |
3374 pixels_16bit[i] = (pixels[i * 3] / 8 & 0x1F) | | |
3375 ((pixels[i * 3 + 1] / 4 & 0x3F) << 5) | | |
3376 ((pixels[i * 3 + 2] / 8 & 0x1F) << 11); | |
3377 } | |
3378 delete [] pixels; | |
3379 return pixels_16bit; | |
3380 } | |
3381 | |
3382 unsigned short *skybox_xn, *skybox_xp, | |
3383 *skybox_yn, *skybox_yp, | |
3384 *skybox_zn, *skybox_zp; | |
3385 int skybox_width, skybox_height; | |
781 | 3386 |
168 | 3387 IDirect3DTexture2 *skybox_texture; |
3388 IDirectDrawSurface4 *skybox_surface; | |
781 | 3389 |
168 | 3390 bool Skybox_Initialize(const wchar_t *skybox_name) |
3391 { | |
3392 wchar_t xn_filename[1024], xp_filename[1024], | |
3393 yn_filename[1024], yp_filename[1024], | |
3394 zn_filename[1024], zp_filename[1024]; | |
1165
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1160
diff
changeset
|
3395 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
|
3396 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
|
3397 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 | 3398 |
3399 int xn_width, xn_height; | |
3400 skybox_xn = LoadTgaTexture(xn_filename, &xn_width, &xn_height); | |
3401 if (!skybox_xn) | |
3402 return false; | |
3403 | |
3404 int xp_width, xp_height; | |
3405 skybox_xp = LoadTgaTexture(xp_filename, &xp_width, &xp_height); | |
3406 if (!skybox_xp || xp_width != xn_width || xp_height != xn_height) | |
3407 { | |
3408 delete [] skybox_xn; | |
3409 if (skybox_xp) delete [] skybox_xp; | |
3410 return false; | |
3411 } | |
3412 | |
3413 int yn_width, yn_height; | |
3414 skybox_yn = LoadTgaTexture(yn_filename, &yn_width, &yn_height); | |
3415 if (!skybox_yn || yn_width != xn_width || yn_height != xn_height) | |
3416 { | |
3417 delete [] skybox_xn; | |
3418 if (skybox_xp) delete [] skybox_xp; | |
3419 if (skybox_yn) delete [] skybox_yn; | |
3420 return false; | |
3421 } | |
3422 | |
3423 int yp_width, yp_height; | |
3424 skybox_yp = LoadTgaTexture(yp_filename, &yp_width, &yp_height); | |
3425 if (!skybox_yp || yp_width != xn_width || yp_height != xn_height) | |
3426 { | |
3427 delete [] skybox_xn; | |
3428 if (skybox_xp) delete [] skybox_xp; | |
3429 if (skybox_yn) delete [] skybox_yn; | |
3430 if (skybox_yp) delete [] skybox_yp; | |
3431 return false; | |
3432 } | |
3433 | |
3434 int zn_width, zn_height; | |
3435 skybox_zn = LoadTgaTexture(zn_filename, &zn_width, &zn_height); | |
3436 if (!skybox_zn || zn_width != xn_width || zn_height != xn_height) | |
3437 { | |
3438 delete [] skybox_xn; | |
3439 if (skybox_xp) delete [] skybox_xp; | |
3440 if (skybox_yn) delete [] skybox_yn; | |
3441 if (skybox_yp) delete [] skybox_yp; | |
3442 if (skybox_zn) delete [] skybox_zn; | |
3443 return false; | |
3444 } | |
3445 | |
3446 int zp_width, zp_height; | |
3447 skybox_zp = LoadTgaTexture(zp_filename, &zp_width, &zp_height); | |
3448 if (!skybox_zp || zp_width != xn_width || zp_height != xn_height) | |
3449 { | |
3450 delete [] skybox_xn; | |
3451 if (skybox_xp) delete [] skybox_xp; | |
3452 if (skybox_yn) delete [] skybox_yn; | |
3453 if (skybox_yp) delete [] skybox_yp; | |
3454 if (skybox_zn) delete [] skybox_zn; | |
3455 if (skybox_zp) delete [] skybox_zp; | |
3456 return false; | |
3457 } | |
3458 | |
3459 skybox_width = xn_width; | |
3460 skybox_height = xn_height; | |
3461 | |
3462 | |
3463 if (!pRenderer->pRenderD3D->CreateTexture(skybox_width, skybox_height, &skybox_surface, &skybox_texture, | |
3464 false, false, pRenderer->uMinDeviceTextureDim)) | |
3465 return false; | |
3466 | |
3467 return true; | |
3468 } | |
3469 | |
3470 struct vector | |
3471 { | |
3472 float x, y, z; | |
3473 }; | |
781 | 3474 |
168 | 3475 struct matrix |
3476 { | |
3477 float m[4][4]; | |
3478 }; | |
781 | 3479 |
168 | 3480 void VectorNormalize(vector *v) |
3481 { | |
3482 float invmag = 1.0f / sqrtf(v->x * v->x + v->y * v->y + v->z * v->z); | |
3483 v->x *= invmag; | |
3484 v->y *= invmag; | |
3485 v->z *= invmag; | |
3486 } | |
781 | 3487 |
168 | 3488 void MatrixRotationAxis(matrix *pout, CONST vector *pv, float angle) |
3489 { | |
3490 memset(pout, 0, sizeof(matrix)); | |
3491 pout->m[3][0] = 0; | |
3492 pout->m[3][1] = 0; | |
3493 pout->m[3][2] = 0; | |
3494 pout->m[3][3] = 1; | |
3495 | |
3496 vector v; | |
3497 v.x = pv->x; v.y = pv->y; v.z = pv->z; | |
3498 VectorNormalize(&v); | |
3499 | |
3500 pout->m[0][0] = (1.0f - cos(angle)) * v.x * v.x + cos(angle); | |
3501 pout->m[1][0] = (1.0f - cos(angle)) * v.x * v.y - sin(angle) * v.z; | |
3502 pout->m[2][0] = (1.0f - cos(angle)) * v.x * v.z + sin(angle) * v.y; | |
3503 pout->m[0][1] = (1.0f - cos(angle)) * v.y * v.x + sin(angle) * v.z; | |
3504 pout->m[1][1] = (1.0f - cos(angle)) * v.y * v.y + cos(angle); | |
3505 pout->m[2][1] = (1.0f - cos(angle)) * v.y * v.z - sin(angle) * v.x; | |
3506 pout->m[0][2] = (1.0f - cos(angle)) * v.z * v.x - sin(angle) * v.y; | |
3507 pout->m[1][2] = (1.0f - cos(angle)) * v.z * v.y + sin(angle) * v.x; | |
3508 pout->m[2][2] = (1.0f - cos(angle)) * v.z * v.z + cos(angle); | |
3509 } | |
781 | 3510 |
168 | 3511 void VectorTransform(const matrix *m, const vector *v, vector *out) |
3512 { | |
3513 out->x = m->m[0][0] * v->x + m->m[1][0] * v->y + m->m[2][0] * v->z + m->m[3][0]; | |
3514 out->y = m->m[0][1] * v->x + m->m[1][1] * v->y + m->m[2][1] * v->z + m->m[3][1]; | |
3515 out->z = m->m[0][2] * v->x + m->m[1][2] * v->y + m->m[2][2] * v->z + m->m[3][2]; | |
3516 } | |
3517 | |
3518 bool DrawSkyD3D_Skybox() | |
3519 { | |
3520 static bool initialized = false, | |
3521 initialization_failed = false; | |
3522 if (initialization_failed) | |
3523 return false; | |
3524 | |
3525 static int last_camera_rot_y, | |
3526 last_camera_rot_x; | |
3527 if (!initialized) | |
3528 { | |
3529 if (!Skybox_Initialize(L"data/skybox/stars")) | |
3530 { | |
3531 initialization_failed = true; | |
3532 return false; | |
3533 } | |
3534 initialized = true; | |
3535 | |
3536 last_camera_rot_y = pParty->sRotationY + 1; // force update for the first run | |
3537 last_camera_rot_x = pParty->sRotationX + 1; | |
3538 } | |
3539 | |
3540 /* | |
3541 r(y) = | |
3542 cos y 0 sin y 0 | |
3543 0 1 0 0 | |
3544 -sin y 0 cos y 0 | |
3545 0 0 0 1 | |
3546 | |
3547 x cos y - z sin y | |
3548 y | |
3549 x sin y + z cos y | |
3550 1 | |
3551 | |
3552 | |
3553 | |
3554 r(x) = // should be r(right) actually | |
3555 1 0 0 0 | |
3556 0 cos x -sin x 0 | |
3557 0 sin x cos x 0 | |
3558 0 0 0 1 | |
3559 | |
3560 | |
3561 x | |
3562 y cos x + z sin x | |
3563 -y sin x + z cos x | |
3564 1 | |
3565 | |
3566 */ | |
3567 | |
3568 if (last_camera_rot_y == pParty->sRotationY && | |
3569 last_camera_rot_x == pParty->sRotationX) | |
3570 { | |
3571 draw: | |
3572 struct RenderVertexD3D3 v[6]; | |
3573 | |
692 | 3574 v[0].pos.x = pViewport->uScreen_TL_X; |
3575 v[0].pos.y = pViewport->uScreen_TL_Y; | |
168 | 3576 v[0].pos.z = 0.99989998; |
3577 v[0].rhw = 1; | |
2006 | 3578 v[0].diffuse = -1; |
168 | 3579 v[0].specular = 0; |
3580 v[0].texcoord.x = 0; | |
3581 v[0].texcoord.y = 0; | |
3582 | |
692 | 3583 v[1].pos.x = pViewport->uScreen_TL_X + pViewport->uScreenWidth; |
3584 v[1].pos.y = pViewport->uScreen_TL_Y + pViewport->uScreenHeight; | |
168 | 3585 v[1].pos.z = 0.99989998; |
3586 v[1].rhw = 1; | |
2006 | 3587 v[1].diffuse = -1; |
168 | 3588 v[1].specular = 0; |
3589 v[1].texcoord.x = (float)pViewport->uScreenWidth / skybox_width; | |
3590 v[1].texcoord.y = (float)pViewport->uScreenHeight / skybox_height; | |
3591 | |
692 | 3592 v[2].pos.x = pViewport->uScreen_TL_X + pViewport->uScreenWidth; |
3593 v[2].pos.y = pViewport->uScreen_TL_Y; | |
168 | 3594 v[2].pos.z = 0.99989998; |
3595 v[2].rhw = 1; | |
2006 | 3596 v[2].diffuse = -1; |
168 | 3597 v[2].specular = 0; |
3598 v[2].texcoord.x = (float)pViewport->uScreenWidth / skybox_width; | |
3599 v[2].texcoord.y = 0; | |
3600 | |
3601 memcpy(&v[3], &v[0], sizeof(*v)); | |
3602 | |
692 | 3603 v[4].pos.x = pViewport->uScreen_TL_X; |
3604 v[4].pos.y = pViewport->uScreen_TL_Y + pViewport->uScreenHeight; | |
168 | 3605 v[4].pos.z = 0.99989998; |
3606 v[4].rhw = 1; | |
2006 | 3607 v[4].diffuse = -1; |
168 | 3608 v[4].specular = 0; |
3609 v[4].texcoord.x = 0; | |
3610 v[4].texcoord.y = (float)pViewport->uScreenHeight / skybox_height; | |
3611 | |
3612 memcpy(&v[5], &v[1], sizeof(*v)); | |
3613 | |
3614 pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE); | |
3615 pRenderer->pRenderD3D->pDevice->SetTexture(0, skybox_texture); | |
3616 pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLELIST, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, v, 6, D3DDP_DONOTUPDATEEXTENTS | D3DDP_DONOTLIGHT); | |
3617 //pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLELIST, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, v + 1, 3, D3DDP_DONOTUPDATEEXTENTS | D3DDP_DONOTLIGHT); | |
3618 | |
3619 return true; | |
3620 } | |
3621 | |
3622 | |
3623 DDSURFACEDESC2 desc; | |
3624 desc.dwSize = sizeof(desc); | |
3625 if (!pRenderer->LockSurface_DDraw4(skybox_surface, &desc, DDLOCK_WAIT | DDLOCK_WRITEONLY)) | |
3626 return false; | |
3627 | |
3628 last_camera_rot_y = pParty->sRotationY; | |
3629 last_camera_rot_x = pParty->sRotationX; | |
3630 | |
3631 float aspect = (float)pViewport->uScreenWidth / (float)pViewport->uScreenHeight; | |
1637 | 3632 float fov_x = 3.141592f * (pODMRenderParams->uCameraFovInDegrees + 0) / 360.0f; |
168 | 3633 float fov_y = fov_x / aspect; |
3634 | |
3635 float ray_dx = fov_x / (float)pViewport->uScreenWidth, | |
3636 ray_dy = fov_y / (float)pViewport->uScreenHeight; | |
3637 float party_angle_x = 2 * 3.141592653589 * pParty->sRotationX / 2048.0, | |
3638 party_angle_y = 2 * 3.141592653589 * pParty->sRotationY / 2048.0; | |
3639 for (int y = 0; y < pViewport->uScreenHeight; ++y) | |
3640 for (int x = 0; x < pViewport->uScreenWidth; ++x) | |
3641 { | |
3642 float angle_x = party_angle_x - (y - pViewport->uScreenHeight / 2) * ray_dy; | |
3643 float angle_y = party_angle_y - (x - pViewport->uScreenWidth / 2) * ray_dx; | |
3644 | |
3645 float _dir_x_ = 1, | |
3646 _dir_y_ = 0, | |
3647 _dir_z_ = 0; | |
3648 | |
3649 float dir_x_ = _dir_x_ * cosf(angle_y);// - _dir_z_ * sinf(angle_y); // rotation around y | |
3650 //float dir_y_ = _dir_y_; | |
3651 float dir_z_ = _dir_x_ * sinf(angle_y);// + _dir_z_ * cosf(angle_y); | |
3652 | |
3653 //float dir_x = dir_x_; // rotation around x | |
3654 //float dir_y = /*dir_y_ * cosf(angle_x)*/ + dir_z_ * sinf(angle_x); | |
3655 //float dir_z = /*-dir_y_ * sinf(angle_x)*/ + dir_z_ * cosf(angle_x); | |
3656 | |
3657 vector right; // rotate around right actually to avoid space distortion | |
3658 right.x = /*dir_y * 0*/ - dir_z_ * 1; | |
3659 right.y = /*dir_z_ * 0 - dir_x_ * */0; | |
3660 right.z = dir_x_ * 1/* - dir_y_ * 0*/; | |
3661 //VectorNormalize(&right); | |
3662 | |
3663 matrix rightMatrix; | |
3664 MatrixRotationAxis(&rightMatrix, &right, angle_x); | |
3665 | |
3666 vector v1, v2; | |
3667 v1.x = dir_x_; v1.y = 0; v1.z = dir_z_; | |
3668 VectorTransform(&rightMatrix, &v1, &v2); | |
3669 | |
3670 float dir_x = v2.x, | |
3671 dir_y = v2.y, | |
3672 dir_z = v2.z; | |
3673 | |
3674 float abs_dir_x = fabsf(dir_x), | |
3675 abs_dir_y = fabsf(dir_y), | |
3676 abs_dir_z = fabsf(dir_z); | |
3677 | |
3678 unsigned short color = (0x1F << 11) | (0x1F << 5) | (5); //default to orange | |
3679 if (abs_dir_x >= abs_dir_y) | |
3680 { | |
3681 if (abs_dir_x >= abs_dir_z) | |
3682 { | |
3683 if (dir_x >= 0) | |
3684 { | |
3685 float instersect_y = dir_y / (2.0f * dir_x); // plane equation for this side is x + 0.5 = 0 | |
3686 float instersect_z = dir_z / (2.0f * dir_x); | |
3687 | |
3688 float u = 1.0f - (instersect_z + 0.5f), | |
3689 v = 1.0f - (instersect_y + 0.5f); | |
3690 | |
3691 int tx = u * (skybox_width - 1), | |
3692 ty = v * (skybox_height - 1); | |
3693 | |
3694 color = skybox_xp[ty * skybox_width + tx]; | |
3695 //color = ty * 0x1F / skybox_height; | |
3696 } | |
3697 else | |
3698 { | |
3699 float instersect_y = dir_y / (2.0f * dir_x); | |
3700 float instersect_z = dir_z / (2.0f * dir_x); | |
3701 | |
3702 float u = 1.0f - (instersect_z + 0.5f), | |
3703 v = instersect_y + 0.5f; | |
3704 | |
3705 int tx = u * (skybox_width - 1), | |
3706 ty = v * (skybox_height - 1); | |
3707 | |
3708 color = skybox_xn[ty * skybox_width + tx]; | |
3709 //color = tx * 0x1F / skybox_height; | |
3710 } | |
3711 } | |
3712 else if (dir_z >= 0) | |
3713 goto DIR_ZP; | |
3714 else | |
3715 goto DIR_ZN; | |
3716 } | |
3717 else if (abs_dir_y >= abs_dir_z) | |
3718 { | |
3719 if (dir_y >= 0) | |
3720 { | |
3721 float instersect_x = dir_x / (2.0f * dir_y); | |
3722 float instersect_z = dir_z / (2.0f * dir_y); | |
3723 | |
3724 float u = instersect_x + 0.5f, | |
3725 v = instersect_z + 0.5f; | |
3726 | |
3727 int tx = u * (skybox_width - 1), | |
3728 ty = v * (skybox_height - 1); | |
3729 | |
3730 color = skybox_yp[ty * skybox_width + tx]; | |
3731 //color = tx * 0x1F / skybox_height; | |
3732 } | |
3733 /*else should never be seen i guess | |
3734 { | |
3735 __debugbreak(); | |
3736 // -y | |
3737 //Log::Warning(L"(%03u, %03u): -y", x, y); | |
3738 }*/ | |
3739 } | |
3740 else if (dir_z >= 0) | |
3741 { | |
3742 DIR_ZP: | |
3743 // +z | |
3744 float instersect_x = dir_x / (2.0f * dir_z); | |
3745 float instersect_y = dir_y / (2.0f * dir_z); | |
3746 //float intersect_z = 0.5f; | |
3747 | |
3748 float u = instersect_x + 0.5f, | |
3749 v = -instersect_y + 0.5f; | |
3750 | |
3751 int tx = u * (skybox_width - 1), | |
3752 ty = v * (skybox_height - 1); | |
3753 | |
3754 color = skybox_zp[ty * skybox_width + tx]; | |
3755 } | |
3756 else | |
3757 { | |
3758 DIR_ZN: | |
3759 // -z | |
3760 float instersect_x = -dir_x / (2.0f * dir_z); | |
3761 float instersect_y = -dir_y / (2.0f * dir_z); | |
3762 //float intersect_z = -0.5f; | |
3763 | |
3764 float u = 1.0f - instersect_x - 0.5f, | |
3765 v = -instersect_y + 0.5f; | |
3766 | |
3767 int tx = u * (skybox_width - 1), | |
3768 ty = v * (skybox_height - 1); | |
3769 | |
3770 color = skybox_zn[ty * skybox_width + tx]; | |
3771 } | |
3772 | |
3773 //pRenderer->pTargetSurface[(pViewport->uScreenY + y) * pRenderer->uTargetSurfacePitch + pViewport->uScreenX + x] = color; | |
3774 ((unsigned __int16 *)((char *)desc.lpSurface + y * desc.lPitch))[x] = color; | |
3775 } | |
3776 | |
3777 ErrD3D((skybox_surface)->Unlock(0)); | |
3778 goto draw; | |
3779 } | |
0 | 3780 //----- (0047A384) -------------------------------------------------------- |
1637 | 3781 void ODM_LoadAndInitialize(const char *pLevelFilename, ODMRenderParams *thisa) |
0 | 3782 { |
3783 int v2; // ebx@3 | |
3784 unsigned int v3; // eax@3 | |
3785 MapInfo *v4; // edi@4 | |
3786 //int v5; // eax@8 | |
3787 //SpawnPointMM7 *v6; // edx@14 | |
3788 size_t v7; // eax@19 | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3789 //char *v8; // eax@19 |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3790 //char *v9; // eax@21 |
0 | 3791 char Source[120]; // [sp+Ch] [bp-84h]@19 |
3792 const char *pFilename; // [sp+84h] [bp-Ch]@1 | |
3793 //unsigned int v12; // [sp+88h] [bp-8h]@12 | |
3794 //int v13; // [sp+8Ch] [bp-4h]@11 | |
3795 | |
3796 pFilename = pLevelFilename; | |
1583 | 3797 //thisa->AllocSoftwareDrawBuffers(); |
1637 | 3798 pODMRenderParams->Initialize(); |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3799 pWeather->bRenderSnow = false; |
0 | 3800 pRenderer->ClearZBuffer(0, 479); |
1637 | 3801 thisa = (ODMRenderParams *)1; |
0 | 3802 GetAlertStatus(); |
3803 if ( qword_A750D8 ) | |
1583 | 3804 qword_A750D8 = 0; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1470
diff
changeset
|
3805 v2 = pMapStats->GetMapInfo(pCurrentMapName); |
0 | 3806 v3 = 0; |
3807 if ( v2 ) | |
3808 { | |
3809 v4 = &pMapStats->pInfos[v2]; | |
3810 v3 = v4->uRespawnIntervalDays; | |
3811 } | |
3812 else | |
3813 { | |
3814 v4 = (MapInfo *)thisa; | |
3815 } | |
767 | 3816 day_attrib &= ~DAY_ATTRIB_FOG; |
0 | 3817 dword_6BE13C_uCurrentlyLoadedLocationID = v2; |
3818 pOutdoor->Initialize( | |
3819 pFilename, | |
3820 (unsigned int)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 0x3C / 0x3C / 0x18 + 1, | |
3821 v3, | |
3822 (int)&thisa); | |
2061 | 3823 if ( !(dword_6BE364_game_settings_1 & GAME_SETTINGS_2000) ) |
0 | 3824 { |
3825 InitializeActors(); | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
3826 InitializeSpriteObjects(); |
0 | 3827 } |
2061 | 3828 dword_6BE364_game_settings_1 &= ~GAME_SETTINGS_2000; |
0 | 3829 //v5 = 0; |
3830 if ( !v2 ) | |
3831 thisa = 0; | |
1637 | 3832 if ( thisa == (ODMRenderParams *)1 ) |
0 | 3833 { |
3834 //v13 = 0; | |
3835 for (uint i = 0; i < pOutdoor->uNumSpawnPoints; ++i) | |
3836 { | |
3837 //v12 = 0; | |
3838 //while ( 1 ) | |
3839 //{ | |
1980 | 3840 SpawnPointMM7* spawn = pOutdoor->pSpawnPoints + i; |
0 | 3841 //v6 = &pOutdoor->pSpawnPoints[v12 / 0x18]; |
3842 if (spawn->uKind == 3 ) | |
3843 SpawnEncounter(v4, spawn, 0, 0, 0); | |
3844 else | |
3845 v4->SpawnRandomTreasure(spawn); | |
3846 //++v13; | |
3847 //v12 += 24; | |
3848 //if ( v13 >= (signed int)pOutdoor->uNumSpawnPoints ) | |
3849 // break; | |
3850 //v5 = 0; | |
3851 //} | |
3852 } | |
3853 RespawnGlobalDecorations(); | |
3854 } | |
3855 pOutdoor->PrepareDecorations(); | |
2065
87be06553c76
rename int _47F223_LooksLikeGenerateMonsterLoot() to void ArrangeSpriteObjects()
Ritor1
parents:
2061
diff
changeset
|
3856 pOutdoor->ArrangeSpriteObjects(); |
0 | 3857 pOutdoor->InitalizeActors(v2); |
3858 pOutdoor->MessWithLUN(); | |
3859 v7 = strlen("levels\\"); | |
3860 strcpy(Source, &pFilename[v7]); | |
3861 strcpy(pOutdoor->pLevelFilename, Source); | |
3862 pWeather->Initialize(); | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
3863 pGame->pIndoorCameraD3D->sRotationY = pParty->sRotationY; |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
3864 pGame->pIndoorCameraD3D->sRotationX = pParty->sRotationX; |
1642 | 3865 //pODMRenderParams->RotationToInts(); |
0 | 3866 pOutdoor->UpdateSunlightVectors(); |
1638
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
3867 |
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
3868 float fov_rad; |
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
3869 float fov_rad_inv; |
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
3870 //----- (0042394D) -------------------------------------------------------- |
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
3871 //void IndoorCamera::Initialize(int degFov, unsigned int uViewportWidth, unsigned int uViewportHeight) |
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
3872 { |
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
3873 //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
|
3874 // viewparams->uScreen_BttmR_Y - viewparams->uScreen_topL_Y + 1); |
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
3875 |
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
3876 int uViewportWidth = viewparams->uScreen_BttmR_X - viewparams->uScreen_topL_X + 1; |
1641 | 3877 |
3878 extern float _calc_fov(int viewport_width, int angle_degree); | |
3879 fov_rad = _calc_fov(uViewportWidth, 65); | |
3880 fov_rad_inv = 65536.0 / fov_rad; | |
1638
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
3881 } |
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
3882 pODMRenderParams->int_fov_rad = (signed __int64)fov_rad; |
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
3883 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
|
3884 |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3885 for (int i = 0; i < 20000; ++i) |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3886 { |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3887 array_77EC08[i].ptr_38 = &stru_8019C8; |
1644 | 3888 |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3889 array_77EC08[i].ptr_48 = nullptr; |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3890 } |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3891 |
0 | 3892 MM7Initialization(); |
3893 } | |
3894 | |
3895 //----- (0047C370) -------------------------------------------------------- | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3896 unsigned int GetLevelFogColor() |
0 | 3897 { |
3898 signed __int64 v1; // qax@5 | |
3899 int v2; // eax@6 | |
3900 | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3901 if (bUnderwater) |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3902 return 0xFF258F5C; |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3903 |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3904 if (day_attrib & DAY_ATTRIB_FOG) |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3905 { |
767 | 3906 if ( pWeather->bNight ) // night-time fog |
750 | 3907 { |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3908 __debugbreak(); // decompilation can be inaccurate, please send savegame to Nomad |
750 | 3909 v2 = -(pWeather->bNight != 1); |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3910 return (v2 & 0xE0E0E1) - 0xE0E0E1; |
0 | 3911 } |
3912 else | |
3913 { | |
3914 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
|
3915 return v1 | (((unsigned int)v1 | (((unsigned int)v1 | 0xFFFFFF00) << 8)) << 8); |
0 | 3916 } |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3917 } |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3918 |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3919 return 0; |
0 | 3920 } |
3921 | |
3922 //----- (0047C3D7) -------------------------------------------------------- | |
3923 int __fastcall sub_47C3D7_get_fog_related_stuff(int a1, int a2, float a3) | |
3924 { | |
3925 int v3; // ecx@1 | |
3926 double v5; // st7@10 | |
3927 signed int v7; // ecx@11 | |
3928 double v8; // st6@12 | |
3929 double v9; // st7@15 | |
3930 double v10; // st6@16 | |
3931 float v11; // ST14_4@17 | |
3932 double v12; // ST08_8@17 | |
3933 | |
750 | 3934 v3 = pWeather->bNight; |
0 | 3935 if ( bUnderwater == 1 ) |
3936 v3 = 0; | |
767 | 3937 if ( pParty->armageddon_timer || !(day_attrib & DAY_ATTRIB_FOG) && !bUnderwater ) |
349 | 3938 return 0xFF000000; |
0 | 3939 if ( v3 ) |
3940 { | |
3941 v5 = (double)day_fogrange_1; | |
3942 if ( a3 < v5 ) | |
1418 | 3943 { |
3944 v7 = 0; | |
3945 if ( a3 == 0.0 ) | |
3946 { | |
3947 v7 = 216; | |
3948 } | |
3949 goto LABEL_21; | |
3950 } | |
3951 else | |
3952 { | |
3953 v8 = (double)day_fogrange_2; | |
3954 if ( a3 > v8 ) | |
3955 { | |
3956 v7 = 216; | |
3957 if ( a3 == 0.0 ) | |
3958 { | |
3959 v7 = 216; | |
3960 } | |
3961 goto LABEL_21; | |
3962 } | |
3963 v7 = (signed __int64)((a3 - v5) / (v8 - v5) * 216.0); | |
3964 } | |
0 | 3965 } |
3966 else | |
3967 { | |
3968 v9 = (double)day_fogrange_1; | |
3969 if ( a3 < v9 ) | |
3970 { | |
3971 v7 = 0; | |
1418 | 3972 if ( a3 == 0.0 ) |
3973 { | |
3974 v7 = 216; | |
3975 } | |
3976 goto LABEL_21; | |
0 | 3977 } |
1418 | 3978 else |
3979 { | |
3980 v10 = (double)day_fogrange_2; | |
3981 if ( a3 > v10 ) | |
3982 { | |
3983 v7 = 216; | |
3984 if ( a3 == 0.0 ) | |
3985 { | |
3986 v7 = 216; | |
3987 } | |
3988 goto LABEL_21; | |
3989 } | |
3990 else | |
3991 { | |
3992 v11 = (a3 - v9) * 216.0 / (v10 - v9); | |
3993 v12 = v11 + 6.7553994e15; | |
3994 v7 = LODWORD(v12); | |
3995 } | |
3996 } | |
3997 } | |
3998 if ( v7 > 216 ) | |
3999 { | |
4000 v7 = 216; | |
4001 } | |
4002 else | |
4003 { | |
4004 if ( a3 == 0.0 ) | |
4005 { | |
4006 v7 = 216; | |
4007 } | |
4008 } | |
0 | 4009 LABEL_21: |
4010 if ( a2 ) | |
4011 v7 = 248; | |
4012 return (-1 - v7) << 24; | |
4013 } | |
349 | 4014 |
0 | 4015 //----- (0047C4FC) -------------------------------------------------------- |
1459 | 4016 int __fastcall GetActorTintColor(int max_dimm, int min_dimm, float distance, int a4, RenderBillboard *a5) |
349 | 4017 { |
4018 //int v5; // esi@1 | |
0 | 4019 signed int v6; // edx@1 |
349 | 4020 //signed int result; // eax@2 |
0 | 4021 int v8; // eax@3 |
4022 double v9; // st7@12 | |
750 | 4023 //double v10; // ST0C_8@18 |
0 | 4024 int v11; // ecx@28 |
349 | 4025 //signed int v12; // edi@28 |
4026 //double v13; // ST0C_8@33 | |
4027 //double v14; // ST0C_8@34 | |
0 | 4028 double v15; // st7@44 |
349 | 4029 //double v16; // ST0C_8@44 |
4030 //double v17; // ST0C_8@44 | |
0 | 4031 int v18; // ST14_4@44 |
349 | 4032 //double v19; // ST0C_8@44 |
0 | 4033 signed int v20; // [sp+10h] [bp-4h]@10 |
4034 float a3a; // [sp+1Ch] [bp+8h]@33 | |
638 | 4035 //float a3b; // [sp+1Ch] [bp+8h]@34 |
0 | 4036 float a3c; // [sp+1Ch] [bp+8h]@44 |
349 | 4037 //float a3d; // [sp+1Ch] [bp+8h]@44 |
750 | 4038 //float a4b; // [sp+20h] [bp+Ch]@18 |
638 | 4039 //int a4a; // [sp+20h] [bp+Ch]@33 |
349 | 4040 //float a4c; // [sp+20h] [bp+Ch]@44 |
4041 //float a4d; // [sp+20h] [bp+Ch]@44 | |
0 | 4042 int a5a; // [sp+24h] [bp+10h]@44 |
4043 | |
349 | 4044 //v5 = a2; |
0 | 4045 v6 = 0; |
349 | 4046 |
4047 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
638 | 4048 return 8 * (31 - max_dimm) | ((8 * (31 - max_dimm) | ((31 - max_dimm) << 11)) << 8); |
4049 | |
349 | 4050 if (pParty->armageddon_timer) |
4051 return 0xFFFF0000; | |
4052 | |
750 | 4053 v8 = pWeather->bNight; |
638 | 4054 if (bUnderwater) |
0 | 4055 v8 = 0; |
4056 if ( v8 ) | |
4057 { | |
4058 v20 = 1; | |
349 | 4059 if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uExpireTime > 0 ) |
4060 v20 = pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uPower; | |
0 | 4061 v9 = (double)v20 * 1024.0; |
4062 if ( a4 ) | |
1901 | 4063 { |
4064 v6 = 216; | |
4065 goto LABEL_20; | |
4066 } | |
638 | 4067 if ( distance <= v9 ) |
4068 { | |
4069 if ( distance > 0.0 ) | |
4070 { | |
750 | 4071 //a4b = distance * 216.0 / v9; |
4072 //v10 = a4b + 6.7553994e15; | |
4073 //v6 = LODWORD(v10); | |
4074 v6 = floorf(0.5f + distance * 216.0 / v9); | |
4075 if (v6 > 216 ) | |
1901 | 4076 { |
4077 v6 = 216; | |
4078 goto LABEL_20; | |
4079 } | |
0 | 4080 } |
4081 } | |
4082 else | |
4083 { | |
4084 v6 = 216; | |
4085 } | |
638 | 4086 if ( distance != 0.0 ) |
0 | 4087 { |
4088 LABEL_20: | |
4089 if ( a5 ) | |
4090 v6 = 8 * _43F55F_get_billboard_light_level(a5, v6 >> 3); | |
4091 if ( v6 > 216 ) | |
4092 v6 = 216; | |
4093 return (255 - v6) | ((255 - v6) << 16) | ((255 - v6) << 8); | |
4094 } | |
1901 | 4095 //LABEL_19: |
0 | 4096 v6 = 216; |
4097 goto LABEL_20; | |
4098 } | |
349 | 4099 |
4100 | |
4101 | |
638 | 4102 if (fabsf(distance) < 1.0e-6f) |
349 | 4103 return 0xFFF8F8F8; |
4104 | |
638 | 4105 // dim in measured in 8-steps |
4106 v11 = 8 * (max_dimm - min_dimm); | |
349 | 4107 //v12 = v11; |
0 | 4108 if ( v11 >= 0 ) |
4109 { | |
4110 if ( v11 > 216 ) | |
349 | 4111 v11 = 216; |
4112 } | |
4113 else | |
4114 v11 = 0; | |
4115 | |
638 | 4116 float fog_density_mult = 216.0f; |
4117 if (a4) | |
1637 | 4118 fog_density_mult += distance / (double)pODMRenderParams->shading_dist_shade * 32.0; |
638 | 4119 |
4120 v6 = v11 + floorf(pOutdoor->fFogDensity * fog_density_mult + 0.5f); | |
4121 /*if ( a4 ) | |
4122 { | |
4123 //a3b = pOutdoor->fFogDensity * 216.0; | |
349 | 4124 //v14 = a3b + 6.7553994e15; |
638 | 4125 //a4a = floorf(a3b + 0.5f);//LODWORD(v14); |
4126 } | |
4127 else | |
4128 { | |
1637 | 4129 //a3a = (distance / (double)pODMRenderParams->shading_dist_shade * 32.0 + 216.0) * pOutdoor->fFogDensity; |
349 | 4130 //v13 = a3a + 6.7553994e15; |
638 | 4131 //a4a = floorf(a3a + 0.5f);//LODWORD(v13); |
4132 } | |
4133 v6 = a4a + v11;*/ | |
0 | 4134 if ( a5 ) |
4135 v6 = 8 * _43F55F_get_billboard_light_level(a5, v6 >> 3); | |
4136 if ( v6 > 216 ) | |
4137 v6 = 216; | |
349 | 4138 if ( v6 < v11 ) |
4139 v6 = v11; | |
638 | 4140 if ( v6 > 8 * pOutdoor->max_terrain_dimming_level ) |
4141 v6 = 8 * pOutdoor->max_terrain_dimming_level; | |
0 | 4142 if ( !bUnderwater ) |
4143 return (255 - v6) | ((255 - v6) << 16) | ((255 - v6) << 8); | |
349 | 4144 else |
4145 { | |
0 | 4146 v15 = (double)(255 - v6) * 0.0039215689; |
4147 a3c = v15; | |
349 | 4148 //a4c = v15 * 16.0; |
4149 //v16 = a4c + 6.7553994e15; | |
4150 a5a = floorf(v15 * 16.0 + 0.5f);//LODWORD(v16); | |
4151 //a4d = a3c * 194.0; | |
4152 //v17 = a4d + 6.7553994e15; | |
4153 v18 = floorf(a3c * 194.0 + 0.5f);//LODWORD(v17); | |
4154 //a3d = a3c * 153.0; | |
4155 //v19 = a3d + 6.7553994e15; | |
4156 return (int)floorf(a3c * 153.0 + 0.5f)/*LODWORD(v19)*/ | ((v18 | (a5a << 8)) << 8); | |
4157 } | |
0 | 4158 } |
4159 // 6BE3C4: using guessed type char bUnderwater; | |
4160 | |
4161 //----- (0047F44B) -------------------------------------------------------- | |
1412 | 4162 unsigned int WorldPosToGridCellX(int sWorldPosX) |
67 | 4163 { |
1412 | 4164 return (sWorldPosX >> 9) + 64; // sar is in original exe, resulting -880 / 512 = -1 |
4165 // and -880 sar 9 = -2 | |
0 | 4166 } |
4167 | |
4168 //----- (0047F458) -------------------------------------------------------- | |
1412 | 4169 unsigned int WorldPosToGridCellZ(int sWorldPosZ) |
67 | 4170 { |
1412 | 4171 return 64 - (sWorldPosZ >> 9); // sar is in original exe, resulting -880 / 512 = -1 |
4172 // and -880 sar 9 = -2 | |
0 | 4173 } |
4174 | |
4175 //----- (0047F469) -------------------------------------------------------- | |
1459 | 4176 int GridCellToWorldPosX(int a1) |
0 | 4177 { |
4178 return (a1 - 64) << 9; | |
4179 } | |
4180 | |
4181 //----- (0047F476) -------------------------------------------------------- | |
1459 | 4182 int GridCellToWorldPosZ(int a1) |
0 | 4183 { |
4184 return (64 - a1) << 9; | |
4185 } | |
4186 | |
4187 | |
4188 //----- (004811A3) -------------------------------------------------------- | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
4189 void Polygon::DrawBorderTiles() |
1338 | 4190 { |
4191 //__debugbreak(); | |
4192 | |
4193 pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, false); | |
0 | 4194 pRenderer->DrawTerrainPolygon(uNumVertices, this, |
1338 | 4195 pBitmaps_LOD->pHardwareTextures[pRenderer->pHDWaterBitmapIDs[pRenderer->hd_water_current_frame]], false, true); |
4196 | |
4197 pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, true); | |
4198 //pRenderer->DrawTerrainPolygon(uNumVertices, this, pBitmaps_LOD->pHardwareTextures[uTileBitmapID], true, true); | |
0 | 4199 } |
4200 | |
4201 | |
4202 //----- (00481ED9) -------------------------------------------------------- | |
1637 | 4203 void sub_481ED9_MessWithODMRenderParams() |
0 | 4204 { |
1544 | 4205 stru_8019C8._48616B_frustum_odm(65536, 0, 0, 0, 65536, 0); |
1637 | 4206 pODMRenderParams->uNumPolygons = 0; |
1642 | 4207 //pODMRenderParams->uNumEdges = 0; |
4208 //pODMRenderParams->uNumSpans = 0; | |
4209 //pODMRenderParams->uNumSurfs = 0; | |
1637 | 4210 pODMRenderParams->uNumBillboards = 0; |
4211 pODMRenderParams->field_44 = 0; | |
0 | 4212 } |
4213 | |
4214 //----- (004823F4) -------------------------------------------------------- | |
138 | 4215 bool IsTerrainSlopeTooHigh(int pos_x, int pos_z) |
4216 { | |
4217 //unsigned int v2; // ebx@1 | |
4218 //unsigned int v3; // edi@1 | |
4219 //int v4; // eax@1 | |
4220 //int v6; // esi@5 | |
4221 //int v7; // ecx@6 | |
4222 //int v8; // edx@6 | |
4223 //int v9; // eax@6 | |
4224 //int v10; // esi@10 | |
4225 //int v11; // [sp+14h] [bp-8h]@1 | |
4226 //int v12; // [sp+18h] [bp-4h]@1 | |
4227 | |
4228 //v12 = a1; | |
4229 //v11 = a2; | |
1980 | 4230 unsigned int grid_x = WorldPosToGridCellX(pos_x); |
4231 unsigned int grid_z = WorldPosToGridCellZ(pos_z) - 1; | |
4232 | |
4233 int party_grid_x1 = GridCellToWorldPosX(grid_x); | |
138 | 4234 //dword_76D56C_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(grid_x + 1); |
4235 //dword_76D570_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(grid_x + 1); | |
4236 //dword_76D574_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(grid_x); | |
1980 | 4237 int party_grid_z1 = GridCellToWorldPosZ(grid_z); |
138 | 4238 //dword_76D55C_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(grid_z); |
4239 //dword_76D560_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(grid_z + 1); | |
4240 //dword_76D564_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(grid_z + 1); | |
1980 | 4241 int party_x1z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z); |
4242 int party_x2z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z); | |
4243 int party_x2z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z + 1); | |
4244 int party_x1z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z + 1); | |
138 | 4245 //dword_76D554_terrain_cell_world_pos_around_party_y = v4; |
4246 if (party_x1z1_y == party_x2z1_y && | |
4247 party_x2z1_y == party_x2z2_y && | |
4248 party_x2z2_y == party_x1z2_y ) | |
4249 return false; | |
4250 | |
1980 | 4251 int dx = abs(pos_x - party_grid_x1), |
138 | 4252 dz = abs(party_grid_z1 - pos_z); |
4253 | |
4254 int y1, y2, y3; | |
4255 if (dz >= dx) | |
4256 { | |
4257 y1 = party_x1z2_y; // lower-left triangle | |
4258 y2 = party_x2z2_y; // y3 | \ | |
4259 y3 = party_x1z1_y; // | \ | |
4260 /* | \ | |
4261 |______ \ | |
4262 y1 y2 */ | |
4263 } | |
4264 else | |
4265 { | |
4266 y1 = party_x2z1_y; // upper-right | |
4267 y2 = party_x1z1_y; // y2_______ y1 | |
4268 y3 = party_x2z2_y; // \ | | |
4269 /* \ | | |
4270 \ | | |
4271 y3 */ | |
4272 } | |
4273 | |
4274 int y_min = min(y1, min(y2, y3)), | |
4275 y_max = max(y1, max(y2, y3)); | |
1545 | 4276 return (y_max - y_min) > 512; |
138 | 4277 |
4278 /*if ( y1 >= y2 ) | |
4279 { | |
4280 y_min = y2; | |
4281 if ( y2 < y3 ) | |
0 | 4282 goto LABEL_13; |
4283 LABEL_12: | |
138 | 4284 y_min = y3; |
0 | 4285 goto LABEL_13; |
4286 } | |
138 | 4287 else if ( y1 >= y3 ) |
0 | 4288 goto LABEL_12; |
138 | 4289 else |
4290 y_min = y1; | |
4291 | |
0 | 4292 LABEL_13: |
138 | 4293 if ( y1 <= y2 ) |
4294 { | |
4295 if ( y2 > y3 ) | |
4296 y3 = y2; | |
4297 } | |
4298 else | |
4299 { | |
4300 if ( y1 > y3 ) | |
4301 y3 = y1; | |
4302 } | |
4303 return y3 - v10 > 512;*/ | |
0 | 4304 } |
4305 | |
4306 //----- (0048257A) -------------------------------------------------------- | |
812 | 4307 int __fastcall GetTerrainHeightsAroundParty2(int a1, int a2, int *pIsOnWater, int bFloatAboveWater) |
4308 { | |
4309 //unsigned int v4; // ebx@1 | |
4310 //unsigned int v5; // edi@1 | |
0 | 4311 int result; // eax@9 |
812 | 4312 //int v7; // ebx@10 |
0 | 4313 int v8; // ebx@11 |
4314 int v9; // eax@11 | |
4315 int v10; // ecx@11 | |
812 | 4316 //int v11; // [sp+Ch] [bp-Ch]@1 |
4317 //int v12; // [sp+10h] [bp-8h]@1 | |
0 | 4318 int v13; // [sp+10h] [bp-8h]@11 |
4319 signed int v14; // [sp+14h] [bp-4h]@3 | |
4320 int v15; // [sp+24h] [bp+Ch]@11 | |
4321 | |
812 | 4322 //v11 = a1; |
4323 //v12 = a2; | |
1980 | 4324 unsigned int grid_x = WorldPosToGridCellX(a1); |
4325 unsigned int grid_z = WorldPosToGridCellZ(a2) - 1; | |
4326 | |
4327 int grid_x1 = GridCellToWorldPosX(grid_x), | |
812 | 4328 grid_x2 = GridCellToWorldPosX(grid_x + 1); |
1980 | 4329 int grid_z1 = GridCellToWorldPosZ(grid_z), |
812 | 4330 grid_z2 = GridCellToWorldPosZ(grid_z + 1); |
4331 | |
1980 | 4332 int y_x1z1 = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z), |
812 | 4333 y_x2z1 = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z), |
4334 y_x2z2 = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z + 1), | |
4335 y_x1z2 = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z + 1); | |
4336 //v4 = WorldPosToGridCellX(a1); | |
4337 //v5 = WorldPosToGridCellZ(v12) - 1; | |
4338 //dword_76D538_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v4); | |
4339 //dword_76D53C_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v4 + 1); | |
4340 //dword_76D540_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v4 + 1); | |
4341 //dword_76D544_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v4); | |
4342 //dword_76D528_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v5); | |
4343 //dword_76D52C_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v5); | |
4344 //dword_76D530_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v5 + 1); | |
4345 //dword_76D534_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v5 + 1); | |
4346 //dword_76D518_terrain_cell_world_pos_around_party_y = pOutdoor->DoGetHeightOnTerrain(v4, v5); | |
4347 //dword_76D51C_terrain_cell_world_pos_around_party_y = pOutdoor->DoGetHeightOnTerrain(v4 + 1, v5); | |
4348 //dword_76D520_terrain_cell_world_pos_around_party_y = pOutdoor->DoGetHeightOnTerrain(v4 + 1, v5 + 1); | |
4349 //dword_76D524_terrain_cell_world_pos_around_party_y = pOutdoor->DoGetHeightOnTerrain(v4, v5 + 1); | |
791 | 4350 *pIsOnWater = false; |
812 | 4351 if ( pOutdoor->ActuallyGetSomeOtherTileInfo(grid_x, grid_z) & 2 ) |
791 | 4352 *pIsOnWater = true; |
0 | 4353 v14 = 0; |
812 | 4354 if ( !bFloatAboveWater && *pIsOnWater ) |
0 | 4355 v14 = -60; |
812 | 4356 if ( y_x1z1 != y_x2z1 || |
4357 y_x2z1 != y_x2z2 || | |
4358 y_x2z2 != y_x1z2 ) | |
4359 { | |
4360 if ( abs(grid_z1 - a2) >= abs(a1 - grid_x1) ) | |
4361 { | |
4362 v8 = y_x1z2; | |
4363 v9 = y_x2z2; | |
4364 v10 = y_x1z1; | |
4365 v15 = a1 - grid_x1; | |
4366 v13 = a2 - grid_z2; | |
0 | 4367 } |
4368 else | |
4369 { | |
812 | 4370 v8 = y_x2z1; |
4371 v9 = y_x1z1; | |
4372 v10 = y_x2z2; | |
4373 v15 = grid_x2 - a1; | |
4374 v13 = grid_z1 - a2; | |
4375 } | |
1643 | 4376 return v14 + v8 + fixpoint_mul(v13, (v10 - v8) * 128) + fixpoint_mul(v15, (v9 - v8) * 128); |
812 | 4377 } |
4378 else | |
4379 return y_x1z1; | |
0 | 4380 } |
4381 | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
4382 |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
4383 |
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
4384 |
0 | 4385 |
4386 //----- (00485F53) -------------------------------------------------------- | |
1458 | 4387 void sr_485F53(Vec2_int_ *v) |
0 | 4388 { |
4389 ++v->y; | |
4390 if ( v->y > 1000 ) | |
4391 v->y = 0; | |
4392 } | |
4393 | |
4394 //----- (0048607B) -------------------------------------------------------- | |
1427 | 4395 void Polygon::Create_48607B(stru149 *a2) |
0 | 4396 { |
4397 this->pTexture = 0; | |
4398 this->ptr_38 = a2; | |
4399 } | |
4400 | |
4401 //----- (00486089) -------------------------------------------------------- | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
4402 void Polygon::_normalize_v_18() |
0 | 4403 { |
4404 double v2; // st7@1 | |
4405 double v3; // st6@1 | |
4406 double v5; // st5@1 | |
4407 | |
1025 | 4408 //v1 = this; |
0 | 4409 v2 = (double)this->v_18.x; |
4410 v3 = (double)this->v_18.y; | |
4411 v5 = (double)this->v_18.z; | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
4412 float len = sqrt(v5 * v5 + v3 * v3 + v2 * v2); |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
4413 if (fabsf(len) < 1e-6f) |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
4414 { |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
4415 v_18.x = 0; |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
4416 v_18.y = 0; |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
4417 v_18.z = 65536; |
0 | 4418 } |
4419 else | |
4420 { | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
4421 v_18.x = round(v2 / len * 65536.0); |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
4422 v_18.y = round(v3 / len * 65536.0); |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
4423 v_18.y = round(v5 / len * 65536.0); |
0 | 4424 } |
4425 } | |
4426 | |
4427 //----- (0048616B) -------------------------------------------------------- | |
1544 | 4428 void stru149::_48616B_frustum_odm(int a2, int a3, int a4, int a5, int a6, int a7) |
0 | 4429 { |
4430 int v7; // ebx@1 | |
1544 | 4431 //int v8; // esi@1 |
0 | 4432 int v9; // edi@1 |
1544 | 4433 //int v10; // eax@1 |
0 | 4434 int v11; // edx@1 |
1544 | 4435 //int v12; // esi@2 |
4436 //int v13; // eax@2 | |
4437 //int v14; // ST10_4@3 | |
4438 //int v15; // esi@3 | |
4439 //int v16; // eax@5 | |
0 | 4440 int v17; // ST0C_4@6 |
1544 | 4441 //int v18; // eax@8 |
0 | 4442 int v19; // ST0C_4@9 |
1544 | 4443 //int v20; // eax@10 |
4444 //int v21; // edx@10 | |
4445 //int v22; // eax@10 | |
4446 //int result; // eax@10 | |
0 | 4447 int v24; // [sp+14h] [bp-14h]@1 |
4448 int v25; // [sp+18h] [bp-10h]@1 | |
1544 | 4449 //int v26; // [sp+1Ch] [bp-Ch]@1 |
0 | 4450 int v27; // [sp+24h] [bp-4h]@1 |
1544 | 4451 //int v28; // [sp+30h] [bp+8h]@10 |
4452 //int v29; // [sp+3Ch] [bp+14h]@10 | |
0 | 4453 |
1642 | 4454 v25 = pGame->pIndoorCameraD3D->int_cosine_x; |
4455 v7 = pGame->pIndoorCameraD3D->int_sine_y; | |
4456 v27 = pGame->pIndoorCameraD3D->int_sine_x; | |
1544 | 4457 //v8 = -pIndoorCamera->pos.y; |
1642 | 4458 v9 = pGame->pIndoorCameraD3D->int_cosine_y; |
1544 | 4459 //v26 = -pIndoorCamera->pos.z; |
1642 | 4460 v11 = pGame->pIndoorCameraD3D->int_cosine_y * -pGame->pIndoorCameraD3D->vPartyPos.x + pGame->pIndoorCameraD3D->int_sine_y * -pGame->pIndoorCameraD3D->vPartyPos.y; |
4461 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
|
4462 if (pGame->pIndoorCameraD3D->sRotationX) |
0 | 4463 { |
1643 | 4464 this->field_0_party_dir_x = fixpoint_mul(v11, pGame->pIndoorCameraD3D->int_cosine_x) + |
4465 fixpoint_mul((-pGame->pIndoorCameraD3D->vPartyPos.z) << 16, pGame->pIndoorCameraD3D->int_sine_x); | |
1544 | 4466 this->field_4_party_dir_y = v24; |
1643 | 4467 this->field_8_party_dir_z = fixpoint_mul((-pGame->pIndoorCameraD3D->vPartyPos.z) << 16, v25) - fixpoint_mul(v11, v27); |
0 | 4468 } |
4469 else | |
4470 { | |
755 | 4471 this->field_0_party_dir_x = v11; |
1544 | 4472 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
|
4473 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
|
4474 } |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
4475 |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
4476 if (pGame->pIndoorCameraD3D->sRotationX) |
1544 | 4477 { |
1643 | 4478 v17 = fixpoint_mul(a2, v9) + fixpoint_mul(a3, v7); |
4479 | |
1809 | 4480 this->angle_from_north = fixpoint_mul(v17, v25) + fixpoint_mul(a4, v27); |
4481 this->angle_from_west = fixpoint_mul(a3, v9) - fixpoint_mul(a2, v7); | |
1844 | 4482 this->viewing_angle_from_west_east = fixpoint_mul(a4, v25) - fixpoint_mul(v17, v27); |
0 | 4483 } |
4484 else | |
4485 { | |
1809 | 4486 this->angle_from_north = fixpoint_mul(a2, v9) + fixpoint_mul(a3, v7); |
4487 this->angle_from_west = fixpoint_mul(a3, v9) - fixpoint_mul(a2, v7); | |
1844 | 4488 this->viewing_angle_from_west_east = a4; |
1544 | 4489 } |
4490 | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
4491 if (pGame->pIndoorCameraD3D->sRotationX) |
1544 | 4492 { |
1643 | 4493 v19 = fixpoint_mul(a5, v9) + fixpoint_mul(a6, v7); |
4494 | |
1809 | 4495 this->angle_from_east = fixpoint_mul(v19, v25) + fixpoint_mul(a7, v27); |
4496 this->angle_from_south = fixpoint_mul(a6, v9) - fixpoint_mul(a5, v7); | |
1844 | 4497 this->viewing_angle_from_north_south = fixpoint_mul(a7, v25) - fixpoint_mul(v19, v27); |
0 | 4498 } |
4499 else | |
4500 { | |
1809 | 4501 this->angle_from_east = fixpoint_mul(a5, v9) + fixpoint_mul(a6, v7); |
4502 this->angle_from_south = fixpoint_mul(a6, v9) - fixpoint_mul(a5, v7); | |
1844 | 4503 this->viewing_angle_from_north_south = a7; |
1544 | 4504 } |
4505 | |
1809 | 4506 this->angle_from_east = -this->angle_from_east; |
4507 this->angle_from_south = -this->angle_from_south; | |
1844 | 4508 this->viewing_angle_from_north_south = -this->viewing_angle_from_north_south; |
1544 | 4509 |
1809 | 4510 this->field_24 = fixpoint_dot(this->angle_from_north, this->field_0_party_dir_x, |
4511 this->angle_from_west, this->field_4_party_dir_y, | |
1844 | 4512 this->viewing_angle_from_west_east, this->field_8_party_dir_z); |
1809 | 4513 this->field_28 = fixpoint_dot(this->angle_from_east, this->field_0_party_dir_x, |
4514 this->angle_from_south, this->field_4_party_dir_y, | |
1844 | 4515 this->viewing_angle_from_north_south, this->field_8_party_dir_z); |
0 | 4516 } |
4517 | |
4518 //----- (0048694B) -------------------------------------------------------- | |
1544 | 4519 void stru149::_48694B_frustum_sky() |
0 | 4520 { |
1809 | 4521 this->angle_from_east = -this->angle_from_east; |
4522 this->angle_from_south = -this->angle_from_south; | |
1844 | 4523 this->viewing_angle_from_north_south = -this->viewing_angle_from_north_south; |
1544 | 4524 |
1809 | 4525 this->field_24 = fixpoint_dot(this->angle_from_north, this->field_0_party_dir_x, |
4526 this->angle_from_west, this->field_4_party_dir_y, | |
1844 | 4527 this->viewing_angle_from_west_east, this->field_8_party_dir_z); |
1809 | 4528 this->field_28 = fixpoint_dot(this->angle_from_east, this->field_0_party_dir_x, |
4529 this->angle_from_south, this->field_4_party_dir_y, | |
1844 | 4530 this->viewing_angle_from_north_south, this->field_8_party_dir_z); |
0 | 4531 } |
4532 | |
4533 //----- (0044100D) -------------------------------------------------------- | |
994 | 4534 bool sub_44100D() |
0 | 4535 { |
569 | 4536 return pCurrentScreen == SCREEN_NPC_DIALOGUE || pCurrentScreen == SCREEN_CHARACTERS || |
4537 pCurrentScreen > SCREEN_LOADGAME && pCurrentScreen <= SCREEN_E || | |
4538 pCurrentScreen > SCREEN_VIDEO && pCurrentScreen <= SCREEN_INPUT_BLV || pCurrentScreen == SCREEN_CASTING; | |
0 | 4539 } |
4540 // 4E28F8: using guessed type int pCurrentScreen; | |
4541 | |
4542 //----- (00441A4E) -------------------------------------------------------- | |
910 | 4543 __int16 __fastcall sub_441A4E(int a1)//for blessing |
0 | 4544 { |
4545 __int16 result; // ax@1 | |
4546 int v2; // ebx@1 | |
4547 char *v3; // esi@1 | |
4548 int v4; // edi@4 | |
1110 | 4549 bool v5; // ecx@4 |
1523
53265d238d94
interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents:
1504
diff
changeset
|
4550 SpriteFrame *pFrame; // eax@6 |
53265d238d94
interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents:
1504
diff
changeset
|
4551 //SpriteFrame *v7; // edi@6 |
0 | 4552 int v8; // eax@6 |
4553 unsigned __int16 v9; // ax@6 | |
4554 RenderBillboardTransform_local0 v10; // [sp+Ch] [bp-5Ch]@1 | |
4555 int v11; // [sp+5Ch] [bp-Ch]@6 | |
4556 int v12; // [sp+60h] [bp-8h]@1 | |
4557 int v13; // [sp+64h] [bp-4h]@6 | |
4558 | |
2002 | 4559 v10.sParentBillboardID = -1; |
0 | 4560 v10.pTarget = pRenderer->pTargetSurface; |
4561 v10.pTargetZ = pRenderer->pActiveZBuffer; | |
4562 v10.uTargetPitch = pRenderer->field_10; | |
4563 result = 0; | |
4564 v2 = a1; | |
4565 v10.uViewportX = 0; | |
4566 v10.uViewportY = 0; | |
4567 v10.uViewportZ = 639; | |
4568 v10.uViewportW = 479; | |
4569 v12 = 0; | |
921 | 4570 //v3 = (char *)&pOtherOverlayList->pOverlays[0].field_C; |
4571 //do | |
4572 for ( uint i = 0; i < 50; ++i ) | |
4573 { | |
4574 if ( pOtherOverlayList->pOverlays[i].field_6 > 0 ) | |
4575 { | |
4576 result = pOtherOverlayList->pOverlays[i].field_0; | |
4577 if ( pOtherOverlayList->pOverlays[i].field_0 >= 300 ) | |
4578 { | |
4579 //v4 = result; | |
4580 v5 = pOtherOverlayList->pOverlays[i].field_0 == v2 + 320 | |
1110 | 4581 || pOtherOverlayList->pOverlays[i].field_0 == v2 + 330 |
4582 || pOtherOverlayList->pOverlays[i].field_0 == v2 + 340 | |
4583 || pOtherOverlayList->pOverlays[i].field_0 == v2 + 350; | |
921 | 4584 pOtherOverlayList->pOverlays[i].field_0 = v2 + 310; |
1110 | 4585 if ( pOtherOverlayList->pOverlays[i].field_0 == v2 + 310 || v5 ) |
921 | 4586 { |
4587 if ( !pOtherOverlayList->pOverlays[i].field_0 ) | |
4588 { | |
1523
53265d238d94
interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents:
1504
diff
changeset
|
4589 pFrame = pSpriteFrameTable->GetFrame(pOverlayList->pOverlays[pOtherOverlayList->pOverlays[i].field_2].uSpriteFramesetID, |
921 | 4590 pOtherOverlayList->pOverlays[i].field_4); |
1523
53265d238d94
interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents:
1504
diff
changeset
|
4591 //v7 = v6; |
921 | 4592 v11 = pOtherOverlayList->pOverlays[i].field_E; |
1523
53265d238d94
interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents:
1504
diff
changeset
|
4593 //v13 = pFrame->scale; |
53265d238d94
interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents:
1504
diff
changeset
|
4594 v13 = (unsigned __int64)(v11 * (signed __int64)pFrame->scale) >> 16; |
921 | 4595 v10.uScreenSpaceX = pOtherOverlayList->pOverlays[i].field_8; |
4596 v10.uScreenSpaceY = pOtherOverlayList->pOverlays[i].field_A; | |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
142
diff
changeset
|
4597 v10._screenspace_x_scaler_packedfloat = v13; |
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
142
diff
changeset
|
4598 v10._screenspace_y_scaler_packedfloat = v13; |
1523
53265d238d94
interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents:
1504
diff
changeset
|
4599 v10.pPalette = PaletteManager::Get_Dark_or_Red_LUT(pFrame->uPaletteIndex, 0, 1); |
921 | 4600 v8 = pOtherOverlayList->pOverlays[i].field_2; |
0 | 4601 v10.sZValue = 0; |
4602 v10.uFlags = 0; | |
4603 v9 = pOverlayList->pOverlays[v8].uOverlayType; | |
4604 if ( !v9 || v9 == 2 ) | |
1523
53265d238d94
interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents:
1504
diff
changeset
|
4605 v10.uScreenSpaceY += pSprites_LOD->pSpriteHeaders[pFrame->pHwSpriteIDs[0]].uHeight >> 1; |
53265d238d94
interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents:
1504
diff
changeset
|
4606 result = pSprites_LOD->pSpriteHeaders[pFrame->pHwSpriteIDs[0]]._4AD2D1(&v10, 0); |
0 | 4607 ++v12; |
4608 if ( v12 == 5 ) | |
4609 break; | |
4610 } | |
4611 } | |
4612 } | |
4613 } | |
921 | 4614 //v3 += 20; |
4615 } | |
4616 //while ( (signed int)v3 < (signed int)&pOverlayList->pOverlays ); | |
0 | 4617 return result; |
4618 } | |
4619 | |
4620 //----- (00443801) -------------------------------------------------------- | |
237 | 4621 void Initialize2DA() |
4622 { | |
4623 | |
4624 int i; | |
4625 char* test_string; | |
4626 unsigned char c; | |
4627 bool break_loop; | |
4628 unsigned int temp_str_len; | |
4629 char* tmp_pos; | |
4630 int decode_step; | |
4631 | |
4632 if ( p2DEventsTXT_Raw ) | |
1583 | 4633 free(p2DEventsTXT_Raw); |
237 | 4634 p2DEventsTXT_Raw = NULL; |
4635 p2DEventsTXT_Raw = (char *)pEvents_LOD->LoadRaw("2dEvents.txt", 0); | |
4636 strtok(p2DEventsTXT_Raw, "\r"); | |
4637 strtok(NULL, "\r"); | |
4638 | |
4639 for (i=0;i<525;++i) | |
4640 { | |
4641 test_string = strtok(NULL, "\r") + 1; | |
4642 break_loop = false; | |
4643 decode_step=0; | |
4644 do | |
4645 { | |
4646 c = *(unsigned char*)test_string; | |
4647 temp_str_len = 0; | |
4648 while((c!='\t')&&(c>0)) | |
4649 { | |
4650 ++temp_str_len; | |
4651 c=test_string[temp_str_len]; | |
4652 } | |
4653 tmp_pos=test_string+temp_str_len; | |
4654 if (*tmp_pos == 0) | |
4655 break_loop = true; | |
4656 *tmp_pos = 0; | |
4657 if (temp_str_len) | |
4658 { | |
4659 switch (decode_step) | |
4660 { | |
4661 case 2: | |
4662 { | |
4663 if ( !_strnicmp(test_string, "wea", 3) ) | |
4664 { | |
1411 | 4665 p2DEvents[i].uType = BuildingType_WeaponShop; |
237 | 4666 break; |
4667 } | |
4668 if ( !_strnicmp(test_string, "arm", 3) ) | |
4669 { | |
1411 | 4670 p2DEvents[i].uType = BuildingType_ArmorShop; |
237 | 4671 break; |
4672 } | |
4673 if ( !_strnicmp(test_string, "mag", 3) ) | |
4674 { | |
1411 | 4675 p2DEvents[i].uType = BuildingType_MagicShop; |
237 | 4676 break; |
4677 } | |
4678 if ( !_strnicmp(test_string, "alc", 3) ) | |
4679 { | |
1411 | 4680 p2DEvents[i].uType = BuildingType_AlchemistShop; |
237 | 4681 break; |
4682 } | |
4683 if ( !_strnicmp(test_string, "sta", 3) ) | |
4684 { | |
1411 | 4685 p2DEvents[i].uType = BuildingType_Stables; |
237 | 4686 break; |
4687 } | |
4688 if ( !_strnicmp(test_string, "boa", 3) ) | |
4689 { | |
1411 | 4690 p2DEvents[i].uType = BuildingType_Boats; |
237 | 4691 break; |
4692 } | |
4693 if ( !_strnicmp(test_string, "tem", 3) ) | |
4694 { | |
1411 | 4695 p2DEvents[i].uType = BuildingType_Temple; |
237 | 4696 break; |
4697 } | |
4698 if ( !_strnicmp(test_string, "tra", 3) ) | |
4699 { | |
1411 | 4700 p2DEvents[i].uType = BuildingType_Training; |
237 | 4701 break; |
4702 } | |
4703 if ( !_strnicmp(test_string, "tow", 3) ) | |
4704 { | |
1411 | 4705 p2DEvents[i].uType = BuildingType_TownHall; |
237 | 4706 break; |
4707 } | |
4708 | |
4709 if ( !_strnicmp(test_string, "tav", 3) ) | |
4710 { | |
1411 | 4711 p2DEvents[i].uType = BuildingType_Tavern; |
237 | 4712 break; |
4713 } | |
4714 if ( !_strnicmp(test_string, "ban", 3) ) | |
4715 { | |
1411 | 4716 p2DEvents[i].uType = BuildingType_Bank; |
237 | 4717 break; |
4718 } | |
4719 if ( !_strnicmp(test_string, "fir", 3) ) | |
4720 { | |
1411 | 4721 p2DEvents[i].uType = BuildingType_FireGuild; |
237 | 4722 break; |
4723 } | |
4724 if ( !_strnicmp(test_string, "air", 3) ) | |
4725 { | |
1411 | 4726 p2DEvents[i].uType = BuildingType_AirGuild; |
237 | 4727 break; |
4728 } | |
4729 if ( !_strnicmp(test_string, "wat", 3) ) | |
4730 { | |
1411 | 4731 p2DEvents[i].uType = BuildingType_WaterGuild; |
237 | 4732 break; |
4733 } | |
4734 if ( !_strnicmp(test_string, "ear", 3) ) | |
4735 { | |
1411 | 4736 p2DEvents[i].uType = BuildingType_EarthGuild; |
237 | 4737 break; |
4738 } | |
4739 if ( !_strnicmp(test_string, "spi", 3) ) | |
4740 { | |
1411 | 4741 p2DEvents[i].uType = BuildingType_SpiritGuild; |
237 | 4742 break; |
4743 } | |
4744 if ( !_strnicmp(test_string, "min", 3) ) | |
4745 { | |
1411 | 4746 p2DEvents[i].uType = BuildingType_MindGuild; |
237 | 4747 break; |
4748 } | |
4749 if ( !_strnicmp(test_string, "bod", 3) ) | |
4750 { | |
1411 | 4751 p2DEvents[i].uType = BuildingType_BodyGuild; |
237 | 4752 break; |
4753 } | |
4754 if ( !_strnicmp(test_string, "lig", 3) ) | |
4755 { | |
1411 | 4756 p2DEvents[i].uType = BuildingType_LightGuild; |
237 | 4757 break; |
4758 } | |
4759 if ( !_strnicmp(test_string, "dar", 3) ) | |
4760 { | |
1411 | 4761 p2DEvents[i].uType = BuildingType_DarkGuild; |
237 | 4762 break; |
4763 } | |
1644 | 4764 if ( !_strnicmp(test_string, "ele", 3) ) // "Element Guild" from mm6 |
237 | 4765 { |
1644 | 4766 p2DEvents[i].uType = BuildingType_ElementalGuild; |
237 | 4767 break; |
4768 } | |
4769 if ( !_strnicmp(test_string, "sel", 3) ) | |
4770 { | |
1644 | 4771 p2DEvents[i].uType = BuildingType_SelfGuild; |
237 | 4772 break; |
4773 } | |
4774 if ( !_strnicmp(test_string, "mir", 3) ) | |
4775 { | |
1411 | 4776 p2DEvents[i].uType = BuildingType_16; |
237 | 4777 break; |
4778 } | |
1644 | 4779 if ( !_strnicmp(test_string, "mer", 3) ) // "Merc Guild" from mm6 |
237 | 4780 { |
1411 | 4781 p2DEvents[i].uType = BuildingType_TownHall; |
237 | 4782 break; |
4783 } | |
1411 | 4784 p2DEvents[i].uType = BuildingType_18; |
237 | 4785 } |
4786 break; | |
4787 | |
4788 case 4: | |
4789 p2DEvents[i].uAnimationID = atoi(test_string); | |
4790 break; | |
4791 case 5: | |
4792 p2DEvents[i].pName = RemoveQuotes(test_string); | |
4793 break; | |
4794 case 6: | |
4795 p2DEvents[i].pProprieterName = RemoveQuotes(test_string); | |
4796 break; | |
4797 case 7: | |
4798 p2DEvents[i].pProprieterTitle = RemoveQuotes(test_string); | |
4799 break; | |
4800 case 8: | |
4801 p2DEvents[i].field_14 = atoi(test_string); | |
4802 break; | |
4803 case 9: | |
4804 p2DEvents[i]._state = atoi(test_string); | |
4805 break; | |
4806 case 10: | |
4807 p2DEvents[i]._rep = atoi(test_string); | |
4808 break; | |
4809 case 11: | |
4810 p2DEvents[i]._per = atoi(test_string); | |
4811 break; | |
4812 case 12: | |
4813 p2DEvents[i].fPriceMultiplier = atof(test_string); | |
4814 break; | |
4815 case 13: | |
4816 p2DEvents[i].flt_24 = atof(test_string); | |
4817 break; | |
4818 case 15: | |
4819 p2DEvents[i].field_1C = atoi(test_string); | |
4820 break; | |
4821 case 18: | |
4822 p2DEvents[i].uOpenTime = atoi(test_string); | |
4823 break; | |
4824 case 19: | |
4825 p2DEvents[i].uCloseTime = atoi(test_string); | |
4826 break; | |
4827 case 20: | |
4828 p2DEvents[i].uExitPicID = atoi(test_string); | |
4829 break; | |
4830 case 21: | |
4831 p2DEvents[i].uExitMapID = atoi(test_string); | |
4832 break; | |
4833 case 22: | |
4834 p2DEvents[i]._quest_related = atoi(test_string); | |
4835 break; | |
4836 case 23: | |
4837 p2DEvents[i].pEnterText = RemoveQuotes(test_string); | |
4838 break; | |
4839 } | |
4840 } | |
4841 ++decode_step; | |
4842 test_string=tmp_pos+1; | |
4843 } while ((decode_step<24)&&!break_loop); | |
4844 } | |
4845 | |
0 | 4846 } |
4847 | |
4848 //----- (00443E31) -------------------------------------------------------- | |
601 | 4849 void LoadLevel_InitializeLevelStr() |
4850 { | |
329 | 4851 |
4852 char Args[100]; | |
4853 int string_num; | |
4854 int max_string_length; | |
4855 int current_string_length; | |
4856 int prev_string_offset; | |
4857 | |
4858 if (sizeof(pLevelStrOffsets) != 2000) | |
0 | 4859 Log::Warning(L"pLevelStrOffsets: deserialization warning"); |
1202 | 4860 memset(pLevelStrOffsets.data(), 0, 2000); |
0 | 4861 |
329 | 4862 max_string_length = 0; |
4863 string_num = 1; | |
4864 prev_string_offset = 0; | |
336 | 4865 pLevelStrOffsets[0]=0; |
0 | 4866 for (uint i = 0; i < uLevelStrFileSize; ++i) |
4867 { | |
4868 if ( !pLevelStr[i] ) | |
4869 { | |
329 | 4870 pLevelStrOffsets[string_num] = i + 1; |
4871 ++string_num; | |
4872 if ( i - prev_string_offset > max_string_length ) | |
4873 max_string_length = i - prev_string_offset; | |
4874 prev_string_offset = i; | |
4875 } | |
4876 } | |
4877 | |
4878 uLevelStrNumStrings = string_num - 1; | |
4879 if ( max_string_length > 800 ) | |
1545 | 4880 Error("MAX_EVENT_TEXT_LENGTH needs to be increased to %lu", max_string_length+1); |
329 | 4881 |
4882 if ( uLevelStrNumStrings > 0 ) | |
4883 { | |
336 | 4884 for(uint i = 0; i <uLevelStrNumStrings ; ++i) |
329 | 4885 { |
4886 if ( RemoveQuotes(&pLevelStr[pLevelStrOffsets[i]]) != &pLevelStr[pLevelStrOffsets[i]] ) | |
4887 ++pLevelStrOffsets[i]; | |
4888 } | |
0 | 4889 } |
4890 } | |
4891 | |
4892 //----- (00443F95) -------------------------------------------------------- | |
1458 | 4893 void OnMapLeave() |
0 | 4894 { |
336 | 4895 _evt_raw *test_event; |
4896 if ( uLevelEVT_NumEvents > 0 ) | |
4897 { | |
4898 for (uint i = 0; i < uLevelEVT_NumEvents; ++i) | |
4899 { | |
4900 test_event=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[i].uEventOffsetInEVT]; | |
1052 | 4901 if ( test_event->_e_type == EVENT_OnMapLeave ) |
4902 { | |
4903 EventProcessor(pLevelEVT_Index[i].uEventID, 0, 1, pLevelEVT_Index[i].event_sequence_num); | |
336 | 4904 } |
4905 } | |
0 | 4906 } |
4907 } | |
4908 | |
4909 //----- (00443FDC) -------------------------------------------------------- | |
4910 void OnMapLoad() | |
781 | 4911 { |
363 | 4912 stru176 *v3; // esi@7 |
4913 __int16 v4; // cx@9 | |
4914 __int16 v5; // di@9 | |
4915 int v6; // eax@9 | |
4916 signed __int64 v8; // qax@26 | |
4917 unsigned int v9; // ecx@26 | |
4918 signed __int64 v10; // qax@26 | |
4919 signed __int64 v11; // qax@26 | |
4920 int v12; // ST50_4@26 | |
4921 signed __int64 v13; // qax@26 | |
4922 signed __int64 v14; // qax@26 | |
4923 int v15; // ST58_4@26 | |
4924 signed __int64 v16; // qax@26 | |
4925 int hours; // ebx@26 | |
4926 unsigned __int64 v18; // [sp+Ch] [bp-44h]@12 | |
4927 signed __int64 seconds; // [sp+14h] [bp-3Ch]@26 | |
4928 unsigned __int64 v20; // [sp+1Ch] [bp-34h]@7 | |
4929 int minutes; // [sp+2Ch] [bp-24h]@26 | |
4930 int years; // [sp+34h] [bp-1Ch]@26 | |
4931 int weeks; // [sp+38h] [bp-18h]@26 | |
4932 int v26; // [sp+3Ch] [bp-14h]@15 | |
4933 int days; // [sp+3Ch] [bp-14h]@26 | |
4934 int months; // [sp+40h] [bp-10h]@26 | |
4935 __int16 v29; // [sp+46h] [bp-Ah]@9 | |
4936 __int16 v30; // [sp+48h] [bp-8h]@9 | |
4937 __int16 v31; // [sp+4Ah] [bp-6h]@9 | |
4938 __int16 v32; // [sp+4Ch] [bp-4h]@9 | |
4939 __int16 v33; // [sp+4Eh] [bp-2h]@9 | |
4940 | |
4941 for (uint i = 0; i < uLevelEVT_NumEvents; ++i) | |
781 | 4942 { |
1980 | 4943 EventIndex pEvent = pLevelEVT_Index[i]; |
4944 | |
4945 _evt_raw* _evt = (_evt_raw *)(&pLevelEVT[pEvent.uEventOffsetInEVT]); | |
363 | 4946 |
4947 if (_evt->_e_type == EVENT_PlaySound) | |
781 | 4948 { |
601 | 4949 pSoundList->LoadSound(EVT_DWORD(_evt->v5), 0); |
781 | 4950 } |
363 | 4951 else if (_evt->_e_type == EVENT_OnMapReload) |
781 | 4952 { |
1052 | 4953 EventProcessor(pEvent.uEventID, 0, 0, pEvent.event_sequence_num); |
781 | 4954 } |
1052 | 4955 else if (_evt->_e_type == EVENT_OnTimer || _evt->_e_type == EVENT_Initialize) |
781 | 4956 { |
363 | 4957 v3 = &array_5B5928_timers[dword_5B65C8_timers_count]; |
810 | 4958 v20 = pOutdoor->loc_time.uLastVisitDay; |
363 | 4959 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) |
4960 v20 = pIndoor->stru1.uLastVisitDay; | |
4961 | |
4962 v3->timer_evt_type = _evt->_e_type; | |
4963 v3->timer_evt_ID = pEvent.uEventID; | |
4964 v3->timer_evt_seq_num = pEvent.event_sequence_num; | |
4965 | |
4966 v3->field_10 = _evt->v5; | |
4967 v3->field_12 = _evt->v6; | |
4968 v3->field_14 = _evt->v7; | |
4969 v3->field_16 = _evt->v8; | |
4970 v3->field_18 = _evt->v9; | |
4971 v3->field_1A = _evt->v10; | |
4972 | |
4973 | |
4974 v6 = ((unsigned short)_evt->v12 << 8) + _evt->v11; | |
4975 | |
789 | 4976 v3->time_left_to_fire = ((unsigned short)_evt->v12 << 8) + _evt->v11; |
4977 v3->fire_interval = ((unsigned short)_evt->v12 << 8) + _evt->v11; | |
1052 | 4978 if (v3->timer_evt_type == EVENT_Initialize && !(short)v6 ) |
781 | 4979 { |
363 | 4980 if ( v20 ) |
4981 v18 = pParty->uTimePlayed - v20; | |
4982 else | |
4983 v18 = 0i64; | |
4984 v26 = (signed int)(signed __int64)((double)(signed __int64)v18 * 0.234375) / 60 / 60 / 24; | |
4985 | |
4986 if ( v26 / 7 / 4 / 12 ) | |
781 | 4987 { |
363 | 4988 if ( v3->field_10 ) |
781 | 4989 { |
363 | 4990 ++dword_5B65C8_timers_count; |
789 | 4991 v3->next_fire_time = 0; |
363 | 4992 continue; |
4993 } | |
781 | 4994 } |
363 | 4995 if (v26 / 7 / 4 != 0 && v3->field_12 != 0 || |
4996 v26 / 7 != 0 && v3->field_14 != 0 || | |
4997 v26 != 0 || !v20) | |
781 | 4998 { |
363 | 4999 ++dword_5B65C8_timers_count; |
789 | 5000 v3->next_fire_time = 0; |
363 | 5001 continue; |
5002 } | |
781 | 5003 } |
363 | 5004 else |
781 | 5005 { |
363 | 5006 v8 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375); |
5007 v9 = v8; | |
5008 v10 = (signed int)v8 / 60; | |
5009 minutes = v10 % 60; | |
5010 v11 = (signed int)(v10 / 60); | |
5011 v12 = v11 % 24; | |
5012 v13 = (signed int)(v11 / 24); | |
5013 days = v13 % 7; | |
5014 v14 = (signed int)(v13 / 7); | |
5015 v15 = v14 % 4; | |
5016 v16 = (signed int)(v14 / 4); | |
5017 years = v16 / 12; | |
5018 | |
1980 | 5019 unsigned __int64 _1 = (unsigned __int64)((double)pParty->uTimePlayed * 0.234375) >> 32; |
5020 __int64 _2 = ((__int64)v9 << 32) | _1; | |
363 | 5021 |
5022 seconds = _2 % 60; | |
5023 //v19 = (signed __int64)__PAIR__((unsigned __int64)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) >> 32, | |
5024 // v9) | |
5025 // % 60; | |
5026 | |
5027 hours = v12; | |
5028 weeks = v15; | |
5029 months = v16 % 12; | |
5030 if ( v3->field_10 ) | |
781 | 5031 { |
363 | 5032 ++years; |
781 | 5033 } |
363 | 5034 else |
781 | 5035 { |
363 | 5036 if ( v3->field_12 ) |
781 | 5037 { |
5038 ++months; | |
5039 } | |
5040 else | |
5041 { | |
5042 if ( v3->field_14 ) | |
363 | 5043 { |
781 | 5044 ++weeks; |
363 | 5045 } |
781 | 5046 else |
363 | 5047 { |
5048 ++days; | |
5049 minutes = v3->field_18; | |
5050 hours = v3->field_16; | |
5051 seconds = v3->field_1A; | |
5052 } | |
5053 } | |
781 | 5054 } |
789 | 5055 v3->next_fire_time = (signed __int64)((double)((seconds |
363 | 5056 + 60 * minutes |
5057 + 3600 * hours | |
5058 + 0x93A80 * weeks | |
5059 + 0x15180 * days | |
5060 + 0x24EA00 * (months + 12i64 * years)) << 7) | |
5061 * 0.033333335); | |
5062 | |
5063 ++dword_5B65C8_timers_count; | |
5064 } | |
5065 } | |
5066 } | |
781 | 5067 } |
0 | 5068 |
5069 //----- (00444360) -------------------------------------------------------- | |
1411 | 5070 void Level_LoadEvtAndStr(const char *pLevelName) |
0 | 5071 { |
5072 char pContainerName[120]; // [sp+8h] [bp-98h]@1 | |
5073 | |
5074 sprintf(pContainerName, "%s.evt", pLevelName); | |
1541 | 5075 uLevelEVT_Size = LoadEventsToBuffer(pContainerName, pLevelEVT.data(), 9216); |
0 | 5076 |
5077 sprintf(pContainerName, "%s.str", pLevelName); | |
1541 | 5078 uLevelStrFileSize = LoadEventsToBuffer(pContainerName, pLevelStr.data(), 9216); |
0 | 5079 if (uLevelStrFileSize) |
5080 LoadLevel_InitializeLevelStr(); | |
5081 } | |
5082 | |
5083 //----- (00444D80) -------------------------------------------------------- | |
1411 | 5084 int GetTravelTime() |
0 | 5085 { |
5086 signed int v0; // esi@1 | |
5087 | |
5088 v0 = uDefaultTravelTime_ByFoot; | |
652 | 5089 if ( CheckHiredNPCSpeciality(Guide) ) |
0 | 5090 --v0; |
652 | 5091 if ( CheckHiredNPCSpeciality(Tracker) ) |
0 | 5092 v0 -= 2; |
652 | 5093 if ( CheckHiredNPCSpeciality(Pathfinder) ) |
0 | 5094 v0 -= 3; |
652 | 5095 if ( CheckHiredNPCSpeciality(Explorer) ) |
0 | 5096 --v0; |
5097 if ( v0 < 1 ) | |
5098 v0 = 1; | |
5099 return v0; | |
5100 } | |
5101 // 6BD07C: using guessed type int uDefaultTravelTime_ByFoot; | |
5102 | |
5103 //----- (004451A8) -------------------------------------------------------- | |
5104 void __fastcall sub_4451A8_press_any_key(int a1, int a2, int a4) | |
5105 { | |
5106 int v3; // esi@1 | |
5107 int v4; // edi@1 | |
5108 | |
5109 v3 = a2; | |
5110 v4 = a1; | |
5111 if ( !pGUIWindow2 ) | |
5112 { | |
5113 if ( pParty->uFlags & 2 ) | |
5114 pGame->Draw(); | |
1052 | 5115 pAudioPlayer->StopChannels(-1, -1); |
0 | 5116 pMiscTimer->Pause(); |
5117 pEventTimer->Pause(); | |
5118 dword_5C3418 = v4; | |
5119 dword_5C341C = v3; | |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
515
diff
changeset
|
5120 _591094_decoration = activeLevelDecoration; |
948 | 5121 pGUIWindow2 = GUIWindow::Create(0, 0, 640, 480, WINDOW_GreetingNPC, a4, 0); |
5122 pGUIWindow2->CreateButton( 61, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0); | |
5123 pGUIWindow2->CreateButton(177, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0); | |
5124 pGUIWindow2->CreateButton(292, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0); | |
5125 pGUIWindow2->CreateButton(407, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0); | |
0 | 5126 } |
5127 } | |
5128 | |
5129 //----- (004452BB) -------------------------------------------------------- | |
1546 | 5130 void sub_4452BB() |
0 | 5131 { |
5132 pGUIWindow2->Release(); | |
5133 pGUIWindow2 = 0; | |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
515
diff
changeset
|
5134 activeLevelDecoration = _591094_decoration; |
1052 | 5135 EventProcessor(dword_5C3418, 0, 1, dword_5C341C); |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
515
diff
changeset
|
5136 activeLevelDecoration = NULL; |
0 | 5137 pEventTimer->Resume(); |
5138 } | |
5139 | |
5140 //----- (004465DF) -------------------------------------------------------- | |
5141 int sub_4465DF_check_season(int a1) | |
5142 { | |
5143 unsigned int v1; // eax@1 | |
5144 unsigned int v2; // edx@1 | |
5145 int v3; // ecx@2 | |
5146 int v4; // ecx@3 | |
5147 char v6; // zf@9 | |
5148 | |
5149 v1 = pParty->uCurrentMonth + 1; | |
5150 v2 = pParty->uDaysPlayed + 1; | |
5151 if ( a1 ) | |
5152 { | |
5153 v3 = a1 - 1; | |
5154 if ( v3 ) | |
5155 { | |
5156 v4 = v3 - 1; | |
5157 if ( v4 ) | |
5158 { | |
5159 if ( v4 != 1 ) | |
5160 return 0; | |
5161 if ( v1 != 12 ) | |
5162 { | |
5163 if ( (signed int)v1 >= 1 && (signed int)v1 <= 2 ) | |
5164 return 1; | |
5165 v6 = v1 == 3; | |
5166 LABEL_24: | |
5167 if ( !v6 || (signed int)v2 >= 21 ) | |
5168 return 0; | |
5169 return 1; | |
5170 } | |
5171 } | |
5172 else | |
5173 { | |
5174 if ( v1 != 9 ) | |
5175 { | |
5176 if ( (signed int)v1 >= 10 && (signed int)v1 <= 11 ) | |
5177 return 1; | |
5178 v6 = v1 == 12; | |
5179 goto LABEL_24; | |
5180 } | |
5181 } | |
5182 } | |
5183 else | |
5184 { | |
5185 if ( v1 != 6 ) | |
5186 { | |
5187 if ( (signed int)v1 >= 7 && (signed int)v1 <= 8 ) | |
5188 return 1; | |
5189 v6 = v1 == 9; | |
5190 goto LABEL_24; | |
5191 } | |
5192 } | |
5193 } | |
5194 else | |
5195 { | |
5196 if ( v1 != 3 ) | |
5197 { | |
5198 if ( (signed int)v1 >= 4 && (signed int)v1 <= 5 ) | |
5199 return 1; | |
5200 v6 = v1 == 6; | |
5201 goto LABEL_24; | |
5202 } | |
5203 } | |
5204 if ( (signed int)v2 >= 21 ) | |
5205 return 1; | |
5206 return 0; | |
5207 } | |
5208 | |
5209 //----- (0044861E) -------------------------------------------------------- | |
5210 void __fastcall sub_44861E_set_texture(unsigned int uFaceCog, const char *pFilename) | |
5211 { | |
5212 unsigned int v2; // eax@2 | |
5213 unsigned __int16 v3; // di@2 | |
5214 signed int v4; // esi@5 | |
5215 BLVFace *v5; // eax@7 | |
5216 unsigned int *v6; // eax@8 | |
5217 char *v7; // eax@9 | |
5218 int v8; // edi@16 | |
5219 char *v9; // esi@16 | |
5220 ODMFace *v10; // eax@17 | |
5221 unsigned int *v11; // eax@19 | |
5222 unsigned __int16 v12; // [sp+Ch] [bp-18h]@2 | |
5223 const char *Str2; // [sp+10h] [bp-14h]@1 | |
5224 unsigned int v14; // [sp+14h] [bp-10h]@1 | |
5225 signed int v15; // [sp+18h] [bp-Ch]@14 | |
5226 int v16; // [sp+1Ch] [bp-8h]@15 | |
5227 signed int v17; // [sp+20h] [bp-4h]@4 | |
5228 signed int v18; // [sp+20h] [bp-4h]@16 | |
5229 | |
5230 Str2 = pFilename; | |
5231 v14 = uFaceCog; | |
5232 if ( uFaceCog ) | |
5233 { | |
5234 v2 = pBitmaps_LOD->LoadTexture(pFilename); | |
5235 v3 = v2; | |
5236 v12 = v2; | |
5237 if ( v2 != -1 ? (int)&pBitmaps_LOD->pTextures[v2] : 0 ) | |
5238 { | |
5239 pBitmaps_LOD->pTextures[v2].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[v2].palette_id1); | |
5240 | |
5241 if ( uCurrentlyLoadedLevelType == 1 ) | |
5242 { | |
5243 v17 = 1; | |
5244 if ( (signed int)pIndoor->uNumFaceExtras > 1 ) | |
5245 { | |
5246 v4 = 1; | |
5247 do | |
5248 { | |
5249 if ( pIndoor->pFaceExtras[v4].sCogNumber == v14 ) | |
5250 { | |
5251 v5 = &pIndoor->pFaces[pIndoor->pFaceExtras[v4].field_C]; | |
5252 if ( BYTE1(v5->uAttributes) & 0x40 ) | |
5253 { | |
5254 pIndoor->pFaces[pIndoor->pFaceExtras[v4].field_C].uBitmapID = pTextureFrameTable->FindTextureByName( | |
5255 Str2); | |
5256 v6 = (unsigned int *)&pIndoor->pFaces[pIndoor->pFaceExtras[v4].field_C].uBitmapID; | |
5257 if ( *(_WORD *)v6 ) | |
5258 { | |
5259 pTextureFrameTable->LoadAnimationSequenceAndPalettes(*(_WORD *)v6); | |
5260 } | |
5261 else | |
5262 { | |
5263 *(_WORD *)v6 = v3; | |
5264 v7 = (char *)&pIndoor->pFaces[pIndoor->pFaceExtras[v4].field_C].uAttributes; | |
5265 v7[1] &= 0xBFu; | |
5266 } | |
5267 } | |
5268 else | |
5269 { | |
5270 v5->uBitmapID = v3; | |
5271 } | |
5272 } | |
5273 ++v17; | |
5274 ++v4; | |
5275 } | |
5276 while ( v17 < (signed int)pIndoor->uNumFaceExtras ); | |
5277 } | |
5278 pParty->uFlags |= 2u; | |
5279 } | |
5280 else | |
5281 { | |
5282 v15 = 0; | |
5283 if ( (signed int)pOutdoor->uNumBModels > 0 ) | |
5284 { | |
5285 v16 = 0; | |
5286 do | |
5287 { | |
5288 v8 = 0; | |
5289 v9 = (char *)&pOutdoor->pBModels[v16].pVertices; | |
5290 v18 = 0; | |
5291 if ( (signed int)pOutdoor->pBModels[v16].uNumFaces > 0 ) | |
5292 { | |
5293 do | |
5294 { | |
5295 v10 = (ODMFace *)(v8 + *((_DWORD *)v9 + 4)); | |
5296 if ( v10->sCogNumber == v14 ) | |
5297 { | |
5298 if ( BYTE1(v10->uAttributes) & 0x40 ) | |
5299 { | |
5300 *(_WORD *)(*((_DWORD *)v9 + 4) + v8 + 272) = pTextureFrameTable->FindTextureByName( | |
5301 Str2); | |
5302 v11 = (unsigned int *)(*((_DWORD *)v9 + 4) + v8 + 272); | |
5303 if ( *(_WORD *)v11 ) | |
5304 { | |
5305 pTextureFrameTable->LoadAnimationSequenceAndPalettes(*(_WORD *)v11); | |
5306 } | |
5307 else | |
5308 { | |
5309 *(_WORD *)v11 = v12; | |
5310 *(_BYTE *)(*((_DWORD *)v9 + 4) + v8 + 29) &= 0xBFu; | |
5311 } | |
5312 } | |
5313 else | |
5314 { | |
5315 v10->uTextureID = v12; | |
5316 } | |
5317 } | |
5318 ++v18; | |
5319 v8 += 308; | |
5320 } | |
5321 while ( v18 < *((_DWORD *)v9 + 2) ); | |
5322 } | |
5323 ++v15; | |
5324 ++v16; | |
5325 } | |
5326 while ( v15 < (signed int)pOutdoor->uNumBModels ); | |
5327 } | |
5328 } | |
5329 pParty->uFlags |= 2u; | |
5330 } | |
5331 } | |
5332 } | |
5333 | |
5334 //----- (0044882F) -------------------------------------------------------- | |
1515 | 5335 void __fastcall SetDecorationSprite(uint16_t uCog, bool bHide, const char *pFileName) |
0 | 5336 { |
1515 | 5337 for (size_t i = 0; i < uNumLevelDecorations; i++) |
5338 { | |
5339 if (pLevelDecorations[i].uCog == uCog) | |
0 | 5340 { |
1515 | 5341 if (pFileName && strcmp(pFileName, "0")) |
0 | 5342 { |
1515 | 5343 pLevelDecorations[i].uDecorationDescID = pDecorationList->GetDecorIdByName(pFileName); |
5344 pDecorationList->InitializeDecorationSprite(pLevelDecorations[i].uDecorationDescID); | |
0 | 5345 } |
1515 | 5346 |
5347 if (bHide) | |
5348 pLevelDecorations[i].uFlags &= ~LEVEL_DECORATION_INVISIBLE; | |
5349 else | |
5350 pLevelDecorations[i].uFlags |= LEVEL_DECORATION_INVISIBLE; | |
5351 | |
5352 pParty->uFlags |= 2u; | |
0 | 5353 } |
5354 } | |
5355 } | |
5356 | |
5357 //----- (0044892E) -------------------------------------------------------- | |
5358 void __fastcall sub_44892E_set_faces_bit(int sCogNumber, int bit, int on) | |
5359 { | |
5360 signed int v3; // esi@2 | |
5361 signed int v4; // ecx@4 | |
5362 char *v5; // eax@6 | |
5363 int v6; // edi@13 | |
5364 char *v7; // esi@13 | |
5365 signed int v8; // ecx@13 | |
5366 ODMFace *v9; // eax@14 | |
5367 int v10; // [sp+0h] [bp-Ch]@1 | |
5368 signed int v11; // [sp+4h] [bp-8h]@11 | |
5369 int v12; // [sp+8h] [bp-4h]@12 | |
5370 | |
5371 v10 = sCogNumber; | |
5372 if ( sCogNumber ) | |
5373 { | |
5374 v3 = 1; | |
5375 if ( uCurrentlyLoadedLevelType == 1 ) | |
5376 { | |
5377 if ( (signed int)pIndoor->uNumFaceExtras > 1 ) | |
5378 { | |
5379 v4 = 1; | |
5380 do | |
5381 { | |
5382 if ( pIndoor->pFaceExtras[v4].sCogNumber == v10 ) | |
5383 { | |
5384 v5 = (char *)&pIndoor->pFaces[pIndoor->pFaceExtras[v4].field_C].uAttributes; | |
5385 if ( on ) | |
5386 *(_DWORD *)v5 |= bit; | |
5387 else | |
5388 *(_DWORD *)v5 &= ~bit; | |
5389 } | |
5390 ++v3; | |
5391 ++v4; | |
5392 } | |
5393 while ( v3 < (signed int)pIndoor->uNumFaceExtras ); | |
5394 } | |
5395 pParty->uFlags |= 2u; | |
5396 } | |
5397 else | |
5398 { | |
5399 v11 = 0; | |
5400 if ( (signed int)pOutdoor->uNumBModels > 0 ) | |
5401 { | |
5402 v12 = 0; | |
5403 do | |
5404 { | |
5405 v6 = 0; | |
5406 v7 = (char *)&pOutdoor->pBModels[v12].pVertices; | |
5407 v8 = 0; | |
5408 if ( (signed int)pOutdoor->pBModels[v12].uNumFaces > 0 ) | |
5409 { | |
5410 do | |
5411 { | |
5412 v9 = (ODMFace *)(v6 + *((_DWORD *)v7 + 4)); | |
5413 if ( v9->sCogNumber == v10 ) | |
5414 { | |
5415 if ( on ) | |
5416 v9->uAttributes |= bit; | |
5417 else | |
5418 v9->uAttributes &= ~bit; | |
5419 } | |
5420 ++v8; | |
5421 v6 += 308; | |
5422 } | |
5423 while ( v8 < *((_DWORD *)v7 + 2) ); | |
5424 } | |
5425 ++v11; | |
5426 ++v12; | |
5427 } | |
5428 while ( v11 < (signed int)pOutdoor->uNumBModels ); | |
5429 } | |
5430 } | |
5431 pParty->uFlags |= 2u; | |
5432 } | |
5433 } | |
5434 | |
5435 //----- (00448A98) -------------------------------------------------------- | |
5436 void __fastcall ToggleActorGroupFlag(unsigned int uGroupID, unsigned int uFlag, unsigned int bToggle) | |
5437 { | |
5438 unsigned int v3; // ebx@1 | |
5439 unsigned int v4; // ebp@1 | |
5440 signed int v5; // edi@1 | |
82 | 5441 Actor *v6; // esi@4 |
0 | 5442 size_t v7; // ecx@10 |
82 | 5443 Actor *v8; // eax@11 |
0 | 5444 unsigned __int16 v9; // dx@14 |
5445 | |
5446 v4 = uGroupID; | |
5447 v5 = Standing; | |
5448 v3 = uFlag; | |
5449 if ( uGroupID ) | |
5450 { | |
5451 if ( bToggle ) | |
5452 { | |
5453 if ( (signed int)uNumActors > Standing ) | |
5454 { | |
1202 | 5455 v6 = pActors.data();//[0].uAttributes; |
0 | 5456 do |
5457 { | |
82 | 5458 if ( v6->uGroup == v4 ) |
5459 { | |
5460 v6->uAttributes |= v3; | |
0 | 5461 if ( v3 == 0x10000 ) |
5462 { | |
82 | 5463 v6->uAIState = Disabled; |
5464 v6->UpdateAnimation(); | |
0 | 5465 } |
5466 } | |
5467 ++v5; | |
82 | 5468 ++v6; |
0 | 5469 } |
5470 while ( v5 < (signed int)uNumActors ); | |
5471 } | |
5472 } | |
5473 else | |
5474 { | |
5475 v7 = uNumActors; | |
5476 if ( (signed int)uNumActors > Standing ) | |
5477 { | |
1202 | 5478 v8 = pActors.data();//[0].uAIState; |
0 | 5479 do |
5480 { | |
82 | 5481 if ( v8->uGroup == v4 ) |
0 | 5482 { |
5483 if ( v3 == 0x10000 ) | |
5484 { | |
82 | 5485 v9 = v8->uAIState; |
5486 if ( v8->uAIState != Dead ) | |
0 | 5487 { |
5488 if ( v9 != 4 && v9 != 11 ) | |
82 | 5489 v8->uAIState = Standing; |
5490 } | |
5491 } | |
5492 LODWORD(v8->uAttributes) &= ~v3; | |
5493 } | |
5494 ++v8; | |
0 | 5495 --v7; |
5496 } | |
5497 while ( v7 ); | |
5498 } | |
5499 } | |
5500 } | |
5501 } | |
5502 | |
5503 //----- (00448B45) -------------------------------------------------------- | |
1458 | 5504 void GameUI_StatusBar_UpdateTimedString(unsigned int bForceHide) |
0 | 5505 { |
783 | 5506 if ( bForceHide || GameUI_Footer_TimeLeft && GetTickCount() >= GameUI_Footer_TimeLeft ) |
5507 GameUI_Footer_TimeLeft = 0; | |
0 | 5508 } |
5509 | |
5510 //----- (00448B67) -------------------------------------------------------- | |
790 | 5511 void OnTimer(int __unused) |
5512 { | |
789 | 5513 if (pEventTimer->bPaused) |
5514 return; | |
5515 | |
790 | 5516 if (__unused) |
5517 _5773C0_unused = 0; | |
789 | 5518 |
1980 | 5519 long long v13 = (signed __int64)(pParty->uTimePlayed - _5773B8_event_timer) / 128; |
789 | 5520 if (!v13) |
5521 return; | |
5522 | |
5523 //uint _v2v3 = pParty->uTimePlayed; | |
5524 //v3 = HIDWORD(pParty->uTimePlayed); | |
5525 //v2 = LODWORD(pParty->uTimePlayed); | |
5526 | |
5527 _5773B8_event_timer = pParty->uTimePlayed; | |
5528 | |
5529 for (uint i = 0; i < dword_5B65C8_timers_count; ++i) | |
5530 { | |
5531 //v4 = (char *)&array_5B5928_timers[0].field_C; | |
1980 | 5532 stru176* timer = &array_5B5928_timers[i]; |
789 | 5533 //while ( 1 ) |
5534 //{ | |
5535 //v5 = *(short *)v4; | |
5536 if (timer->time_left_to_fire) | |
5537 { | |
5538 if (v13 < timer->time_left_to_fire) | |
5539 timer->time_left_to_fire -= v13; | |
5540 else | |
5541 { | |
5542 timer->time_left_to_fire = timer->fire_interval; | |
1052 | 5543 EventProcessor(timer->timer_evt_ID, 0, 1, timer->timer_evt_seq_num); |
789 | 5544 } |
5545 } | |
5546 else | |
5547 { | |
5548 if (timer->next_fire_time < pParty->uTimePlayed) | |
5549 { | |
5550 uint next_trigger_time = 1 * 60 * 60 * 24; // 1 day | |
5551 if (timer->field_10) | |
5552 next_trigger_time = 336 * 60 * 60 * 24; // 1 year | |
5553 else if (timer->field_12) | |
5554 next_trigger_time = 28 * 60 * 60 * 24; // 1 month | |
5555 else if (timer->field_14) | |
5556 next_trigger_time = 7 * 60 * 60 * 24; // 1 week | |
5557 | |
5558 timer->next_fire_time += (next_trigger_time * 128) / 3.0f; | |
1052 | 5559 if (timer->next_fire_time < pParty->uTimePlayed) // make sure in wont fire several times in a row if big time interval has lapsed |
789 | 5560 timer->next_fire_time = pParty->uTimePlayed; |
5561 | |
1052 | 5562 EventProcessor(timer->timer_evt_ID, 0, 1, timer->timer_evt_seq_num); |
0 | 5563 } |
5564 } | |
5565 } | |
5566 } | |
5567 | |
5568 //----- (00481D77) -------------------------------------------------------- | |
5569 void _outdoor_project(RenderVertexSoft *v) | |
5570 { | |
5571 double v1; // st7@1 | |
5572 double v2; // st7@1 | |
5573 | |
5574 v1 = 1.0 / (v->vWorldViewPosition.x + 0.0000001); | |
168 | 5575 v->_rhw = v1; |
1637 | 5576 v2 = v1 * (double)pODMRenderParams->int_fov_rad; |
0 | 5577 v->vWorldViewProjX = (double)pViewport->uScreenCenterX - v2 * v->vWorldViewPosition.y; |
5578 v->vWorldViewProjY = (double)pViewport->uScreenCenterY - v2 * v->vWorldViewPosition.z; | |
5579 } | |
5580 | |
5581 //----- (00448CF4) -------------------------------------------------------- | |
5582 void __fastcall sub_448CF4_spawn_monsters(__int16 typeindex, __int16 level, int count, int x, int y, int z, int group, unsigned int uUniqueName) | |
5583 { | |
5584 __int16 v8; // di@1 | |
5585 __int16 v9; // si@1 | |
5586 unsigned int v10; // eax@1 | |
5587 size_t v11; // ebx@2 | |
5588 signed int v12; // esi@2 | |
35 | 5589 Actor *pActor;//Actor_uYawAngle_cr *v13; // ebx@3 |
0 | 5590 AIDirection a3; // [sp+Ch] [bp-50h]@2 |
5591 AIDirection v15; // [sp+28h] [bp-34h]@2 | |
5592 //SpawnPointMM7 v16; // [sp+44h] [bp-18h]@1 | |
5593 | |
5594 v8 = typeindex; | |
5595 v9 = level; | |
5596 | |
5597 SpawnPointMM7 v16; // [sp+44h] [bp-18h]@1 | |
5598 //SpawnPointMM7::SpawnPointMM7(&v16); | |
5599 | |
5600 v16.vPosition.x = x; | |
5601 v16.vPosition.y = y; | |
5602 v16.vPosition.z = z; | |
5603 v16.uGroup = group; | |
5604 v16.uRadius = 32; | |
5605 v16.uKind = 3; | |
5606 v16.uIndex = v8 + 2 * v9 + v9; | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1470
diff
changeset
|
5607 v10 = pMapStats->GetMapInfo(pCurrentMapName); |
0 | 5608 if ( v10 ) |
5609 { | |
5610 v11 = uNumActors; | |
1546 | 5611 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
|
5612 Actor::GetDirectionInfo(PID(OBJECT_Actor, v11), 4u, &v15, 1); |
0 | 5613 v12 = v11; |
5614 if ( (signed int)v11 < (signed int)uNumActors ) | |
5615 { | |
35 | 5616 for ( pActor = &pActors[v11]; v12 < (signed int)uNumActors; ++pActor ) |
5617 { | |
5618 pActor->PrepareSprites(0); | |
0 | 5619 ++v12; |
35 | 5620 pActor->uYawAngle = v15.uYawAngle; |
5621 pActor->dword_000334_unique_name = uUniqueName; | |
5622 } | |
0 | 5623 } |
5624 } | |
5625 } | |
5626 | |
5627 | |
5628 //----- (0044987B) -------------------------------------------------------- | |
783 | 5629 void sub_44987B(const char *pMapName, MapStartPoint start_point) |
0 | 5630 { |
5631 const char *v2; // edi@1 | |
5632 | |
5633 v2 = pMapName; | |
5634 pAudioPlayer->StopChannels(-1, -1); | |
434 | 5635 pGameLoadingUI_ProgressBar->Initialize(GUIProgressBar::TYPE_None); |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1470
diff
changeset
|
5636 if ( _stricmp(pCurrentMapName, v2) ) |
0 | 5637 SaveGame(1, 0); |
783 | 5638 |
978 | 5639 uGameState = GAME_STATE_2; |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1470
diff
changeset
|
5640 strcpy(pCurrentMapName, v2); |
783 | 5641 uLevel_StartingPointType = start_point; |
0 | 5642 } |
5643 // 6BE35C: using guessed type int uLevel_StartingPointType; | |
5644 | |
5645 //----- (004498D5) -------------------------------------------------------- | |
783 | 5646 void TeleportToStartingPoint(MapStartPoint point) |
5647 { | |
5648 //unsigned int v1; // ecx@2 | |
5649 //int v2; // ecx@3 | |
5650 //int v3; // ecx@4 | |
0 | 5651 unsigned __int16 v4; // ax@11 |
5652 signed int v5; // ecx@12 | |
5653 LevelDecoration *v6; // edx@13 | |
5654 signed int v7; // ecx@17 | |
5655 int v8; // eax@17 | |
5656 int v9; // ecx@17 | |
5657 const char *v10; // [sp-4h] [bp-84h]@6 | |
5658 char pName[128]; // [sp+8h] [bp-78h]@11 | |
5659 | |
783 | 5660 switch (point) |
5661 { | |
5662 case MapStartPoint_Party: v10 = "Party Start"; break; | |
5663 case MapStartPoint_North: v10 = "North Start"; break; | |
5664 case MapStartPoint_South: v10 = "South Start"; break; | |
5665 case MapStartPoint_East: v10 = "East Start"; break; | |
5666 case MapStartPoint_West: v10 = "West Start"; break; | |
1546 | 5667 default: |
5668 Error("Invalid enum value: %u", point); | |
783 | 5669 } |
5670 | |
0 | 5671 strcpy(pName, v10); |
5672 v4 = pDecorationList->GetDecorIdByName(pName); | |
5673 if ( v4 ) | |
5674 { | |
5675 v5 = 0; | |
5676 if ( (signed int)uNumLevelDecorations > 0 ) | |
5677 { | |
1202 | 5678 v6 = pLevelDecorations.data(); |
0 | 5679 while ( v6->uDecorationDescID != (signed __int16)v4 ) |
5680 { | |
5681 ++v5; | |
5682 ++v6; | |
5683 if ( v5 >= (signed int)uNumLevelDecorations ) | |
5684 goto LABEL_20; | |
5685 } | |
5686 v7 = v5; | |
5687 pParty->vPosition.x = pLevelDecorations[v7].vPosition.x; | |
5688 pParty->vPosition.y = pLevelDecorations[v7].vPosition.y; | |
5689 pParty->vPosition.z = pLevelDecorations[v7].vPosition.z; | |
5690 pParty->uFallStartY = pParty->vPosition.z; | |
5691 v8 = (signed int)(stru_5C6E00->uIntegerHalfPi * pLevelDecorations[v7].field_1A) / 90; | |
5692 v9 = pLevelDecorations[v7].field_10_y_rot; | |
5693 pParty->sRotationY = v8; | |
5694 if ( v9 ) | |
5695 pParty->sRotationY = v9; | |
5696 pParty->sRotationX = 0; | |
5697 pParty->uFallSpeed = 0; | |
5698 } | |
5699 LABEL_20: | |
5700 if ( dword_5B65C0 ) | |
5701 { | |
5702 if ( _5B65A8_npcdata_uflags_or_other ) | |
5703 pParty->vPosition.x = _5B65A8_npcdata_uflags_or_other; | |
5704 if ( _5B65AC_npcdata_fame_or_other ) | |
5705 pParty->vPosition.y = _5B65AC_npcdata_fame_or_other; | |
5706 if ( _5B65B0_npcdata_rep_or_other ) | |
5707 { | |
5708 pParty->vPosition.z = _5B65B0_npcdata_rep_or_other; | |
5709 pParty->uFallStartY = _5B65B0_npcdata_rep_or_other; | |
5710 } | |
1516
f3cd08b89476
Fix assertion error when exiting Harmondale's castle. Possibly original bug.
yoctozepto
parents:
1515
diff
changeset
|
5711 if ( _5B65B4_npcdata_loword_house_or_other != -1 ) |
0 | 5712 pParty->sRotationY = _5B65B4_npcdata_loword_house_or_other; |
5713 if ( _5B65B8_npcdata_hiword_house_or_other ) | |
5714 pParty->sRotationX = _5B65B8_npcdata_hiword_house_or_other; | |
5715 if ( dword_5B65BC ) | |
5716 pParty->uFallSpeed = dword_5B65BC; | |
5717 } | |
5718 _5B65B4_npcdata_loword_house_or_other = -1; | |
5719 dword_5B65C0 = 0; | |
5720 dword_5B65BC = 0; | |
5721 _5B65B8_npcdata_hiword_house_or_other = 0; | |
5722 _5B65B0_npcdata_rep_or_other = 0; | |
5723 _5B65AC_npcdata_fame_or_other = 0; | |
5724 _5B65A8_npcdata_uflags_or_other = 0; | |
5725 } | |
5726 } | |
1035 | 5727 |
5728 | |
0 | 5729 |
5730 //----- (00449A49) -------------------------------------------------------- | |
5731 __int16 __fastcall sub_449A49_door_switch_animation(unsigned int uDoorID, int a2) | |
5732 { | |
5733 int v2; // eax@1 | |
5734 int v3; // ebx@1 | |
5735 signed int v4; // esi@2 | |
5736 int v5; // edx@2 | |
5737 BLVDoor *v6; // ecx@8 | |
5738 unsigned int v7; // edx@18 | |
5739 signed int v8; // esi@19 | |
5740 int v9; // eax@19 | |
1545 | 5741 //char Args; // [sp+Ch] [bp-78h]@6 |
0 | 5742 |
5743 LOWORD(v2) = LOWORD(pIndoor->pDoors); | |
5744 v3 = a2; | |
5745 if ( !pIndoor->pDoors ) | |
5746 return v2; | |
5747 v4 = 0; | |
5748 v5 = (int)&pIndoor->pDoors->uDoorID; | |
5749 do | |
5750 { | |
5751 if ( *(int *)v5 == uDoorID ) | |
5752 break; | |
5753 ++v4; | |
5754 v5 += 80; | |
5755 } | |
5756 while ( v4 < 200 ); | |
5757 if ( v4 >= 200 ) | |
5758 { | |
1545 | 5759 Error("Unable to find Door ID: %i!", uDoorID); |
0 | 5760 } |
5761 v6 = &pIndoor->pDoors[v4]; | |
5762 if ( v3 == 2 ) | |
5763 { | |
5764 LOWORD(v2) = v6->uState; | |
5765 if ( (short)v2 == 3 || (short)v2 == 1 ) | |
5766 return v2; | |
5767 if ( (short)v2 ) | |
5768 goto LABEL_14; | |
5769 } | |
5770 else | |
5771 { | |
5772 if ( !v3 ) | |
5773 { | |
5774 LABEL_14: | |
5775 LOWORD(v2) = v6->uState; | |
5776 if ( (short)v2 && (short)v2 != 3 ) | |
5777 { | |
5778 v6->uState = BLVDoor::Closing; | |
5779 if ( (short)v2 == 2 ) | |
5780 { | |
5781 LABEL_17: | |
5782 v6->uTimeSinceTriggered = 0; | |
5783 return v2; | |
5784 } | |
5785 v7 = v6->uTimeSinceTriggered; | |
5786 v2 = 15360; | |
5787 if ( v7 != 15360 ) | |
5788 { | |
5789 v8 = v6->uOpenSpeed; | |
5790 v9 = v6->uCloseSpeed; | |
5791 LABEL_26: | |
5792 v2 = (v6->uMoveLength << 7) / v8 - ((signed int)(v7 * v9) / 128 << 7) / v8; | |
5793 goto LABEL_27; | |
5794 } | |
5795 goto LABEL_27; | |
5796 } | |
5797 return v2; | |
5798 } | |
5799 if ( v3 != 1 ) | |
5800 return v2; | |
5801 } | |
5802 LOWORD(v2) = v6->uState; | |
5803 if ( (short)v2 != 2 && (short)v2 != 1 ) | |
5804 { | |
5805 v6->uState = BLVDoor::Opening; | |
5806 if ( !(short)v2 ) | |
5807 goto LABEL_17; | |
5808 v7 = v6->uTimeSinceTriggered; | |
5809 v2 = 15360; | |
5810 if ( v7 != 15360 ) | |
5811 { | |
5812 v8 = v6->uCloseSpeed; | |
5813 v9 = v6->uOpenSpeed; | |
5814 goto LABEL_26; | |
5815 } | |
5816 LABEL_27: | |
5817 v6->uTimeSinceTriggered = v2; | |
5818 } | |
5819 return v2; | |
5820 } | |
5821 | |
5822 //----- (00449B57) -------------------------------------------------------- | |
521 | 5823 bool _449B57_test_bit( unsigned __int8 *a1, __int16 a2 ) |
1035 | 5824 { |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1112
diff
changeset
|
5825 return (a1[(a2 - 1) >> 3] & (0x80u >> (a2 - 1) % 8)) != 0; |
0 | 5826 } |
5827 | |
5828 //----- (00449B7E) -------------------------------------------------------- | |
501 | 5829 void _449B7E_toggle_bit(unsigned char *pArray, __int16 a2, unsigned __int16 bToggle) |
0 | 5830 { |
5831 signed int v3; // esi@1 | |
501 | 5832 unsigned char set_bit; // edx@1 |
0 | 5833 |
5834 v3 = a2 - 1; | |
501 | 5835 set_bit = 0x80 >> v3 % 8; |
0 | 5836 if ( bToggle ) |
501 | 5837 pArray[v3 / 8] |= set_bit; |
5838 else | |
5839 pArray[v3 / 8] &= ~set_bit; | |
0 | 5840 } |
5841 | |
5842 //----- (0044C175) -------------------------------------------------------- | |
1160 | 5843 void ShowStatusBarString( const char *pString, unsigned int uNumSeconds ) |
1546 | 5844 { |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
5845 strcpy(GameUI_Footer_TimedString.data(), pString); |
1546 | 5846 GameUI_Footer_TimeLeft = 1000 * uNumSeconds + GetTickCount(); |
5847 | |
5848 for (int i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()); | |
0 | 5849 i > 450; |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
5850 i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()) ) |
1470 | 5851 GameUI_Footer_TimedString[strlen(GameUI_Footer_TimedString.data()) - 1] = 0; |
0 | 5852 } |
5853 | |
5854 //----- (0044C1D0) -------------------------------------------------------- | |
1035 | 5855 void ShowNothingHereStatus() |
0 | 5856 { |
783 | 5857 if ( !GameUI_Footer_TimeLeft ) |
1546 | 5858 ShowStatusBarString(pGlobalTXT_LocalizationStrings[521], 2);// Nothing here |
0 | 5859 } |
5860 | |
5861 //----- (0044C28B) -------------------------------------------------------- | |
1459 | 5862 int const_2() |
0 | 5863 { |
5864 return 2; | |
5865 } | |
5866 | |
5867 //----- (0044C28F) -------------------------------------------------------- | |
1459 | 5868 bool TeleportToNWCDungeon() |
0 | 5869 { |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1470
diff
changeset
|
5870 if (!_stricmp("nwc.blv", pCurrentMapName)) |
1459 | 5871 return false; |
5872 | |
5873 _5B65A8_npcdata_uflags_or_other = 0; | |
5874 _5B65AC_npcdata_fame_or_other = 0; | |
5875 _5B65B0_npcdata_rep_or_other = 0; | |
5876 _5B65B4_npcdata_loword_house_or_other = 0; | |
5877 _5B65B8_npcdata_hiword_house_or_other = 0; | |
5878 dword_5B65BC = 0; | |
5879 dword_5B65C0 = 0; | |
5880 | |
5881 pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen; | |
5882 sub_44987B("nwc.blv", MapStartPoint_Party); | |
5883 pCurrentScreen = SCREEN_GAME; | |
5884 return true; | |
0 | 5885 } |
5886 | |
5887 //----- (00401000) -------------------------------------------------------- | |
1458 | 5888 void mm7__vector_constructor(void *a1, int objSize, int numObjs, int ( *constructor)(int)) |
0 | 5889 { |
5890 void *v4; // esi@2 | |
5891 int v5; // edi@2 | |
5892 | |
5893 if ( numObjs - 1 >= 0 ) | |
5894 { | |
5895 v4 = a1; | |
5896 v5 = numObjs; | |
5897 do | |
5898 { | |
5899 constructor((int)v4); | |
5900 v4 = (char *)v4 + objSize; | |
5901 --v5; | |
5902 } | |
5903 while ( v5 ); | |
5904 } | |
5905 } | |
5906 | |
5907 //----- (0040261D) -------------------------------------------------------- | |
1546 | 5908 void stru298::Add(__int16 uID, __int16 a3, __int16 x, __int16 y, __int16 z, char a7, char a8) |
0 | 5909 { |
1546 | 5910 if (count < 100) |
5911 { | |
5912 pIDs[count] = uID; | |
5913 pXs[count] = x; | |
5914 pYs[count] = y; | |
5915 pZs[count] = z; | |
5916 field_324[count] = a3; | |
5917 field_3EC[count] = a8; | |
5918 field_450[count++] = a7; | |
5919 } | |
0 | 5920 } |
5921 | |
5922 //----- (00402CAE) -------------------------------------------------------- | |
323 | 5923 int stru193_math::Cos(int angle) |
0 | 5924 { |
5925 int v2; // eax@1 | |
5926 | |
5927 //a2: (angle - uIntegerHalfPi) for sin(angle) | |
5928 // (angle) for cos(angle) | |
5929 | |
5930 v2 = uDoublePiMask & angle; | |
5931 | |
5932 if ( v2 > uIntegerPi ) | |
5933 v2 = uIntegerDoublePi - v2; | |
5934 if ( v2 >= uIntegerHalfPi ) | |
5935 return -pCosTable[uIntegerPi - v2]; | |
5936 else | |
5937 return pCosTable[v2]; | |
5938 } | |
5939 |