Mercurial > mm7
annotate mm7_3.cpp @ 2370:bbf8a522dcec
removing non-nullptr conditions before deletes
author | Grumpy7 |
---|---|
date | Mon, 12 May 2014 01:55:23 +0200 |
parents | bddcaf5d5db2 |
children | b4a79e3ef2f0 |
rev | line source |
---|---|
2253
aff7a7b072b7
adding _CRT_SECURE_NO_WARNINGS to get rid of a few hundrer annoying warnings + adding count parameter to swprintf
Grumpy7
parents:
2242
diff
changeset
|
1 #define _CRT_SECURE_NO_WARNINGS |
2336 | 2 #include "ErrorHandling.h" |
1323 | 3 #include "Weather.h" |
1016 | 4 #include "Sprites.h" |
5 #include "stru6.h" | |
0 | 6 #include "MapInfo.h" |
7 #include "Game.h" | |
8 #include "GUIWindow.h" | |
9 #include "GUIFont.h" | |
10 #include "GUIProgressBar.h" | |
11 #include "Party.h" | |
12 #include "AudioPlayer.h" | |
13 #include "Outdoor.h" | |
1277 | 14 #include "Outdoor_stuff.h" |
0 | 15 #include "Overlays.h" |
16 #include "LOD.h" | |
2337
d04017f3d2fa
LightsStack_StationaryLight_::AddLight moved to LightStack.cpp
Grumpy7
parents:
2336
diff
changeset
|
17 #include "Log.h" |
0 | 18 #include "Actor.h" |
19 #include "Events.h" | |
20 #include "Viewport.h" | |
2037
7a9477135943
Renamed Math.h -> OurMath.h (file resolution was sometimes ambiguous)
Nomad
parents:
2030
diff
changeset
|
21 #include "OurMath.h" |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
22 #include "SpriteObject.h" |
0 | 23 #include "ObjectList.h" |
24 #include "PaletteManager.h" | |
25 #include "DecorationList.h" | |
2044 | 26 #include "Timer.h" |
0 | 27 #include "TurnEngine.h" |
28 #include "Events2D.h" | |
29 #include "stru176.h" | |
30 #include "stru298.h" | |
189 | 31 #include "texts.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
|
32 #include "Level/Decoration.h" |
2336 | 33 #include "mm7_unsorted_subs.h" |
34 #include "mm7_data.h" | |
2343 | 35 #include "SaveLoad.h" |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
36 |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
824
diff
changeset
|
37 #include "MM7.h" |
0 | 38 |
2205 | 39 |
40 //----- (0044100D) -------------------------------------------------------- | |
41 bool _44100D_should_alter_right_panel() | |
42 { | |
43 return pCurrentScreen == SCREEN_NPC_DIALOGUE || pCurrentScreen == SCREEN_CHARACTERS || | |
44 pCurrentScreen == SCREEN_HOUSE || pCurrentScreen == SCREEN_E || | |
45 pCurrentScreen == SCREEN_CHANGE_LOCATION || pCurrentScreen == SCREEN_INPUT_BLV || pCurrentScreen == SCREEN_CASTING; | |
46 } | |
47 | |
48 | |
0 | 49 //----- (0046E44E) -------------------------------------------------------- |
1458 | 50 int _46E44E_collide_against_faces_and_portals(unsigned int b1) |
0 | 51 { |
717 | 52 BLVSector *pSector; // edi@1 |
0 | 53 signed int v2; // ebx@1 |
717 | 54 BLVFace *pFace; // esi@2 |
55 __int16 pNextSector; // si@10 | |
56 int pArrayNum; // ecx@12 | |
0 | 57 unsigned __int8 v6; // sf@12 |
58 unsigned __int8 v7; // of@12 | |
59 int result; // eax@14 | |
2085 | 60 //int v10; // ecx@15 |
717 | 61 int pFloor; // eax@16 |
0 | 62 int v15; // eax@24 |
63 int v16; // edx@25 | |
64 int v17; // eax@29 | |
65 unsigned int v18; // eax@33 | |
66 int v21; // eax@35 | |
67 int v22; // ecx@36 | |
68 int v23; // eax@40 | |
69 unsigned int v24; // eax@44 | |
70 int a3; // [sp+10h] [bp-48h]@28 | |
71 int v26; // [sp+14h] [bp-44h]@15 | |
72 int i; // [sp+18h] [bp-40h]@1 | |
73 int a10; // [sp+1Ch] [bp-3Ch]@1 | |
74 int v29; // [sp+20h] [bp-38h]@14 | |
75 int v32; // [sp+2Ch] [bp-2Ch]@15 | |
717 | 76 int pSectorsArray[10]; // [sp+30h] [bp-28h]@1 |
77 | |
78 pSector = &pIndoor->pSectors[stru_721530.uSectorID]; | |
2085 | 79 i = 1; |
0 | 80 a10 = b1; |
717 | 81 pSectorsArray[0] = stru_721530.uSectorID; |
2085 | 82 for ( v2 = 0; v2 < pSector->uNumPortals; ++v2 ) |
717 | 83 { |
84 pFace = &pIndoor->pFaces[pSector->pPortals[v2]]; | |
2085 | 85 if ( stru_721530.sMaxX <= pFace->pBounding.x2 && stru_721530.sMinX >= pFace->pBounding.x1 |
86 && stru_721530.sMaxY <= pFace->pBounding.y2 && stru_721530.sMinY >= pFace->pBounding.y1 | |
87 && stru_721530.sMaxZ <= pFace->pBounding.z2 && stru_721530.sMinZ >= pFace->pBounding.z1 | |
717 | 88 && abs((pFace->pFacePlane_old.dist |
89 + stru_721530.normal.x * pFace->pFacePlane_old.vNormal.x | |
90 + stru_721530.normal.y * pFace->pFacePlane_old.vNormal.y | |
91 + stru_721530.normal.z * pFace->pFacePlane_old.vNormal.z) >> 16) <= stru_721530.field_6C + 16 ) | |
92 { | |
93 pNextSector = pFace->uSectorID == stru_721530.uSectorID ? pFace->uBackSectorID : pFace->uSectorID;//FrontSectorID | |
94 pArrayNum = i++; | |
95 v7 = i < 10; | |
0 | 96 v6 = i - 10 < 0; |
717 | 97 pSectorsArray[pArrayNum] = pNextSector; |
0 | 98 if ( !(v6 ^ v7) ) |
99 break; | |
100 } | |
101 } | |
102 result = 0; | |
2085 | 103 for ( v29 = 0; v29 < i; v29++ ) |
0 | 104 { |
2085 | 105 pSector = &pIndoor->pSectors[pSectorsArray[v29]]; |
106 v32 = pSector->uNumFloors + pSector->uNumWalls + pSector->uNumCeilings; | |
107 for ( v26 = 0; v26 < v32; v26++ ) | |
0 | 108 { |
2085 | 109 pFloor = pSector->pFloors[v26]; |
110 pFace = &pIndoor->pFaces[pSector->pFloors[v26]]; | |
111 if ( !pFace->Portal() | |
112 && stru_721530.sMaxX <= pFace->pBounding.x2 && stru_721530.sMinX >= pFace->pBounding.x1 | |
113 && stru_721530.sMaxY <= pFace->pBounding.y2 && stru_721530.sMinY >= pFace->pBounding.y1 | |
114 && stru_721530.sMaxZ <= pFace->pBounding.z2 && stru_721530.sMinZ >= pFace->pBounding.z1 | |
115 && pFloor != stru_721530.field_84 ) | |
116 { | |
117 v15 = ( pFace->pFacePlane_old.dist + stru_721530.normal.x * pFace->pFacePlane_old.vNormal.x | |
118 + stru_721530.normal.y * pFace->pFacePlane_old.vNormal.y | |
119 + stru_721530.normal.z * pFace->pFacePlane_old.vNormal.z ) >> 16; | |
0 | 120 if ( v15 > 0 ) |
121 { | |
2085 | 122 v16 = ( pFace->pFacePlane_old.dist + stru_721530.normal2.x * pFace->pFacePlane_old.vNormal.x |
123 + stru_721530.normal2.y * pFace->pFacePlane_old.vNormal.y | |
124 + stru_721530.normal2.z * pFace->pFacePlane_old.vNormal.z ) >> 16; | |
0 | 125 if ( v15 <= stru_721530.prolly_normal_d || v16 <= stru_721530.prolly_normal_d ) |
126 { | |
127 if ( v16 <= v15 ) | |
128 { | |
129 a3 = stru_721530.field_6C; | |
717 | 130 if ( sub_47531C(stru_721530.prolly_normal_d, &a3, stru_721530.normal.x, stru_721530.normal.y, stru_721530.normal.z, |
2085 | 131 stru_721530.direction.x, stru_721530.direction.y, stru_721530.direction.z, pFace, a10) ) |
0 | 132 { |
133 v17 = a3; | |
134 } | |
135 else | |
136 { | |
137 a3 = stru_721530.field_6C + stru_721530.prolly_normal_d; | |
1546 | 138 if ( !sub_475D85(&stru_721530.normal, &stru_721530.direction, &a3, pFace) ) |
0 | 139 goto LABEL_34; |
140 v17 = a3 - stru_721530.prolly_normal_d; | |
141 a3 -= stru_721530.prolly_normal_d; | |
142 } | |
143 if ( v17 < stru_721530.field_7C ) | |
144 { | |
145 stru_721530.field_7C = v17; | |
717 | 146 v18 = 8 * pSector->pFloors[v26]; |
0 | 147 LOBYTE(v18) = v18 | 6; |
148 stru_721530.uFaceID = v18; | |
149 } | |
150 } | |
151 } | |
152 } | |
153 LABEL_34: | |
154 if ( !(stru_721530.field_0 & 1) | |
2085 | 155 || (v21 = ( pFace->pFacePlane_old.dist + stru_721530.position.x * pFace->pFacePlane_old.vNormal.x |
156 + stru_721530.position.y * pFace->pFacePlane_old.vNormal.y | |
157 + stru_721530.position.z * pFace->pFacePlane_old.vNormal.z) >> 16, v21 <= 0) | |
158 || (v22 = ( pFace->pFacePlane_old.dist + stru_721530.field_4C * pFace->pFacePlane_old.vNormal.x | |
159 + stru_721530.field_50 * pFace->pFacePlane_old.vNormal.y | |
160 + stru_721530.field_54 * pFace->pFacePlane_old.vNormal.z) >> 16, v21 > stru_721530.prolly_normal_d) | |
161 && v22 > stru_721530.prolly_normal_d || v22 > v21 ) | |
162 continue; | |
0 | 163 a3 = stru_721530.field_6C; |
1546 | 164 if ( sub_47531C(stru_721530.field_8_radius, &a3, stru_721530.position.x, stru_721530.position.y, stru_721530.position.z, |
165 stru_721530.direction.x, stru_721530.direction.y, stru_721530.direction.z, pFace, a10) ) | |
0 | 166 { |
167 v23 = a3; | |
168 goto LABEL_43; | |
169 } | |
1546 | 170 a3 = stru_721530.field_6C + stru_721530.field_8_radius; |
171 if ( sub_475D85(&stru_721530.position, &stru_721530.direction, &a3, pFace) ) | |
0 | 172 { |
173 v23 = a3 - stru_721530.prolly_normal_d; | |
174 a3 -= stru_721530.prolly_normal_d; | |
175 LABEL_43: | |
176 if ( v23 < stru_721530.field_7C ) | |
177 { | |
178 stru_721530.field_7C = v23; | |
717 | 179 v24 = 8 * pSector->pFloors[v26]; |
0 | 180 LOBYTE(v24) = v24 | 6; |
181 stru_721530.uFaceID = v24; | |
182 } | |
183 } | |
2085 | 184 } |
0 | 185 } |
2085 | 186 result = v29 + 1; |
0 | 187 } |
188 return result; | |
189 } | |
190 // 46E44E: using guessed type int var_28[10]; | |
191 | |
192 //----- (0046E889) -------------------------------------------------------- | |
193 int __fastcall _46E889_collide_against_bmodels(unsigned int ecx0) | |
194 { | |
195 int result; // eax@1 | |
2148 | 196 //int v3; // ebx@9 |
0 | 197 int v8; // eax@19 |
198 int v9; // ecx@20 | |
199 int v10; // eax@24 | |
200 unsigned int v14; // eax@28 | |
201 int v15; // eax@30 | |
202 int v16; // ecx@31 | |
203 unsigned int v17; // eax@36 | |
204 int v21; // eax@42 | |
205 unsigned int v22; // eax@43 | |
2148 | 206 //int a11; // [sp+70h] [bp-18h]@1 |
207 //int a10; // [sp+80h] [bp-8h]@1 | |
0 | 208 int a2; // [sp+84h] [bp-4h]@23 |
209 | |
2148 | 210 //a11 = ecx0; |
0 | 211 |
2101 | 212 BLVFace face; // [sp+Ch] [bp-7Ch]@1 |
0 | 213 |
214 result = 0; | |
2148 | 215 for ( uint i = 0; i < (signed int)pOutdoor->uNumBModels; ++i ) |
0 | 216 { |
2148 | 217 if ( stru_721530.sMaxX <= pOutdoor->pBModels[i].sMaxX && stru_721530.sMinX >= pOutdoor->pBModels[i].sMinX |
218 && stru_721530.sMaxY <= pOutdoor->pBModels[i].sMaxY && stru_721530.sMinY >= pOutdoor->pBModels[i].sMinY | |
219 && stru_721530.sMaxZ <= pOutdoor->pBModels[i].sMaxZ && stru_721530.sMinZ >= pOutdoor->pBModels[i].sMinZ ) | |
0 | 220 { |
2148 | 221 for ( uint j = 0; j < pOutdoor->pBModels[i].uNumFaces; ++j ) |
0 | 222 { |
2148 | 223 if ( stru_721530.sMaxX <= pOutdoor->pBModels[i].pFaces[j].pBoundingBox.x2 && stru_721530.sMinX >= pOutdoor->pBModels[i].pFaces[j].pBoundingBox.x1 |
224 && stru_721530.sMaxY <= pOutdoor->pBModels[i].pFaces[j].pBoundingBox.y2 && stru_721530.sMinY >= pOutdoor->pBModels[i].pFaces[j].pBoundingBox.y1 | |
225 && stru_721530.sMaxZ <= pOutdoor->pBModels[i].pFaces[j].pBoundingBox.z2 && stru_721530.sMinZ >= pOutdoor->pBModels[i].pFaces[j].pBoundingBox.z1 ) | |
0 | 226 { |
2148 | 227 face.pFacePlane_old.vNormal.x = pOutdoor->pBModels[i].pFaces[j].pFacePlane.vNormal.x; |
228 face.pFacePlane_old.vNormal.y = pOutdoor->pBModels[i].pFaces[j].pFacePlane.vNormal.y; | |
229 face.pFacePlane_old.vNormal.z = pOutdoor->pBModels[i].pFaces[j].pFacePlane.vNormal.z; | |
230 | |
231 face.pFacePlane_old.dist = pOutdoor->pBModels[i].pFaces[j].pFacePlane.dist; //incorrect | |
232 | |
233 face.uAttributes = pOutdoor->pBModels[i].pFaces[j].uAttributes; | |
234 | |
235 face.pBounding.x1 = pOutdoor->pBModels[i].pFaces[j].pBoundingBox.x1; | |
236 face.pBounding.y1 = pOutdoor->pBModels[i].pFaces[j].pBoundingBox.y1; | |
237 face.pBounding.z1 = pOutdoor->pBModels[i].pFaces[j].pBoundingBox.z1; | |
238 | |
239 face.pBounding.x2 = pOutdoor->pBModels[i].pFaces[j].pBoundingBox.x2; | |
240 face.pBounding.y2 = pOutdoor->pBModels[i].pFaces[j].pBoundingBox.y2; | |
241 face.pBounding.z2 = pOutdoor->pBModels[i].pFaces[j].pBoundingBox.z2; | |
242 | |
243 face.zCalc1 = pOutdoor->pBModels[i].pFaces[j].zCalc1; | |
244 face.zCalc2 = pOutdoor->pBModels[i].pFaces[j].zCalc2; | |
245 face.zCalc3 = pOutdoor->pBModels[i].pFaces[j].zCalc3; | |
246 | |
247 face.pXInterceptDisplacements = pOutdoor->pBModels[i].pFaces[j].pXInterceptDisplacements; | |
248 face.pYInterceptDisplacements = pOutdoor->pBModels[i].pFaces[j].pYInterceptDisplacements; | |
249 face.pZInterceptDisplacements = pOutdoor->pBModels[i].pFaces[j].pZInterceptDisplacements; | |
250 | |
251 face.uPolygonType = (PolygonType)pOutdoor->pBModels[i].pFaces[j].uPolygonType; | |
252 | |
253 face.uNumVertices = pOutdoor->pBModels[i].pFaces[j].uNumVertices; | |
254 | |
255 face.uBitmapID = pOutdoor->pBModels[i].pFaces[j].uTextureID; | |
256 | |
257 face.pVertexIDs = pOutdoor->pBModels[i].pFaces[j].pVertexIDs; | |
258 | |
2101 | 259 if ( !face.Ethereal() && !face.Portal() ) |
0 | 260 { |
2101 | 261 v8 = (face.pFacePlane_old.dist + face.pFacePlane_old.vNormal.x * stru_721530.normal.x |
262 + face.pFacePlane_old.vNormal.y * stru_721530.normal.y | |
263 + face.pFacePlane_old.vNormal.z * stru_721530.normal.z ) >> 16; | |
2085 | 264 if ( v8 > 0 ) |
0 | 265 { |
2101 | 266 v9 = (face.pFacePlane_old.dist + face.pFacePlane_old.vNormal.x * stru_721530.normal2.x |
267 + face.pFacePlane_old.vNormal.y * stru_721530.normal2.y | |
268 + face.pFacePlane_old.vNormal.z * stru_721530.normal2.z) >> 16; | |
2085 | 269 if ( v8 <= stru_721530.prolly_normal_d || v9 <= stru_721530.prolly_normal_d ) |
0 | 270 { |
2085 | 271 if ( v9 <= v8 ) |
0 | 272 { |
2085 | 273 a2 = stru_721530.field_6C; |
274 if ( sub_4754BF(stru_721530.prolly_normal_d, &a2, stru_721530.normal.x, stru_721530.normal.y, stru_721530.normal.z, | |
2148 | 275 stru_721530.direction.x, stru_721530.direction.y, stru_721530.direction.z, &face, i, ecx0) ) |
2085 | 276 { |
277 v10 = a2; | |
278 } | |
279 else | |
280 { | |
281 a2 = stru_721530.prolly_normal_d + stru_721530.field_6C; | |
2101 | 282 if ( !sub_475F30( &a2, &face, stru_721530.normal.x, stru_721530.normal.y, stru_721530.normal.z, |
2148 | 283 stru_721530.direction.x, stru_721530.direction.y, stru_721530.direction.z, i) ) |
2085 | 284 goto LABEL_29; |
285 v10 = a2 - stru_721530.prolly_normal_d; | |
286 a2 -= stru_721530.prolly_normal_d; | |
287 } | |
288 if ( v10 < stru_721530.field_7C ) | |
289 { | |
290 stru_721530.field_7C = v10; | |
2148 | 291 v14 = 8 * (j | (i << 6)); |
2085 | 292 LOBYTE(v14) = v14 | 6; |
293 stru_721530.uFaceID = v14; | |
294 } | |
295 } | |
296 } | |
297 } | |
298 LABEL_29: | |
299 if ( stru_721530.field_0 & 1 ) | |
300 { | |
2101 | 301 v15 = (face.pFacePlane_old.dist + face.pFacePlane_old.vNormal.x * stru_721530.position.x |
302 + face.pFacePlane_old.vNormal.y * stru_721530.position.y | |
303 + face.pFacePlane_old.vNormal.z * stru_721530.position.z) >> 16; | |
2085 | 304 if ( v15 > 0 ) |
305 { | |
2101 | 306 v16 = (face.pFacePlane_old.dist + face.pFacePlane_old.vNormal.x * stru_721530.field_4C |
307 + face.pFacePlane_old.vNormal.y * stru_721530.field_50 | |
308 + face.pFacePlane_old.vNormal.z * stru_721530.field_54) >> 16; | |
2085 | 309 if ( v15 <= stru_721530.prolly_normal_d || v16 <= stru_721530.prolly_normal_d ) |
310 { | |
311 if ( v16 <= v15 ) | |
312 { | |
313 a2 = stru_721530.field_6C; | |
314 if ( sub_4754BF(stru_721530.field_8_radius, &a2, stru_721530.position.x, stru_721530.position.y, stru_721530.position.z, | |
2148 | 315 stru_721530.direction.x, stru_721530.direction.y, stru_721530.direction.z, &face, i, ecx0) ) |
2085 | 316 { |
317 if ( a2 < stru_721530.field_7C ) | |
318 { | |
319 stru_721530.field_7C = a2; | |
2148 | 320 v17 = 8 * (j | (i << 6)); |
2085 | 321 LOBYTE(v17) = v17 | 6; |
322 stru_721530.uFaceID = v17; | |
323 } | |
324 } | |
325 else | |
326 { | |
327 a2 = stru_721530.field_6C + stru_721530.field_8_radius; | |
2101 | 328 if ( sub_475F30(&a2, &face, stru_721530.position.x, stru_721530.position.y, stru_721530.position.z, |
2148 | 329 stru_721530.direction.x, stru_721530.direction.y, stru_721530.direction.z, i) ) |
2085 | 330 { |
331 v21 = a2 - stru_721530.prolly_normal_d; | |
332 a2 -= stru_721530.prolly_normal_d; | |
333 if ( a2 < stru_721530.field_7C ) | |
334 { | |
335 stru_721530.field_7C = v21; | |
2148 | 336 v22 = 8 * (j | (i << 6)); |
2085 | 337 LOBYTE(v22) = v22 | 6; |
338 stru_721530.uFaceID = v22; | |
339 } | |
340 } | |
341 } | |
342 } | |
0 | 343 } |
344 } | |
345 } | |
346 } | |
347 } | |
348 } | |
349 } | |
2148 | 350 result = i; |
0 | 351 } |
352 return result; | |
353 } | |
354 | |
355 //----- (0046ED1B) -------------------------------------------------------- | |
783 | 356 int collide_against_floor(int x, int y, int z, unsigned int *pSectorID, unsigned int *pFaceID) |
0 | 357 { |
358 uint uFaceID = -1; | |
723 | 359 int floor_level = BLV_GetFloorLevel(x, y, z, *pSectorID, &uFaceID); |
0 | 360 |
361 if (floor_level != -30000 && floor_level <= z + 50) | |
362 { | |
363 *pFaceID = uFaceID; | |
364 return floor_level; | |
365 } | |
366 | |
367 uint uSectorID = pIndoor->GetSector(x, y, z); | |
368 *pSectorID = uSectorID; | |
369 | |
723 | 370 floor_level = BLV_GetFloorLevel(x, y, z, uSectorID, &uFaceID); |
0 | 371 if (uSectorID && floor_level != -30000) |
372 *pFaceID = uFaceID; | |
373 else return -30000; | |
374 return floor_level; | |
375 } | |
376 | |
377 //----- (0046ED8A) -------------------------------------------------------- | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
378 void __fastcall _46ED8A_collide_against_sprite_objects(unsigned int _this) |
0 | 379 { |
2085 | 380 ObjectDesc *object; // edx@4 |
0 | 381 int v10; // ecx@12 |
382 int v11; // esi@13 | |
2085 | 383 |
2101 | 384 for ( uint i = 0; i < uNumSpriteObjects; ++i ) |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
385 { |
2101 | 386 if ( pSpriteObjects[i].uObjectDescID ) |
0 | 387 { |
2101 | 388 object = &pObjectList->pObjects[pSpriteObjects[i].uObjectDescID]; |
389 if ( !(object->uFlags & OBJECT_DESC_NO_COLLISION) ) | |
0 | 390 { |
2101 | 391 if ( stru_721530.sMaxX <= pSpriteObjects[i].vPosition.x + object->uRadius && stru_721530.sMinX >= pSpriteObjects[i].vPosition.x - object->uRadius |
392 && stru_721530.sMaxY <= pSpriteObjects[i].vPosition.y + object->uRadius && stru_721530.sMinY >= pSpriteObjects[i].vPosition.y - object->uRadius | |
393 && stru_721530.sMaxZ <= pSpriteObjects[i].vPosition.z + object->uHeight && stru_721530.sMinZ >= pSpriteObjects[i].vPosition.z ) | |
0 | 394 { |
2101 | 395 if ( abs(((pSpriteObjects[i].vPosition.x - stru_721530.normal.x) * stru_721530.direction.y |
396 - (pSpriteObjects[i].vPosition.y - stru_721530.normal.y) * stru_721530.direction.x) >> 16) | |
397 <= object->uHeight + stru_721530.prolly_normal_d ) | |
0 | 398 { |
2101 | 399 v10 = ((pSpriteObjects[i].vPosition.x - stru_721530.normal.x) * stru_721530.direction.x |
400 + (pSpriteObjects[i].vPosition.y - stru_721530.normal.y) * stru_721530.direction.y) >> 16; | |
401 if ( v10 > 0 ) | |
0 | 402 { |
2101 | 403 v11 = stru_721530.normal.z + ((unsigned __int64)(stru_721530.direction.z * (signed __int64)v10) >> 16); |
404 if ( v11 >= pSpriteObjects[i].vPosition.z - stru_721530.prolly_normal_d ) | |
0 | 405 { |
2101 | 406 if ( v11 <= object->uHeight + stru_721530.prolly_normal_d + pSpriteObjects[i].vPosition.z ) |
0 | 407 { |
2101 | 408 if ( v10 < stru_721530.field_7C ) |
409 sub_46DEF2(_this, i); | |
0 | 410 } |
411 } | |
412 } | |
413 } | |
414 } | |
415 } | |
416 } | |
417 } | |
418 } | |
419 | |
420 //----- (0046EF01) -------------------------------------------------------- | |
1546 | 421 int _46EF01_collision_chech_player(int a1) |
0 | 422 { |
423 int result; // eax@1 | |
424 int v3; // ebx@7 | |
425 int v4; // esi@7 | |
426 int v5; // edi@8 | |
427 int v6; // ecx@9 | |
428 int v7; // edi@12 | |
429 int v10; // [sp+14h] [bp-8h]@7 | |
430 int v11; // [sp+18h] [bp-4h]@7 | |
431 | |
432 result = pParty->vPosition.x; | |
2101 | 433 //v9 = pParty->uPartyHeight; |
434 if ( stru_721530.sMaxX <= pParty->vPosition.x + (2 * pParty->field_14_radius) && stru_721530.sMinX >= pParty->vPosition.x - (2 * pParty->field_14_radius) | |
435 && stru_721530.sMaxY <= pParty->vPosition.y + (2 * pParty->field_14_radius) && stru_721530.sMinY >= pParty->vPosition.y - (2 * pParty->field_14_radius) | |
436 && stru_721530.sMaxZ <= pParty->vPosition.z + pParty->uPartyHeight && stru_721530.sMinZ >= pParty->vPosition.z ) | |
0 | 437 { |
2101 | 438 v3 = stru_721530.prolly_normal_d + (2 * pParty->field_14_radius); |
2085 | 439 v11 = pParty->vPosition.x - stru_721530.normal.x; |
440 v4 = ((pParty->vPosition.x - stru_721530.normal.x) * stru_721530.direction.y | |
441 - (pParty->vPosition.y - stru_721530.normal.y) * stru_721530.direction.x) >> 16; | |
442 v10 = pParty->vPosition.y - stru_721530.normal.y; | |
443 result = abs(((pParty->vPosition.x - stru_721530.normal.x) * stru_721530.direction.y | |
444 - (pParty->vPosition.y - stru_721530.normal.y) * stru_721530.direction.x) >> 16); | |
2101 | 445 if ( result <= stru_721530.prolly_normal_d + (2 * pParty->field_14_radius) ) |
0 | 446 { |
2085 | 447 result = v10 * stru_721530.direction.y; |
448 v5 = (v10 * stru_721530.direction.y + v11 * stru_721530.direction.x) >> 16; | |
449 if ( v5 > 0 ) | |
0 | 450 { |
2207 | 451 v6 = fixpoint_mul(stru_721530.direction.z, v5) + stru_721530.normal.z; |
2085 | 452 result = pParty->vPosition.z; |
453 if ( v6 >= pParty->vPosition.z ) | |
0 | 454 { |
2101 | 455 result = pParty->uPartyHeight + pParty->vPosition.z; |
456 if ( v6 <= (signed int)(pParty->uPartyHeight + pParty->vPosition.z) || a1 ) | |
0 | 457 { |
2085 | 458 result = integer_sqrt(v3 * v3 - v4 * v4); |
459 v7 = v5 - integer_sqrt(v3 * v3 - v4 * v4); | |
460 if ( v7 < 0 ) | |
461 v7 = 0; | |
462 if ( v7 < stru_721530.field_7C ) | |
0 | 463 { |
2085 | 464 stru_721530.field_7C = v7; |
465 stru_721530.uFaceID = 4; | |
0 | 466 } |
467 } | |
468 } | |
469 } | |
470 } | |
471 } | |
472 return result; | |
473 } | |
474 | |
475 //----- (0046F04E) -------------------------------------------------------- | |
1459 | 476 int _46F04E_collide_against_portals() |
0 | 477 { |
478 unsigned int v1; // eax@1 | |
2085 | 479 BLVFace *face; // eax@3 |
0 | 480 int v4; // ecx@9 |
481 int v5; // edx@9 | |
482 signed int result; // eax@21 | |
483 unsigned int v10; // [sp+8h] [bp-Ch]@1 | |
484 int a3; // [sp+Ch] [bp-8h]@13 | |
485 int v12; // [sp+10h] [bp-4h]@15 | |
486 | |
487 v1 = 0xFFFFFFu; | |
488 v10 = 0xFFFFFFu; | |
2085 | 489 for ( uint i = 0; i < pIndoor->pSectors[stru_721530.uSectorID].uNumPortals; ++i ) |
0 | 490 { |
2085 | 491 if ( pIndoor->pSectors[stru_721530.uSectorID].pPortals[i] != stru_721530.field_80 ) |
0 | 492 { |
2085 | 493 face = &pIndoor->pFaces[pIndoor->pSectors[stru_721530.uSectorID].pPortals[i]]; |
494 if ( stru_721530.sMaxX <= face->pBounding.x2 && stru_721530.sMinX >= face->pBounding.x1 | |
495 && stru_721530.sMaxY <= face->pBounding.y2 && stru_721530.sMinY >= face->pBounding.y1 | |
496 && stru_721530.sMaxZ <= face->pBounding.z2 && stru_721530.sMinZ >= face->pBounding.z1 ) | |
0 | 497 { |
2085 | 498 v4 = (stru_721530.normal.x * face->pFacePlane_old.vNormal.x + face->pFacePlane_old.dist |
499 + stru_721530.normal.y * face->pFacePlane_old.vNormal.y | |
500 + stru_721530.normal.z * face->pFacePlane_old.vNormal.z) >> 16; | |
501 v5 = (stru_721530.normal2.z * face->pFacePlane_old.vNormal.z + face->pFacePlane_old.dist | |
502 + stru_721530.normal2.x * face->pFacePlane_old.vNormal.x | |
503 + stru_721530.normal2.y * face->pFacePlane_old.vNormal.y) >> 16; | |
504 if ( (v4 < stru_721530.prolly_normal_d || v5 < stru_721530.prolly_normal_d) | |
505 && (v4 > -stru_721530.prolly_normal_d || v5 > -stru_721530.prolly_normal_d) | |
506 && (a3 = stru_721530.field_6C, sub_475D85(&stru_721530.normal, &stru_721530.direction, &a3, face)) | |
507 && a3 < (signed int)v10 ) | |
0 | 508 { |
2085 | 509 v10 = a3; |
510 v12 = pIndoor->pSectors[stru_721530.uSectorID].pPortals[i]; | |
0 | 511 } |
512 } | |
513 } | |
514 } | |
2085 | 515 v1 = v10; |
0 | 516 if ( stru_721530.field_7C >= (signed int)v1 && (signed int)v1 <= stru_721530.field_6C ) |
517 { | |
518 stru_721530.field_80 = v12; | |
2085 | 519 if ( pIndoor->pFaces[v12].uSectorID == stru_721530.uSectorID ) |
520 stru_721530.uSectorID = pIndoor->pFaces[v12].uBackSectorID; | |
0 | 521 else |
2085 | 522 stru_721530.uSectorID = pIndoor->pFaces[v12].uSectorID; |
0 | 523 stru_721530.field_7C = 268435455; |
524 result = 0; | |
525 } | |
526 else | |
527 { | |
528 result = 1; | |
529 } | |
530 return result; | |
531 } | |
532 | |
533 //----- (0047050A) -------------------------------------------------------- | |
1546 | 534 int stru141_actor_collision_object::_47050A(int dt) |
0 | 535 { |
536 int v7; // eax@1 | |
537 signed int result; // eax@4 | |
538 int v17; // eax@5 | |
539 int v18; // eax@7 | |
540 int v21; // eax@9 | |
541 int v22; // eax@11 | |
2101 | 542 |
1546 | 543 int speed = 1 | integer_sqrt(this->velocity.z * this->velocity.z + this->velocity.y * this->velocity.y + this->velocity.x * this->velocity.x); |
544 | |
1799 | 545 this->direction.x = 65536 / speed * this->velocity.x; |
546 this->direction.y = 65536 / speed * this->velocity.y; | |
547 this->direction.z = 65536 / speed * this->velocity.z; | |
548 | |
549 this->speed = speed; | |
550 this->inv_speed = 65536 / speed; | |
1546 | 551 |
552 if (dt) | |
553 v7 = dt; | |
554 else | |
0 | 555 v7 = pEventTimer->dt_in_some_format; |
1546 | 556 |
1799 | 557 //v8 = fixpoint_mul(v7, speed) - this->field_70; // speed * dt - something |
558 this->field_6C = fixpoint_mul(v7, speed) - this->field_70; | |
559 if ( this->field_6C > 0 ) | |
560 { | |
561 //v10 = fixpoint_mul(v8, this->direction.x) + this->normal.x; | |
562 this->field_4C = fixpoint_mul(this->field_6C, this->direction.x) + this->normal.x; | |
563 this->normal2.x = fixpoint_mul(this->field_6C, this->direction.x) + this->normal.x; | |
564 //v11 = fixpoint_mul(this->field_6C, this->direction.y) + this->normal.y; | |
565 this->field_50 = fixpoint_mul(this->field_6C, this->direction.y) + this->normal.y; | |
566 this->normal2.y = fixpoint_mul(this->field_6C, this->direction.y) + this->normal.y; | |
567 this->normal2.z = fixpoint_mul(this->field_6C, this->direction.z) + this->normal.z; | |
568 //v12 = this->position.z; | |
569 //v13 = this->normal.x; | |
570 //v14 = this->normal2.x; | |
571 //v15 = this->prolly_normal_d; | |
572 //v16 = this->position.z + fixpoint_mul(this->field_6C, this->direction.z); | |
573 //v28 = this->position.z + fixpoint_mul(this->field_6C, this->direction.z); | |
574 this->field_54 = this->position.z + fixpoint_mul(this->field_6C, this->direction.z); | |
575 v17 = this->normal.x; | |
576 if ( v17 >= this->normal2.x ) | |
577 v17 = this->normal2.x; | |
578 this->sMaxX = v17 - this->prolly_normal_d; | |
579 v18 = this->prolly_normal_d + this->normal.x; | |
580 if ( this->normal.x <= this->normal2.x ) | |
581 v18 = this->prolly_normal_d + this->normal2.x; | |
582 //v19 = this->normal.y; | |
583 //v20 = this->normal2.y; | |
584 this->sMinX = v18; | |
585 v21 = this->normal.y; | |
586 if ( v21 >= this->normal2.y ) | |
587 v21 = this->normal2.y; | |
588 this->sMaxY = v21 - this->prolly_normal_d; | |
589 v22 = this->prolly_normal_d + this->normal.y; | |
590 if ( this->normal.y <= this->normal2.y ) | |
591 v22 = this->normal2.y + this->prolly_normal_d; | |
592 //v23 = this->normal2.z; | |
593 this->sMinY = v22; | |
594 //v24 = this->normal.z; | |
595 if ( this->normal.z >= this->normal2.z ) | |
596 this->sMaxZ = this->normal2.z - this->prolly_normal_d; | |
0 | 597 else |
1799 | 598 this->sMaxZ = this->normal.z - this->prolly_normal_d; |
599 //this->sMaxZ = v25; | |
600 //v26 = this->field_8_radius; | |
601 if ( this->position.z <= this->position.z + fixpoint_mul(this->field_6C, this->direction.z) ) | |
602 this->sMinZ = (this->position.z + fixpoint_mul(this->field_6C, this->direction.z)) + this->field_8_radius; | |
0 | 603 else |
1799 | 604 this->sMinZ = this->position.z + this->field_8_radius; |
605 this->uFaceID = 0; | |
606 this->field_80 = -1; | |
607 this->field_88 = -1; | |
608 //this->sMinZ = v27; | |
609 this->field_7C = 0xFFFFFFu; | |
0 | 610 result = 0; |
611 } | |
612 else | |
613 { | |
614 result = 1; | |
615 } | |
616 return result; | |
617 } | |
618 | |
619 //----- (004706C6) -------------------------------------------------------- | |
1545 | 620 void UpdateActors_ODM() |
0 | 621 { |
622 int v3; // ebx@6 | |
623 int v5; // eax@10 | |
624 int v6; // ecx@10 | |
625 signed int v8; // ebx@17 | |
2334 | 626 // unsigned __int8 v10; // sf@17 |
627 // unsigned __int16 v11; // ax@21 | |
0 | 628 __int16 v20; // ax@42 |
629 int v25; // eax@45 | |
630 signed int v26; // ecx@50 | |
631 int v28; // eax@54 | |
632 signed int v29; // ebx@57 | |
633 signed int v30; // eax@57 | |
634 int v31; // edi@57 | |
635 signed int i; // ebx@57 | |
636 unsigned int v33; // ecx@58 | |
637 int v35; // edi@64 | |
638 int v36; // eax@64 | |
848 | 639 unsigned int v39; // edi@71 |
2085 | 640 ODMFace *face; // edi@75 |
0 | 641 int v46; // ecx@82 |
642 signed int v47; // ebx@85 | |
643 int v48; // edi@85 | |
2334 | 644 // int v55; // eax@107 |
645 // unsigned int v56; // edi@107 | |
646 // int v57; // ST10_4@107 | |
0 | 647 unsigned int v58; // edi@107 |
648 unsigned int v59; // ebx@107 | |
2334 | 649 // signed int v60; // eax@107 |
0 | 650 int v61; // eax@124 |
651 Vec3_int_ v62; // [sp+Ch] [bp-44h]@42 | |
153 | 652 int v63; // [sp+18h] [bp-38h]@64 |
0 | 653 int v64; // [sp+1Ch] [bp-34h]@64 |
654 bool v67; // [sp+28h] [bp-28h]@10 | |
655 unsigned int v69; // [sp+30h] [bp-20h]@6 | |
656 unsigned int v70; // [sp+34h] [bp-1Ch]@10 | |
657 int v71; // [sp+38h] [bp-18h]@62 | |
845 | 658 int uIsAboveFloor; // [sp+3Ch] [bp-14h]@10 |
659 int v72b; | |
660 int uIsFlying; // [sp+44h] [bp-Ch]@8 | |
0 | 661 unsigned int v75; // [sp+48h] [bp-8h]@1 |
845 | 662 int uIsOnWater; // [sp+4Ch] [bp-4h]@10 |
663 | |
1545 | 664 for (v75 = 0; v75 < uNumActors; ++v75) |
0 | 665 { |
2085 | 666 if ( pActors[v75].uAIState == Removed || pActors[v75].uAIState == Disabled || pActors[v75].uAIState == Summoned |
667 || !pActors[v75].uMovementSpeed ) | |
668 continue; | |
0 | 669 v3 = 0; |
670 v69 = 0; | |
2085 | 671 if ( MonsterStats::BelongsToSupertype(pActors[v75].pMonsterInfo.uID, MONSTER_SUPERTYPE_WATER_ELEMENTAL) ) |
0 | 672 v3 = 1; |
2085 | 673 pActors[v75].uSectorID = 0; |
674 uIsFlying = pActors[v75].pMonsterInfo.uFlying; | |
675 if ( !pActors[v75].CanAct() ) | |
845 | 676 uIsFlying = 0; |
2085 | 677 v70 = IsTerrainSlopeTooHigh(pActors[v75].vPosition.x, pActors[v75].vPosition.y); |
678 v5 = ODM_GetFloorLevel(pActors[v75].vPosition.x, pActors[v75].vPosition.y, pActors[v75].vPosition.z, | |
679 pActors[v75].uActorHeight, &uIsOnWater, (int *)&v69, v3); | |
680 v6 = pActors[v75].vPosition.z; | |
845 | 681 uIsAboveFloor = 0; |
0 | 682 v67 = v69 == 0; |
683 if ( v6 > v5 + 1 ) | |
845 | 684 uIsAboveFloor = 1; |
2085 | 685 if ( pActors[v75].uAIState == Dead && uIsOnWater && !uIsAboveFloor ) |
0 | 686 { |
2085 | 687 pActors[v75].uAIState = Removed; |
688 continue; | |
0 | 689 } |
2085 | 690 if ( pActors[v75].uCurrentActionAnimation == ANIM_Walking ) |
0 | 691 { |
2085 | 692 v8 = pActors[v75].uMovementSpeed; |
693 if ( (signed __int64)pActors[v75].pActorBuffs[ACTOR_BUFF_SLOWED].uExpireTime > 0 ) | |
1545 | 694 v8 = (signed __int64)((double)v8 * 0.5); |
2085 | 695 if ( pActors[v75].uAIState == Fleeing || pActors[v75].uAIState == Pursuing ) |
0 | 696 v8 *= 2; |
2242 | 697 if ( pParty->bTurnBasedModeOn == true && pTurnEngine->turn_stage == TE_WAIT ) |
1545 | 698 v8 *= flt_6BE3AC_debug_recmod1_x_1_6; |
0 | 699 if ( v8 > 1000 ) |
700 v8 = 1000; | |
1545 | 701 |
2085 | 702 pActors[v75].vVelocity.x = fixpoint_mul(stru_5C6E00->Cos(pActors[v75].uYawAngle), v8); |
703 pActors[v75].vVelocity.y = fixpoint_mul(stru_5C6E00->Sin(pActors[v75].uYawAngle), v8); | |
845 | 704 if ( uIsFlying ) |
0 | 705 { |
2085 | 706 pActors[v75].vVelocity.z = fixpoint_mul(stru_5C6E00->Sin(pActors[v75].uPitchAngle), v8); |
0 | 707 } |
846 | 708 //v7 = v68; |
0 | 709 } |
710 else | |
711 { | |
2085 | 712 pActors[v75].vVelocity.x = fixpoint_mul(55000, pActors[v75].vVelocity.x); |
713 pActors[v75].vVelocity.y = fixpoint_mul(55000, pActors[v75].vVelocity.y); | |
845 | 714 if ( uIsFlying ) |
2085 | 715 pActors[v75].vVelocity.z = fixpoint_mul(55000, pActors[v75].vVelocity.z); |
0 | 716 } |
2085 | 717 if ( pActors[v75].vPosition.z < v5 ) |
0 | 718 { |
2085 | 719 pActors[v75].vPosition.z = v5; |
720 pActors[v75].vVelocity.z = uIsFlying != 0 ? 0x14 : 0; | |
0 | 721 } |
846 | 722 //v17 = 0; |
845 | 723 if ( !uIsAboveFloor || uIsFlying ) |
724 { | |
725 if ( v70 && !uIsAboveFloor && v67 ) | |
0 | 726 { |
2085 | 727 pActors[v75].vPosition.z = v5; |
728 ODM_GetTerrainNormalAt(pActors[v75].vPosition.x, pActors[v75].vPosition.y, &v62); | |
0 | 729 v20 = GetGravityStrength(); |
1545 | 730 //v21 = v62.y; |
731 //v22 = v62.z; | |
732 //v23 = v62.y * v0->vVelocity.y; | |
2085 | 733 pActors[v75].vVelocity.z += -8 * LOWORD(pEventTimer->uTimeElapsed) * v20; |
734 int v73 = abs(v62.x * pActors[v75].vVelocity.x + v62.z * pActors[v75].vVelocity.z + v62.y * pActors[v75].vVelocity.y) >> 16; | |
1545 | 735 //v72b = v21; |
2085 | 736 pActors[v75].vVelocity.x += fixpoint_mul(v73, v62.x); |
737 pActors[v75].vVelocity.y += fixpoint_mul(v73, v62.y); | |
738 pActors[v75].vVelocity.z += fixpoint_mul(v73, v62.z); | |
846 | 739 //v17 = 0; |
0 | 740 } |
741 } | |
742 else | |
743 { | |
2085 | 744 pActors[v75].vVelocity.z -= LOWORD(pEventTimer->uTimeElapsed) * GetGravityStrength(); |
0 | 745 } |
2085 | 746 if ( pParty->armageddon_timer != 0 && pActors[v75].CanAct() ) |
0 | 747 { |
2085 | 748 pActors[v75].vVelocity.x += rand() % 100 - 50; |
749 pActors[v75].vVelocity.y += rand() % 100 - 50; | |
750 pActors[v75].vVelocity.z += rand() % 100 - 20; | |
0 | 751 v25 = rand(); |
2085 | 752 pActors[v75].uAIState = Stunned; |
753 pActors[v75].uYawAngle += v25 % 32 - 16; | |
754 pActors[v75].UpdateAnimation(); | |
0 | 755 } |
2085 | 756 if ( pActors[v75].vVelocity.x * pActors[v75].vVelocity.x + pActors[v75].vVelocity.y * pActors[v75].vVelocity.y < 400 && v70 == 0 ) |
846 | 757 { |
2085 | 758 pActors[v75].vVelocity.y = 0; |
759 pActors[v75].vVelocity.x = 0; | |
0 | 760 } |
761 stru_721530.field_0 = 1; | |
845 | 762 if ( !uIsFlying ) |
0 | 763 v26 = 40; |
764 else | |
2085 | 765 v26 = pActors[v75].uActorRadius; |
1546 | 766 |
0 | 767 stru_721530.field_84 = -1; |
1546 | 768 stru_721530.field_8_radius = v26; |
0 | 769 stru_721530.prolly_normal_d = v26; |
2085 | 770 stru_721530.height = pActors[v75].uActorHeight; |
846 | 771 stru_721530.field_70 = 0; |
2085 | 772 |
773 for ( v69 = 0; v69 < 100; ++v69 ) | |
0 | 774 { |
2085 | 775 stru_721530.position.x = pActors[v75].vPosition.x; |
1546 | 776 stru_721530.normal.x = stru_721530.position.x; |
2085 | 777 stru_721530.position.y = pActors[v75].vPosition.y; |
1546 | 778 stru_721530.normal.y = stru_721530.position.y; |
2085 | 779 v28 = pActors[v75].vPosition.z; |
0 | 780 stru_721530.normal.z = v28 + v26 + 1; |
1546 | 781 stru_721530.position.z = v28 - v26 + stru_721530.height - 1; |
782 if ( stru_721530.position.z < stru_721530.normal.z ) | |
783 stru_721530.position.z = v28 + v26 + 1; | |
2085 | 784 stru_721530.velocity.x = pActors[v75].vVelocity.x; |
0 | 785 stru_721530.uSectorID = 0; |
2085 | 786 stru_721530.velocity.y = pActors[v75].vVelocity.y; |
787 stru_721530.velocity.z = pActors[v75].vVelocity.z; | |
0 | 788 if ( stru_721530._47050A(0) ) |
789 break; | |
2085 | 790 _46E889_collide_against_bmodels(1); |
791 v29 = WorldPosToGridCellZ(pActors[v75].vPosition.y); | |
792 v30 = WorldPosToGridCellX(pActors[v75].vPosition.x); | |
0 | 793 _46E26D_collide_against_sprites(v30, v29); |
794 _46EF01_collision_chech_player(0); | |
862 | 795 _46ED8A_collide_against_sprite_objects(PID(OBJECT_Actor,v75)); |
0 | 796 v31 = 0; |
797 for ( i = 0; v31 < ai_arrays_size; ++v31 ) | |
798 { | |
390 | 799 v33 = ai_near_actors_ids[v31]; |
1897
436553b0603c
_46DF1A_collide_against_actor cleaned up, moved to Actor.h
Grumpy7
parents:
1861
diff
changeset
|
800 if ( v33 != v75 && Actor::_46DF1A_collide_against_actor(v33, 40) ) |
0 | 801 ++i; |
802 } | |
803 v71 = i > 1; | |
804 if ( stru_721530.field_7C < stru_721530.field_6C ) | |
1643 | 805 v70 = fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z); |
845 | 806 //v34 = 0; |
0 | 807 v35 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1; |
2085 | 808 v36 = ODM_GetFloorLevel(stru_721530.normal2.x, stru_721530.normal2.y, |
0 | 809 stru_721530.normal2.z - stru_721530.prolly_normal_d - 1, |
2085 | 810 pActors[v75].uActorHeight, (int *)&v63, &v64, 0); |
845 | 811 if ( uIsOnWater ) |
0 | 812 { |
813 if ( v35 < v36 + 60 ) | |
814 { | |
2085 | 815 if ( pActors[v75].uAIState == Dead || pActors[v75].uAIState == Dying || pActors[v75].uAIState == Removed |
816 || pActors[v75].uAIState == Disabled ) | |
0 | 817 { |
818 if ( v64 ) | |
819 v61 = v36 + 30; | |
820 else | |
846 | 821 v61 = v5 + 60; |
2331
9551756f46c4
Moving functions out of mm7_6.cpp into appropriate classes as static methods or free functions
Grumpy7
parents:
2276
diff
changeset
|
822 SpriteObject::sub_42F960_create_object(pActors[v75].vPosition.x, pActors[v75].vPosition.y, v61); |
2085 | 823 pActors[v75].uAIState = Removed; |
0 | 824 return; |
825 } | |
826 } | |
827 } | |
828 if ( stru_721530.field_7C >= stru_721530.field_6C ) | |
829 { | |
2085 | 830 pActors[v75].vPosition.x = LOWORD(stru_721530.normal2.x); |
831 pActors[v75].vPosition.y = LOWORD(stru_721530.normal2.y); | |
832 pActors[v75].vPosition.z = LOWORD(stru_721530.normal2.z) - LOWORD(stru_721530.prolly_normal_d) - 1; | |
0 | 833 break; |
834 } | |
1643 | 835 //v72b = fixpoint_mul(stru_721530.field_7C, stru_721530.field_58.x); |
2085 | 836 pActors[v75].vPosition.x += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.x); |
1545 | 837 //v72b = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16; |
2085 | 838 pActors[v75].vPosition.y += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.y); |
1545 | 839 //v72b = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16; |
2085 | 840 pActors[v75].vPosition.z += fixpoint_mul(stru_721530.field_7C, stru_721530.direction.z); |
0 | 841 stru_721530.field_70 += stru_721530.field_7C; |
2085 | 842 v39 = PID_ID(stru_721530.uFaceID); |
843 switch ( PID_TYPE(stru_721530.uFaceID) ) | |
845 | 844 { |
845 case OBJECT_Actor: | |
2242 | 846 if ( pTurnEngine->turn_stage != TE_ATTACK && pTurnEngine->turn_stage != TE_MOVEMENT || pParty->bTurnBasedModeOn != TE_WAIT ) |
845 | 847 { |
848 //if(pParty->bTurnBasedModeOn == 1) | |
849 //v34 = 0; | |
2085 | 850 if ( pActors[v75].pMonsterInfo.uHostilityType ) |
0 | 851 { |
845 | 852 if ( v71 == 0 ) |
2085 | 853 Actor::AI_Flee(v75, stru_721530.uFaceID, 0, (AIDirection *)0); |
854 else | |
855 Actor::AI_StandOrBored(v75, 4, 0, (AIDirection *)0); | |
0 | 856 } |
1545 | 857 else if ( v71 ) |
845 | 858 Actor::AI_StandOrBored(v75, 4, 0, (AIDirection *)0); |
2085 | 859 else if ( pActors[v39].pMonsterInfo.uHostilityType == MonsterInfo::Hostility_Friendly ) |
860 Actor::AI_Flee(v75, stru_721530.uFaceID, 0, (AIDirection *)0); | |
861 else | |
862 Actor::AI_FaceObject(v75, stru_721530.uFaceID, 0, (AIDirection *)0); | |
0 | 863 } |
864 break; | |
845 | 865 case OBJECT_Player: |
2085 | 866 if ( !pActors[v75].GetActorsRelation(0) ) |
0 | 867 { |
2085 | 868 Actor::AI_FaceObject(v75, stru_721530.uFaceID, 0, (AIDirection *)0); |
845 | 869 break; |
0 | 870 } |
1167 | 871 //v52 = HIDWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) == 0; |
872 //v53 = SHIDWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) < 0; | |
2085 | 873 pActors[v75].vVelocity.y = 0; |
874 pActors[v75].vVelocity.x = 0; | |
1167 | 875 //if ( !v53 && (!(v53 | v52) || LODWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) > 0) ) |
2085 | 876 if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime < 0) |
1167 | 877 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); |
0 | 878 viewparams->bRedrawGameUI = 1; |
879 break; | |
845 | 880 case OBJECT_Decoration: |
2085 | 881 v47 = integer_sqrt(pActors[v75].vVelocity.x * pActors[v75].vVelocity.x + pActors[v75].vVelocity.y * pActors[v75].vVelocity.y); |
882 v48 = stru_5C6E00->Atan2( pActors[v75].vPosition.x - pLevelDecorations[v39].vPosition.x, | |
883 pActors[v75].vPosition.y - pLevelDecorations[v39].vPosition.y); | |
884 //v49 = v48; | |
885 pActors[v75].vVelocity.x = fixpoint_mul(stru_5C6E00->Cos(v48), v47); | |
886 pActors[v75].vVelocity.y = fixpoint_mul(stru_5C6E00->Sin(v48), v47); | |
0 | 887 break; |
845 | 888 case OBJECT_BModel: |
2085 | 889 face = &pOutdoor->pBModels[stru_721530.uFaceID >> 9].pFaces[v39 & 0x3F]; |
890 if ( !face->Ethereal() ) | |
0 | 891 { |
2085 | 892 if ( face->uPolygonType == 3 ) |
0 | 893 { |
2085 | 894 pActors[v75].vVelocity.z = 0; |
895 pActors[v75].vPosition.z = LOWORD(pOutdoor->pBModels[stru_721530.uFaceID >> 9].pVertices.pVertices[face->pVertexIDs[0]].z) + 1; | |
896 if ( pActors[v75].vVelocity.x * pActors[v75].vVelocity.x | |
897 + pActors[v75].vVelocity.y * pActors[v75].vVelocity.y < 400 ) | |
0 | 898 { |
2085 | 899 pActors[v75].vVelocity.y = 0; |
900 pActors[v75].vVelocity.x = 0; | |
0 | 901 } |
902 } | |
903 else | |
904 { | |
2085 | 905 v72b = abs(face->pFacePlane.vNormal.y * pActors[v75].vVelocity.y + face->pFacePlane.vNormal.z * pActors[v75].vVelocity.z |
906 + face->pFacePlane.vNormal.x * pActors[v75].vVelocity.x) >> 16; | |
1546 | 907 if ( (stru_721530.speed >> 3) > v72b ) |
908 v72b = stru_721530.speed >> 3; | |
1545 | 909 |
2085 | 910 pActors[v75].vVelocity.x += fixpoint_mul(v72b, face->pFacePlane.vNormal.x); |
911 pActors[v75].vVelocity.y += fixpoint_mul(v72b, face->pFacePlane.vNormal.y); | |
912 pActors[v75].vVelocity.z += fixpoint_mul(v72b, face->pFacePlane.vNormal.z); | |
913 if ( face->uPolygonType != 4 ) | |
0 | 914 { |
915 v46 = stru_721530.prolly_normal_d | |
2085 | 916 - ((face->pFacePlane.dist |
917 + face->pFacePlane.vNormal.x * pActors[v75].vPosition.x | |
918 + face->pFacePlane.vNormal.y * pActors[v75].vPosition.y | |
919 + face->pFacePlane.vNormal.z * pActors[v75].vPosition.z) >> 16); | |
0 | 920 if ( v46 > 0 ) |
921 { | |
2207 | 922 pActors[v75].vPosition.x += fixpoint_mul(v46, face->pFacePlane.vNormal.x); |
923 pActors[v75].vPosition.y += fixpoint_mul(v46, face->pFacePlane.vNormal.y); | |
924 pActors[v75].vPosition.z += fixpoint_mul(v46, face->pFacePlane.vNormal.z); | |
0 | 925 } |
2085 | 926 pActors[v75].uYawAngle = stru_5C6E00->Atan2(pActors[v75].vVelocity.x, pActors[v75].vVelocity.y); |
0 | 927 } |
928 } | |
929 } | |
930 break; | |
931 } | |
1545 | 932 |
2085 | 933 pActors[v75].vVelocity.x = fixpoint_mul(58500, pActors[v75].vVelocity.x); |
934 pActors[v75].vVelocity.y = fixpoint_mul(58500, pActors[v75].vVelocity.y); | |
935 pActors[v75].vVelocity.z = fixpoint_mul(58500, pActors[v75].vVelocity.z); | |
936 | |
0 | 937 v26 = stru_721530.prolly_normal_d; |
938 } | |
2085 | 939 |
940 v58 = ((unsigned int)~pOutdoor->ActuallyGetSomeOtherTileInfo(WorldPosToGridCellX(pActors[v75].vPosition.x), WorldPosToGridCellZ(pActors[v75].vPosition.y) - 1) >> 1) & 1; | |
941 v59 = ((unsigned int)~pOutdoor->ActuallyGetSomeOtherTileInfo(WorldPosToGridCellX(pActors[v75].vPosition.x), WorldPosToGridCellZ(pActors[v75].vPosition.y) - 1) >> 1) & 1; | |
942 if ( WorldPosToGridCellX(pActors[v75].vPosition.x) == WorldPosToGridCellX(pActors[v75].vPosition.x) | |
943 && WorldPosToGridCellZ(pActors[v75].vPosition.y) == WorldPosToGridCellZ(pActors[v75].vPosition.y) | |
944 && v58 || v67 != 0 ) | |
0 | 945 { |
2085 | 946 if ( MonsterStats::BelongsToSupertype(pActors[v75].pMonsterInfo.uID, MONSTER_SUPERTYPE_WATER_ELEMENTAL) ) |
0 | 947 { |
948 v58 = v58 == 0; | |
949 v59 = v59 == 0; | |
950 } | |
845 | 951 if ( !uIsFlying && v58 && !v59 ) |
0 | 952 { |
2085 | 953 pActors[v75].vPosition.x = pActors[v75].vPosition.x; |
954 pActors[v75].vPosition.y = pActors[v75].vPosition.y; | |
955 if ( pActors[v75].CanAct() ) | |
0 | 956 { |
2085 | 957 pActors[v75].uYawAngle -= 32; |
958 pActors[v75].uCurrentActionTime = 0; | |
959 pActors[v75].uCurrentActionLength = 128; | |
960 pActors[v75].uAIState = Fleeing; | |
0 | 961 } |
962 } | |
963 } | |
845 | 964 } |
0 | 965 } |
966 | |
967 //----- (0047253E) -------------------------------------------------------- | |
968 void UpdateObjects() | |
969 { | |
2334 | 970 // unsigned int v0; // ebx@0 |
2085 | 971 ObjectDesc *object; // eax@5 |
0 | 972 int v5; // ecx@6 |
2334 | 973 // __int16 v6; // cx@7 |
0 | 974 signed int v7; // eax@9 |
975 signed int v11; // eax@17 | |
976 int v12; // edi@27 | |
2334 | 977 // int v13; // eax@27 |
978 // int v14; // ebx@27 | |
979 // unsigned int v15; // ecx@27 | |
980 // unsigned int v16; // edx@30 | |
981 // unsigned int v17; // edx@32 | |
0 | 982 int v18; // [sp+4h] [bp-10h]@27 |
983 int v19; // [sp+8h] [bp-Ch]@27 | |
2101 | 984 |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
510
diff
changeset
|
985 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
|
986 { |
2101 | 987 if (pSpriteObjects[i].uAttributes & OBJECT_40) |
988 pSpriteObjects[i].uAttributes &= ~OBJECT_40; | |
0 | 989 else |
990 { | |
2101 | 991 object = &pObjectList->pObjects[pSpriteObjects[i].uObjectDescID]; |
992 if (pSpriteObjects[i].AttachedToActor()) | |
430 | 993 { |
2101 | 994 v5 = PID_ID(pSpriteObjects[i].spell_target_pid); |
995 pSpriteObjects[i].vPosition.x = pActors[v5].vPosition.x; | |
996 pSpriteObjects[i].vPosition.y = pActors[v5].vPosition.y; | |
997 pSpriteObjects[i].vPosition.z = pActors[v5].vPosition.z + pActors[v5].uActorHeight; | |
998 if ( !pSpriteObjects[i].uObjectDescID ) | |
2085 | 999 continue; |
2101 | 1000 pSpriteObjects[i].uSpriteFrameID += pEventTimer->uTimeElapsed; |
1001 if ( !(object->uFlags & OBJECT_DESC_TEMPORARY)) | |
1002 continue; | |
1003 if ( pSpriteObjects[i].uSpriteFrameID >= 0 ) | |
0 | 1004 { |
2101 | 1005 v7 = object->uLifetime; |
1006 if (pSpriteObjects[i].uAttributes & ITEM_BROKEN) | |
1007 v7 = pSpriteObjects[i].field_20; | |
1008 if ( pSpriteObjects[i].uSpriteFrameID < v7 ) | |
1009 continue; | |
1010 } | |
1011 SpriteObject::OnInteraction(i); | |
1012 continue; | |
1013 } | |
1014 if ( pSpriteObjects[i].uObjectDescID ) | |
1015 { | |
1016 pSpriteObjects[i].uSpriteFrameID += pEventTimer->uTimeElapsed; | |
1017 if ( object->uFlags & OBJECT_DESC_TEMPORARY ) | |
1018 { | |
1019 if ( pSpriteObjects[i].uSpriteFrameID < 0 ) | |
2085 | 1020 { |
1021 SpriteObject::OnInteraction(i); | |
1083 | 1022 continue; |
2085 | 1023 } |
2101 | 1024 v11 = object->uLifetime; |
1025 if (pSpriteObjects[i].uAttributes & ITEM_BROKEN) | |
1026 v11 = pSpriteObjects[i].field_20; | |
0 | 1027 } |
2101 | 1028 if ( !(object->uFlags & OBJECT_DESC_TEMPORARY) || pSpriteObjects[i].uSpriteFrameID < v11 ) |
1029 { | |
1030 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) | |
1031 SpriteObject::UpdateObject_fn0_BLV(i); | |
1032 else | |
1033 SpriteObject::UpdateObject_fn0_ODM(i); | |
1034 if ( pParty->bTurnBasedModeOn != 1 || !(pSpriteObjects[i].uSectorID & 4) ) | |
1035 continue; | |
1036 v12 = abs(pParty->vPosition.x - pSpriteObjects[i].vPosition.x); | |
1037 v18 = abs(pParty->vPosition.y - pSpriteObjects[i].vPosition.y); | |
1038 v19 = abs(pParty->vPosition.z - pSpriteObjects[i].vPosition.z); | |
2235
6ab7d7c112bb
adding int_get_vector_length calls where the calls were inlined
Grumpy7
parents:
2216
diff
changeset
|
1039 if ( int_get_vector_length(v12, v18, v19) <= 5120 ) |
2101 | 1040 continue; |
1041 SpriteObject::OnInteraction(i); | |
1042 continue; | |
1043 } | |
1044 if ( !(object->uFlags & OBJECT_DESC_INTERACTABLE) ) | |
1045 { | |
1046 SpriteObject::OnInteraction(i); | |
1047 continue; | |
1048 } | |
1049 _46BFFA_check_object_intercept(i, PID(OBJECT_Item,i)); | |
1050 } | |
0 | 1051 } |
1052 } | |
1053 } | |
1054 | |
1055 //----- (0047272C) -------------------------------------------------------- | |
831 | 1056 int collide_against_floor_approximate(int x, int y, int z, unsigned int *pSectorID, unsigned int *pFaceID) |
0 | 1057 { |
1058 int result; // eax@1 | |
2101 | 1059 |
0 | 1060 *pSectorID = pIndoor->GetSector(x - 2, y, z + 40); |
2101 | 1061 result = collide_against_floor(x - 2, y, z + 40, pSectorID, pFaceID); |
0 | 1062 if ( result == -30000 || !*pSectorID ) |
1063 { | |
2101 | 1064 *pSectorID = pIndoor->GetSector(x + 2, y, z + 40); |
1065 result = collide_against_floor(x + 2, y, z + 40, pSectorID, pFaceID); | |
0 | 1066 if ( result == -30000 || !*pSectorID ) |
1067 { | |
2101 | 1068 *pSectorID = pIndoor->GetSector(x, y - 2, z + 40); |
1069 result = collide_against_floor(x, y - 2, z + 40, pSectorID, pFaceID); | |
0 | 1070 if ( result == -30000 || !*pSectorID ) |
1071 { | |
2101 | 1072 *pSectorID = pIndoor->GetSector(x, y + 2, z + 40); |
1073 result = collide_against_floor(x, y + 2, z + 40, pSectorID, pFaceID); | |
0 | 1074 if ( result == -30000 || !*pSectorID ) |
1075 { | |
2101 | 1076 *pSectorID = pIndoor->GetSector(x, y, z + 140); |
1077 result = collide_against_floor(x, y, z + 140, pSectorID, pFaceID); | |
0 | 1078 } |
1079 } | |
1080 } | |
1081 } | |
1082 return result; | |
1083 } | |
1084 | |
1085 //----- (0047531C) -------------------------------------------------------- | |
2085 | 1086 bool sub_47531C(int a1, int *a2, int pos_x, int pos_y, int pos_z, int dir_x, int dir_y, int dir_z, BLVFace *face, int a10) |
0 | 1087 { |
1088 int v11; // ST1C_4@3 | |
1089 int v12; // edi@3 | |
1090 int v13; // esi@3 | |
1091 int v14; // edi@4 | |
1092 signed __int64 v15; // qtt@6 | |
2207 | 1093 //__int16 v16; // si@7 |
0 | 1094 int a7a; // [sp+30h] [bp+18h]@7 |
1095 int a9b; // [sp+38h] [bp+20h]@3 | |
1096 int a9a; // [sp+38h] [bp+20h]@3 | |
1097 int a10b; // [sp+3Ch] [bp+24h]@3 | |
1098 signed int a10a; // [sp+3Ch] [bp+24h]@4 | |
1099 int a10c; // [sp+3Ch] [bp+24h]@5 | |
1100 | |
2085 | 1101 if ( a10 && face->Ethereal() ) |
0 | 1102 return 0; |
2207 | 1103 v11 = fixpoint_mul(dir_x, face->pFacePlane_old.vNormal.x); |
1104 a10b = fixpoint_mul(dir_y, face->pFacePlane_old.vNormal.y); | |
1105 a9b = fixpoint_mul(dir_z, face->pFacePlane_old.vNormal.z); | |
0 | 1106 v12 = v11 + a9b + a10b; |
1107 a9a = v11 + a9b + a10b; | |
1108 v13 = (a1 << 16) | |
2085 | 1109 - pos_x * face->pFacePlane_old.vNormal.x |
1110 - pos_y * face->pFacePlane_old.vNormal.y | |
1111 - pos_z * face->pFacePlane_old.vNormal.z | |
1112 - face->pFacePlane_old.dist; | |
0 | 1113 if ( abs((a1 << 16) |
2085 | 1114 - pos_x * face->pFacePlane_old.vNormal.x |
1115 - pos_y * face->pFacePlane_old.vNormal.y | |
1116 - pos_z * face->pFacePlane_old.vNormal.z - face->pFacePlane_old.dist) >= a1 << 16 ) | |
0 | 1117 { |
1118 a10c = abs(v13) >> 14; | |
1119 if ( a10c > abs(v12) ) | |
1120 return 0; | |
1121 LODWORD(v15) = v13 << 16; | |
1122 HIDWORD(v15) = v13 >> 16; | |
2085 | 1123 v14 = a1; |
0 | 1124 a10a = v15 / a9a; |
1125 } | |
1126 else | |
1127 { | |
1128 a10a = 0; | |
1129 v14 = abs(v13) >> 16; | |
1130 } | |
2207 | 1131 //v16 = pos_y + ((unsigned int)fixpoint_mul(a10a, dir_y) >> 16); |
1132 LOWORD(a7a) = (short)pos_x + ((unsigned int)fixpoint_mul(a10a, dir_x) >> 16) - fixpoint_mul(v14, face->pFacePlane_old.vNormal.x); | |
1133 HIWORD(a7a) = pos_y + ((unsigned int)fixpoint_mul(a10a, dir_y) >> 16) - fixpoint_mul(v14, face->pFacePlane_old.vNormal.y); | |
1134 if ( !sub_475665(face, a7a, (short)pos_z + ((unsigned int)fixpoint_mul(a10a, dir_z) >> 16) - fixpoint_mul(v14, face->pFacePlane_old.vNormal.z)) ) | |
0 | 1135 return 0; |
2085 | 1136 *a2 = a10a >> 16; |
0 | 1137 if ( a10a >> 16 < 0 ) |
2085 | 1138 *a2 = 0; |
0 | 1139 return 1; |
1140 } | |
1141 | |
1142 //----- (004754BF) -------------------------------------------------------- | |
2085 | 1143 bool sub_4754BF(int a1, int *a2, int X, int Y, int Z, int dir_x, int dir_y, int dir_z, BLVFace *face, int a10, int a11) |
0 | 1144 { |
1145 int v12; // ST1C_4@3 | |
1146 int v13; // edi@3 | |
1147 int v14; // esi@3 | |
1148 int v15; // edi@4 | |
1149 signed __int64 v16; // qtt@6 | |
2207 | 1150 //__int16 v17; // si@7 |
0 | 1151 int a7a; // [sp+30h] [bp+18h]@7 |
1152 int a1b; // [sp+38h] [bp+20h]@3 | |
1153 int a1a; // [sp+38h] [bp+20h]@3 | |
1154 int a11b; // [sp+40h] [bp+28h]@3 | |
1155 signed int a11a; // [sp+40h] [bp+28h]@4 | |
1156 int a11c; // [sp+40h] [bp+28h]@5 | |
1157 | |
2085 | 1158 if ( a11 && face->Ethereal() ) |
1159 return false; | |
2207 | 1160 v12 = fixpoint_mul(dir_x, face->pFacePlane_old.vNormal.x); |
1161 a11b = fixpoint_mul(dir_y, face->pFacePlane_old.vNormal.y); | |
1162 a1b = fixpoint_mul(dir_z, face->pFacePlane_old.vNormal.z); | |
0 | 1163 v13 = v12 + a1b + a11b; |
1164 a1a = v12 + a1b + a11b; | |
1165 v14 = (a1 << 16) | |
2085 | 1166 - X * face->pFacePlane_old.vNormal.x |
1167 - Y * face->pFacePlane_old.vNormal.y | |
1168 - Z * face->pFacePlane_old.vNormal.z | |
1169 - face->pFacePlane_old.dist; | |
0 | 1170 if ( abs((a1 << 16) |
2085 | 1171 - X * face->pFacePlane_old.vNormal.x |
1172 - Y * face->pFacePlane_old.vNormal.y | |
1173 - Z * face->pFacePlane_old.vNormal.z - face->pFacePlane_old.dist) >= a1 << 16 ) | |
0 | 1174 { |
1175 a11c = abs(v14) >> 14; | |
1176 if ( a11c > abs(v13) ) | |
2085 | 1177 return false; |
0 | 1178 LODWORD(v16) = v14 << 16; |
1179 HIDWORD(v16) = v14 >> 16; | |
2085 | 1180 v15 = a1; |
0 | 1181 a11a = v16 / a1a; |
1182 } | |
1183 else | |
1184 { | |
1185 a11a = 0; | |
1186 v15 = abs(v14) >> 16; | |
1187 } | |
2207 | 1188 //v17 = Y + ((unsigned int)fixpoint_mul(a11a, dir_y) >> 16); |
1189 LOWORD(a7a) = (short)X + ((unsigned int)fixpoint_mul(a11a, dir_x) >> 16) - fixpoint_mul(v15, face->pFacePlane_old.vNormal.x); | |
1190 HIWORD(a7a) = Y + ((unsigned int)fixpoint_mul(a11a, dir_y) >> 16) - fixpoint_mul(v15, face->pFacePlane_old.vNormal.y); | |
1191 if ( !sub_4759C9(face, a10, a7a, (short)Z + ((unsigned int)fixpoint_mul(a11a, dir_z) >> 16) - fixpoint_mul(v15, face->pFacePlane_old.vNormal.z)) ) | |
2085 | 1192 return false; |
1193 *a2 = a11a >> 16; | |
0 | 1194 if ( a11a >> 16 < 0 ) |
2085 | 1195 *a2 = 0; |
1196 return true; | |
0 | 1197 } |
1198 | |
1199 //----- (00475665) -------------------------------------------------------- | |
2101 | 1200 int sub_475665(BLVFace *face, int a2, __int16 a3) |
0 | 1201 { |
1202 bool v16; // edi@14 | |
1203 signed int v20; // ebx@18 | |
1204 int v21; // edi@20 | |
1205 signed int v22; // ST14_4@22 | |
1206 signed __int64 v23; // qtt@22 | |
1207 signed int result; // eax@25 | |
1208 int v25; // [sp+14h] [bp-10h]@14 | |
1209 int v26; // [sp+1Ch] [bp-8h]@2 | |
1210 signed int v27; // [sp+20h] [bp-4h]@2 | |
1211 signed int v28; // [sp+30h] [bp+Ch]@2 | |
1212 signed int v29; // [sp+30h] [bp+Ch]@7 | |
1213 signed int v30; // [sp+30h] [bp+Ch]@11 | |
1214 signed int v31; // [sp+30h] [bp+Ch]@14 | |
1215 | |
2101 | 1216 if ( face->uAttributes & FACE_XY_PLANE ) |
0 | 1217 { |
1218 v26 = (signed __int16)a2; | |
1219 v27 = SHIWORD(a2); | |
2101 | 1220 if ( face->uNumVertices ) |
0 | 1221 { |
2101 | 1222 for ( v28 = 0; v28 < face->uNumVertices; v28++ ) |
0 | 1223 { |
2101 | 1224 word_720C10_intercepts_xs[2 * v28] = face->pXInterceptDisplacements[v28] + pIndoor->pVertices[face->pVertexIDs[v28]].x; |
1225 word_720B40_intercepts_zs[2 * v28] = face->pYInterceptDisplacements[v28] + pIndoor->pVertices[face->pVertexIDs[v28]].y; | |
1226 word_720C10_intercepts_xs[2 * v28 + 1] = face->pXInterceptDisplacements[v28 + 1] + pIndoor->pVertices[face->pVertexIDs[v28 + 1]].x; | |
1227 word_720B40_intercepts_zs[2 * v28 + 1] = face->pYInterceptDisplacements[v28 + 1] + pIndoor->pVertices[face->pVertexIDs[v28 + 1]].y; | |
0 | 1228 } |
1229 } | |
1230 } | |
1231 else | |
1232 { | |
2101 | 1233 if ( face->uAttributes & FACE_XZ_PLANE ) |
0 | 1234 { |
1235 v26 = (signed __int16)a2; | |
2101 | 1236 v27 = a3; |
1237 if ( face->uNumVertices ) | |
0 | 1238 { |
2101 | 1239 for ( v29 = 0; v29 < face->uNumVertices; v29++ ) |
0 | 1240 { |
2101 | 1241 word_720C10_intercepts_xs[2 * v29] = face->pXInterceptDisplacements[v29] + pIndoor->pVertices[face->pVertexIDs[v29]].x; |
1242 word_720B40_intercepts_zs[2 * v29] = face->pZInterceptDisplacements[v29] + pIndoor->pVertices[face->pVertexIDs[v29]].z; | |
1243 word_720C10_intercepts_xs[2 * v29 + 1] = face->pXInterceptDisplacements[v29 + 1] + pIndoor->pVertices[face->pVertexIDs[v29 + 1]].x; | |
1244 word_720B40_intercepts_zs[2 * v29 + 1] = face->pZInterceptDisplacements[v29 + 1] + pIndoor->pVertices[face->pVertexIDs[v29 + 1]].z; | |
0 | 1245 } |
1246 } | |
1247 } | |
1248 else | |
1249 { | |
1250 v26 = SHIWORD(a2); | |
2101 | 1251 v27 = a3; |
1252 if ( face->uNumVertices ) | |
0 | 1253 { |
2101 | 1254 for ( v30 = 0; v30 < face->uNumVertices; v30++ ) |
0 | 1255 { |
2101 | 1256 word_720C10_intercepts_xs[2 * v30] = face->pYInterceptDisplacements[v30] + pIndoor->pVertices[face->pVertexIDs[v30]].y; |
1257 word_720B40_intercepts_zs[2 * v30] = face->pZInterceptDisplacements[v30] + pIndoor->pVertices[face->pVertexIDs[v30]].z; | |
1258 word_720C10_intercepts_xs[2 * v30 + 1] = face->pYInterceptDisplacements[v30 + 1] + pIndoor->pVertices[face->pVertexIDs[v30 + 1]].y; | |
1259 word_720B40_intercepts_zs[2 * v30 + 1] = face->pZInterceptDisplacements[v30 + 1] + pIndoor->pVertices[face->pVertexIDs[v30 + 1]].z; | |
0 | 1260 } |
1261 } | |
1262 } | |
1263 } | |
1264 v31 = 0; | |
2101 | 1265 word_720C10_intercepts_xs[2 * face->uNumVertices] = word_720C10_intercepts_xs[0]; |
1266 word_720B40_intercepts_zs[2 * face->uNumVertices] = word_720B40_intercepts_zs[0]; | |
0 | 1267 v16 = word_720B40_intercepts_zs[0] >= v27; |
2101 | 1268 if ( 2 * face->uNumVertices <= 0 ) |
1418 | 1269 return 0; |
2101 | 1270 for ( v25 = 0; v25 < 2 * face->uNumVertices; ++v25 ) |
0 | 1271 { |
1272 if ( v31 >= 2 ) | |
1273 break; | |
2101 | 1274 if ( v16 ^ (word_720B40_intercepts_zs[v25 + 1] >= v27) ) |
0 | 1275 { |
2101 | 1276 if ( word_720C10_intercepts_xs[v25 + 1] >= v26 ) |
0 | 1277 v20 = 0; |
1278 else | |
1279 v20 = 2; | |
2101 | 1280 v21 = v20 | (word_720C10_intercepts_xs[v25] < v26); |
0 | 1281 if ( v21 != 3 ) |
1282 { | |
2101 | 1283 v22 = word_720C10_intercepts_xs[v25 + 1] - word_720C10_intercepts_xs[v25]; |
1284 LODWORD(v23) = v22 << 16; | |
1285 HIDWORD(v23) = v22 >> 16; | |
0 | 1286 if ( !v21 |
2101 | 1287 || (word_720C10_intercepts_xs[v25] + ((signed int)(((unsigned __int64)(v23 |
1288 / (word_720B40_intercepts_zs[v25 + 1] - word_720B40_intercepts_zs[v25]) | |
1289 * ((v27 - (signed int)word_720B40_intercepts_zs[v25]) << 16)) >> 16) | |
1290 + 32768) >> 16) >= v26) ) | |
0 | 1291 ++v31; |
1292 } | |
1293 } | |
2101 | 1294 v16 = word_720B40_intercepts_zs[v25 + 1] >= v27; |
0 | 1295 } |
1296 result = 1; | |
1297 if ( v31 != 1 ) | |
1298 result = 0; | |
1299 return result; | |
1300 } | |
1301 | |
1302 //----- (004759C9) -------------------------------------------------------- | |
2101 | 1303 bool __fastcall sub_4759C9(BLVFace *face, int a2, int a3, __int16 a4) |
0 | 1304 { |
1305 bool v12; // edi@14 | |
1306 signed int v16; // ebx@18 | |
1307 int v17; // edi@20 | |
1308 signed int v18; // ST14_4@22 | |
1309 signed __int64 v19; // qtt@22 | |
1310 bool result; // eax@25 | |
1311 int v21; // [sp+14h] [bp-10h]@14 | |
1312 signed int v22; // [sp+18h] [bp-Ch]@1 | |
1313 int v23; // [sp+1Ch] [bp-8h]@2 | |
1314 signed int v24; // [sp+20h] [bp-4h]@2 | |
1315 signed int a4d; // [sp+30h] [bp+Ch]@14 | |
1316 | |
2101 | 1317 if ( face->uAttributes & FACE_XY_PLANE ) |
0 | 1318 { |
1319 v23 = (signed __int16)a3; | |
1320 v24 = SHIWORD(a3); | |
2101 | 1321 if ( face->uNumVertices ) |
0 | 1322 { |
2101 | 1323 for ( v22 = 0; v22 < face->uNumVertices; ++v22 ) |
0 | 1324 { |
2101 | 1325 word_720A70_intercepts_xs_plus_xs[2 * v22] = face->pXInterceptDisplacements[v22] + LOWORD(pOutdoor->pBModels[a2].pVertices.pVertices[face->pVertexIDs[v22]].x); |
1326 word_7209A0_intercepts_ys_plus_ys[2 * v22] = face->pYInterceptDisplacements[v22] + LOWORD(pOutdoor->pBModels[a2].pVertices.pVertices[face->pVertexIDs[v22]].y); | |
1327 word_720A70_intercepts_xs_plus_xs[2 * v22 + 1] = face->pXInterceptDisplacements[v22 + 1] + LOWORD(pOutdoor->pBModels[a2].pVertices.pVertices[face->pVertexIDs[v22 + 1]].x); | |
1328 word_7209A0_intercepts_ys_plus_ys[2 * v22 + 1] = face->pYInterceptDisplacements[v22 + 1] + LOWORD(pOutdoor->pBModels[a2].pVertices.pVertices[face->pVertexIDs[v22 + 1]].y); | |
0 | 1329 } |
1330 } | |
1331 } | |
1332 else | |
1333 { | |
2101 | 1334 if ( face->uAttributes & FACE_XZ_PLANE ) |
0 | 1335 { |
1336 v23 = (signed __int16)a3; | |
1337 v24 = a4; | |
2101 | 1338 if ( face->uNumVertices ) |
0 | 1339 { |
2101 | 1340 for ( v22 = 0; v22 < face->uNumVertices; ++v22 ) |
0 | 1341 { |
2101 | 1342 word_720A70_intercepts_xs_plus_xs[2 * v22] = face->pXInterceptDisplacements[v22] + LOWORD(pOutdoor->pBModels[a2].pVertices.pVertices[face->pVertexIDs[v22]].x); |
1343 word_7209A0_intercepts_ys_plus_ys[2 * v22] = face->pZInterceptDisplacements[v22] + LOWORD(pOutdoor->pBModels[a2].pVertices.pVertices[face->pVertexIDs[v22]].z); | |
1344 word_720A70_intercepts_xs_plus_xs[2 * v22 + 1] = face->pXInterceptDisplacements[v22 + 1] + LOWORD(pOutdoor->pBModels[a2].pVertices.pVertices[face->pVertexIDs[v22 + 1]].x); | |
1345 word_7209A0_intercepts_ys_plus_ys[2 * v22 + 1] = face->pZInterceptDisplacements[v22 + 1] + LOWORD(pOutdoor->pBModels[a2].pVertices.pVertices[face->pVertexIDs[v22 + 1]].z); | |
0 | 1346 } |
1347 } | |
1348 } | |
1349 else | |
1350 { | |
1351 v23 = SHIWORD(a3); | |
1352 v24 = a4; | |
2101 | 1353 if ( face->uNumVertices ) |
0 | 1354 { |
2101 | 1355 for ( v22 = 0; v22 < face->uNumVertices; ++v22 ) |
0 | 1356 { |
2101 | 1357 word_720A70_intercepts_xs_plus_xs[2 * v22] = face->pYInterceptDisplacements[v22] + LOWORD(pOutdoor->pBModels[a2].pVertices.pVertices[face->pVertexIDs[v22]].y); |
1358 word_7209A0_intercepts_ys_plus_ys[2 * v22] = face->pZInterceptDisplacements[v22] + LOWORD(pOutdoor->pBModels[a2].pVertices.pVertices[face->pVertexIDs[v22]].z); | |
1359 word_720A70_intercepts_xs_plus_xs[2 * v22 + 1] = face->pYInterceptDisplacements[v22 + 1] + LOWORD(pOutdoor->pBModels[a2].pVertices.pVertices[face->pVertexIDs[v22 + 1]].y); | |
1360 word_7209A0_intercepts_ys_plus_ys[2 * v22 + 1] = face->pZInterceptDisplacements[v22 + 1] + LOWORD(pOutdoor->pBModels[a2].pVertices.pVertices[face->pVertexIDs[v22 + 1]].z); | |
0 | 1361 } |
1362 } | |
1363 } | |
1364 } | |
1365 a4d = 0; | |
2101 | 1366 word_720A70_intercepts_xs_plus_xs[2 * face->uNumVertices] = word_720A70_intercepts_xs_plus_xs[0]; |
1367 word_7209A0_intercepts_ys_plus_ys[2 * face->uNumVertices] = word_7209A0_intercepts_ys_plus_ys[0]; | |
0 | 1368 v12 = word_7209A0_intercepts_ys_plus_ys[0] >= v24; |
2101 | 1369 if ( 2 * face->uNumVertices <= 0 ) |
1418 | 1370 return 0; |
2101 | 1371 for ( v21 = 0; v21 < 2 * face->uNumVertices; ++v21 ) |
0 | 1372 { |
1373 if ( a4d >= 2 ) | |
1374 break; | |
2101 | 1375 if ( v12 ^ (word_7209A0_intercepts_ys_plus_ys[v21 + 1] >= v24) ) |
0 | 1376 { |
2101 | 1377 if ( word_720A70_intercepts_xs_plus_xs[v21 + 1] >= v23 ) |
0 | 1378 v16 = 0; |
1379 else | |
1380 v16 = 2; | |
2101 | 1381 v17 = v16 | (word_720A70_intercepts_xs_plus_xs[v21] < v23); |
0 | 1382 if ( v17 != 3 ) |
1383 { | |
2101 | 1384 v18 = word_720A70_intercepts_xs_plus_xs[v21 + 1] - word_720A70_intercepts_xs_plus_xs[v21]; |
1385 LODWORD(v19) = v18 << 16; | |
1386 HIDWORD(v19) = v18 >> 16; | |
0 | 1387 if ( !v17 |
2101 | 1388 || (word_720A70_intercepts_xs_plus_xs[v21] + ((signed int)(((unsigned __int64)(v19 |
1389 / (word_7209A0_intercepts_ys_plus_ys[v21 + 1] - word_7209A0_intercepts_ys_plus_ys[v21]) | |
1390 * ((v24 - (signed int)word_7209A0_intercepts_ys_plus_ys[v21]) << 16)) >> 16) | |
2207 | 1391 + 0x8000) >> 16) >= v23) ) |
0 | 1392 ++a4d; |
1393 } | |
1394 } | |
2101 | 1395 v12 = word_7209A0_intercepts_ys_plus_ys[v21 + 1] >= v24; |
0 | 1396 } |
1397 result = 1; | |
1398 if ( a4d != 1 ) | |
1399 result = 0; | |
1400 return result; | |
1401 } | |
1402 | |
1403 //----- (00475D85) -------------------------------------------------------- | |
1404 bool __fastcall sub_475D85(Vec3_int_ *a1, Vec3_int_ *a2, int *a3, BLVFace *a4) | |
1405 { | |
1406 BLVFace *v4; // ebx@1 | |
1407 int v5; // ST24_4@2 | |
1408 int v6; // ST28_4@2 | |
1409 int v7; // edi@2 | |
1410 int v8; // eax@5 | |
1411 signed int v9; // esi@5 | |
1412 signed __int64 v10; // qtt@10 | |
1413 Vec3_int_ *v11; // esi@11 | |
1414 int v12; // ST14_4@11 | |
1415 Vec3_int_ *v14; // [sp+Ch] [bp-18h]@1 | |
1416 Vec3_int_ *v15; // [sp+14h] [bp-10h]@1 | |
2334 | 1417 // int v16; // [sp+18h] [bp-Ch]@2 |
0 | 1418 int v17; // [sp+20h] [bp-4h]@10 |
1419 int a4b; // [sp+30h] [bp+Ch]@2 | |
1420 int a4c; // [sp+30h] [bp+Ch]@9 | |
1421 signed int a4a; // [sp+30h] [bp+Ch]@10 | |
1422 | |
1423 v4 = a4; | |
1424 v15 = a2; | |
1425 v14 = a1; | |
2207 | 1426 v5 = fixpoint_mul(a2->x, a4->pFacePlane_old.vNormal.x); |
1427 a4b = fixpoint_mul(a2->y, a4->pFacePlane_old.vNormal.y); | |
1428 v6 = fixpoint_mul(a2->z, v4->pFacePlane_old.vNormal.z); | |
1429 v7 = v5 + v6 + a4b; | |
1430 //(v16 = v5 + v6 + a4b) == 0; | |
1431 if ( a4->uAttributes & 0x20000000 || !v7 || v7 > 0 && !v4->Portal()) | |
0 | 1432 return 0; |
1433 v8 = v4->pFacePlane_old.vNormal.z * a1->z; | |
1434 v9 = -(v4->pFacePlane_old.dist + v8 + a1->y * v4->pFacePlane_old.vNormal.y + a1->x * v4->pFacePlane_old.vNormal.x); | |
1435 if ( v7 <= 0 ) | |
1436 { | |
1437 if ( v4->pFacePlane_old.dist + v8 + a1->y * v4->pFacePlane_old.vNormal.y + a1->x * v4->pFacePlane_old.vNormal.x < 0 ) | |
1438 return 0; | |
1439 } | |
1440 else | |
1441 { | |
1442 if ( v9 < 0 ) | |
1443 return 0; | |
1444 } | |
1445 a4c = abs(-(v4->pFacePlane_old.dist + v8 + a1->y * v4->pFacePlane_old.vNormal.y + a1->x * v4->pFacePlane_old.vNormal.x)) >> 14; | |
2207 | 1446 v11 = v14; |
1447 LODWORD(v10) = v9 << 16; | |
1448 HIDWORD(v10) = v9 >> 16; | |
1449 a4a = v10 / v7; | |
1450 v17 = v10 / v7; | |
1451 LOWORD(v12) = LOWORD(v14->x) + (((unsigned int)fixpoint_mul(v17, v15->x) + 0x8000) >> 16); | |
1452 HIWORD(v12) = LOWORD(v11->y) + (((unsigned int)fixpoint_mul(v17, v15->y) + 0x8000) >> 16); | |
1453 if ( a4c > abs(v7) || ( v17 > *a3 << 16) || !sub_475665(v4, v12, LOWORD(v11->z) + (((unsigned int)fixpoint_mul(v17, v15->z) + 0x8000) >> 16)) ) | |
0 | 1454 return 0; |
1455 *a3 = a4a >> 16; | |
1456 return 1; | |
1457 } | |
1458 | |
1459 //----- (00475F30) -------------------------------------------------------- | |
1460 bool __fastcall sub_475F30(int *a1, BLVFace *a2, int a3, int a4, int a5, int a6, int a7, int a8, int a9) | |
1461 { | |
1462 int v10; // ST20_4@2 | |
1463 int v11; // ST28_4@2 | |
1464 int v12; // ST24_4@2 | |
2207 | 1465 int v13; // zf@2 |
0 | 1466 int v14; // edi@2 |
1467 signed int v16; // esi@5 | |
1468 int v17; // ST20_4@9 | |
1469 signed __int64 v18; // qtt@10 | |
1470 int v19; // ST14_4@11 | |
1471 int v22; // [sp+1Ch] [bp-8h]@2 | |
1472 int v23; // [sp+1Ch] [bp-8h]@10 | |
1473 signed int v24; // [sp+20h] [bp-4h]@10 | |
1474 | |
2207 | 1475 v10 = fixpoint_mul(a6, a2->pFacePlane_old.vNormal.x); |
1476 v11 = fixpoint_mul(a7, a2->pFacePlane_old.vNormal.y); | |
1477 v12 = fixpoint_mul(a8, a2->pFacePlane_old.vNormal.z); | |
1478 v13 = v10 + v12 + v11; | |
1479 v14 = v10 + v12 + v11; | |
1480 v22 = v10 + v12 + v11; | |
1481 if ( a2->Ethereal() || !v13 || v14 > 0 && !a2->Portal()) | |
0 | 1482 return 0; |
2101 | 1483 v16 = -(a2->pFacePlane_old.dist + a4 * a2->pFacePlane_old.vNormal.y + a3 * a2->pFacePlane_old.vNormal.x + a5 * a2->pFacePlane_old.vNormal.z); |
0 | 1484 if ( v14 <= 0 ) |
1485 { | |
2101 | 1486 if ( a2->pFacePlane_old.dist + a4 * a2->pFacePlane_old.vNormal.y + a3 * a2->pFacePlane_old.vNormal.x + a5 * a2->pFacePlane_old.vNormal.z < 0 ) |
0 | 1487 return 0; |
1488 } | |
1489 else | |
1490 { | |
1491 if ( v16 < 0 ) | |
1492 return 0; | |
1493 } | |
2101 | 1494 v17 = abs(-(a2->pFacePlane_old.dist + a4 * a2->pFacePlane_old.vNormal.y + a3 * a2->pFacePlane_old.vNormal.x + a5 * a2->pFacePlane_old.vNormal.z)) >> 14; |
2207 | 1495 LODWORD(v18) = v16 << 16; |
1496 HIDWORD(v18) = v16 >> 16; | |
1497 v24 = v18 / v22; | |
1498 v23 = v18 / v22; | |
1499 LOWORD(v19) = a3 + (((unsigned int)fixpoint_mul(v23, a6) + 0x8000) >> 16); | |
1500 HIWORD(v19) = a4 + (((unsigned int)fixpoint_mul(v23, a7) + 0x8000) >> 16); | |
1501 if ( v17 > abs(v14) || v23 > *a1 << 16 || !sub_4759C9(a2, a9, v19, a5 + (((unsigned int)fixpoint_mul(v23, a8) + 0x8000) >> 16)) ) | |
0 | 1502 return 0; |
2085 | 1503 *a1 = v24 >> 16; |
0 | 1504 return 1; |
1505 } | |
1506 | |
1507 //----- (004760D5) -------------------------------------------------------- | |
1508 PartyAction ActionQueue::Next() | |
1509 { | |
1510 if (!uNumActions) | |
1511 return PARTY_INVALID; | |
1512 | |
1980 | 1513 PartyAction result = pActions[0]; |
0 | 1514 for (unsigned int i = 0; i < uNumActions - 1; ++i) |
1515 pActions[i] = pActions[i + 1]; | |
1516 --uNumActions; | |
1517 | |
1518 return result; | |
1519 } | |
1520 | |
1521 //----- (004775ED) -------------------------------------------------------- | |
1522 int stru6_stru1_indoor_sw_billboard::_4775ED(float a2) | |
1523 { | |
1524 char *v2; // edi@1 | |
2206 | 1525 //int v3; // eax@1 |
0 | 1526 char *v4; // edx@2 |
1527 char *v5; // esi@3 | |
1528 double v6; // st7@6 | |
1529 signed __int64 v7; // ST84_8@6 | |
1530 double v8; // ST0C_8@6 | |
1531 int v9; // esi@6 | |
1532 double v10; // ST44_8@6 | |
1533 int v11; // ecx@6 | |
1534 double v12; // ST34_8@6 | |
1535 int v13; // ecx@6 | |
1536 double v14; // ST14_8@6 | |
1537 double v15; // st7@8 | |
1538 unsigned int v16; // ecx@8 | |
1539 signed __int64 v17; // ST64_8@8 | |
1540 double v18; // ST24_8@8 | |
1541 int v19; // edi@8 | |
1542 double v20; // ST3C_8@8 | |
1543 int v21; // ecx@8 | |
1544 double v22; // ST2C_8@8 | |
1545 int v23; // ST9C_4@8 | |
1546 double v24; // ST1C_8@8 | |
1547 int *v25; // edi@8 | |
1548 int v26; // esi@8 | |
1549 int *v27; // edi@10 | |
1550 int v28; // esi@10 | |
2334 | 1551 // int result; // eax@12 |
0 | 1552 __int64 v30; // [sp+A8h] [bp-30h]@8 |
1553 float v31; // [sp+B0h] [bp-28h]@6 | |
1554 float v32; // [sp+B4h] [bp-24h]@6 | |
1555 int v33; // [sp+B8h] [bp-20h]@6 | |
1556 int v34; // [sp+BCh] [bp-1Ch]@2 | |
1557 stru6_stru1_indoor_sw_billboard *v35; // [sp+C0h] [bp-18h]@1 | |
1558 float v36; // [sp+C4h] [bp-14h]@6 | |
1559 int v37; // [sp+C8h] [bp-10h]@6 | |
1560 int v38; // [sp+CCh] [bp-Ch]@1 | |
1561 float v39; // [sp+D0h] [bp-8h]@6 | |
1562 int *v40; // [sp+D4h] [bp-4h]@2 | |
1563 | |
2204 | 1564 // __debugbreak();//íóæíî ïî÷èñòèòü, ñðàáàòûâàåò ïðè ïðèìåíåíèè çàêëà Òî÷å÷íûé âçðûâ è ïðè ñòðåëüáå èç æåçëà |
1390 | 1565 v2 = (char *)&this->field_64[4 * this->uNumVertices]; |
0 | 1566 v38 = 0; |
1390 | 1567 *(int *)v2 = this->field_64[0]; |
0 | 1568 v2 += 4; |
1390 | 1569 *(int *)v2 = this->field_64[1]; |
0 | 1570 v2 += 4; |
1390 | 1571 *(int *)v2 = this->field_64[2]; |
1572 *((int *)v2 + 1) = this->field_64[3]; | |
2206 | 1573 //v3 = this->uNumVertices; |
0 | 1574 v35 = this; |
2206 | 1575 if ( this->uNumVertices > 0 ) |
0 | 1576 { |
1390 | 1577 v40 = &this->field_64[20]; |
1578 v4 = (char *)&this->field_64[3] + 3; | |
2206 | 1579 |
1580 //while ( 1 ) | |
1581 for ( v34 = this->uNumVertices; v34; --v34 ) | |
0 | 1582 { |
1583 v5 = v4 - 15; | |
1584 if ( *(float *)(v4 - 15) <= (double)a2 && *(float *)(v4 + 1) <= (double)a2 ) | |
1418 | 1585 { |
1586 v4 += 16; | |
2206 | 1587 //--v34; |
1588 //if ( !v34 ) | |
1589 //return this->uNumVertices = v38; | |
1418 | 1590 continue; |
1591 } | |
0 | 1592 if ( *(float *)v5 <= (double)a2 ) |
1418 | 1593 { |
1594 v6 = (a2 - *(float *)v5) / (*(float *)(v4 + 1) - *(float *)v5); | |
1595 v7 = (unsigned __int8)v4[16] - (unsigned int)(unsigned __int8)*v4; | |
1596 v36 = v6; | |
1597 v31 = (*(float *)(v4 + 5) - *(float *)(v4 - 11)) * v6 + *(float *)(v4 - 11); | |
1598 v32 = (*(float *)(v4 + 9) - *(float *)(v4 - 7)) * v6 + *(float *)(v4 - 7); | |
1599 *(float *)&v37 = (double)v7 * v6; | |
1600 v8 = *(float *)&v37 + 6.7553994e15; | |
1601 v9 = (unsigned __int8)*v4; | |
1602 *(float *)&v37 = (double)((unsigned __int8)v4[15] - (unsigned int)(unsigned __int8)*(v4 - 1)) * v36; | |
1603 v10 = *(float *)&v37 + 6.7553994e15; | |
1604 v11 = (unsigned __int8)*(v4 - 2); | |
1605 v37 = LODWORD(v10) + (unsigned __int8)*(v4 - 1); | |
1606 v39 = (double)((unsigned int)(unsigned __int8)v4[14] - v11) * v36; | |
1607 v12 = v39 + 6.7553994e15; | |
1608 v13 = LODWORD(v12) + (unsigned __int8)*(v4 - 2); | |
1609 v39 = (double)((*(int *)(v4 + 13) & 0xFF) - (*(int *)(v4 - 3) & 0xFFu)) * v36; | |
1610 v14 = v39 + 6.7553994e15; | |
1611 v33 = (LODWORD(v14) + (*(int *)(v4 - 3) & 0xFF)) | ((v13 | ((v37 | ((LODWORD(v8) + v9) << 8)) << 8)) << 8); | |
1612 //this = v35; | |
1613 v5 = (char *)&v30 + 4; | |
1614 } | |
1615 else if ( *(float *)(v4 + 1) <= (double)a2 ) | |
0 | 1616 { |
1617 v15 = (a2 - *(float *)v5) / (*(float *)(v4 + 1) - *(float *)v5); | |
1618 v16 = (unsigned __int8)*v4; | |
1619 HIDWORD(v30) = LODWORD(a2); | |
1620 v17 = (unsigned __int8)v4[16] - v16; | |
1621 v36 = v15; | |
1622 v31 = (*(float *)(v4 + 5) - *(float *)(v4 - 11)) * v15 + *(float *)(v4 - 11); | |
1623 v32 = (*(float *)(v4 + 9) - *(float *)(v4 - 7)) * v15 + *(float *)(v4 - 7); | |
1624 v39 = (double)v17 * v15; | |
1625 v18 = v39 + 6.7553994e15; | |
1626 v19 = (unsigned __int8)*v4; | |
1627 v39 = (double)((unsigned __int8)v4[15] - (unsigned int)(unsigned __int8)*(v4 - 1)) * v36; | |
1628 v20 = v39 + 6.7553994e15; | |
1629 v21 = (unsigned __int8)*(v4 - 2); | |
1630 v37 = LODWORD(v20) + (unsigned __int8)*(v4 - 1); | |
1631 v39 = (double)((unsigned int)(unsigned __int8)v4[14] - v21) * v36; | |
1632 v22 = v39 + 6.7553994e15; | |
1633 v23 = LODWORD(v22) + (unsigned __int8)*(v4 - 2); | |
1634 v39 = (double)((*(int *)(v4 + 13) & 0xFF) - (*(int *)(v4 - 3) & 0xFFu)) * v36; | |
1635 v24 = v39 + 6.7553994e15; | |
1636 v33 = (LODWORD(v24) + (*(int *)(v4 - 3) & 0xFF)) | ((v23 | ((v37 | ((LODWORD(v18) + v19) << 8)) << 8)) << 8); | |
1637 v25 = v40; | |
1638 *v40 = *(int *)v5; | |
1639 v26 = (int)(v5 + 4); | |
1640 ++v25; | |
1641 *v25 = *(int *)v26; | |
1642 v26 += 4; | |
1643 ++v25; | |
1644 ++v38; | |
1645 v40 += 4; | |
1646 *v25 = *(int *)v26; | |
1647 v25[1] = *(int *)(v26 + 4); | |
1418 | 1648 v5 = (char *)&v30 + 4; |
0 | 1649 } |
1650 v27 = v40; | |
1651 ++v38; | |
1652 *v40 = *(int *)v5; | |
1653 v28 = (int)(v5 + 4); | |
1654 ++v27; | |
1655 *v27 = *(int *)v28; | |
1656 v28 += 4; | |
1657 ++v27; | |
1658 v40 += 4; | |
1659 *v27 = *(int *)v28; | |
1660 v27[1] = *(int *)(v28 + 4); | |
1661 v4 += 16; | |
2206 | 1662 //--v34; |
1663 //if ( !v34 ) | |
1664 //return this->uNumVertices = v38; | |
0 | 1665 } |
1418 | 1666 } |
1390 | 1667 return this->uNumVertices = v38; |
0 | 1668 } |
1669 | |
1670 //----- (00477927) -------------------------------------------------------- | |
1671 int stru6_stru1_indoor_sw_billboard::_477927(float a2) | |
1672 { | |
1673 char *v2; // edi@1 | |
1674 int v3; // eax@1 | |
1675 char *v4; // edx@2 | |
1676 char *v5; // esi@3 | |
1677 double v6; // st7@6 | |
1678 signed __int64 v7; // ST84_8@6 | |
1679 double v8; // ST0C_8@6 | |
1680 int v9; // esi@6 | |
1681 double v10; // ST44_8@6 | |
1682 int v11; // ecx@6 | |
1683 double v12; // ST34_8@6 | |
1684 int v13; // ecx@6 | |
1685 double v14; // ST14_8@6 | |
1686 double v15; // st7@8 | |
1687 unsigned int v16; // ecx@8 | |
1688 signed __int64 v17; // ST64_8@8 | |
1689 double v18; // ST24_8@8 | |
1690 int v19; // edi@8 | |
1691 double v20; // ST3C_8@8 | |
1692 int v21; // ecx@8 | |
1693 double v22; // ST2C_8@8 | |
1694 int v23; // ST9C_4@8 | |
1695 double v24; // ST1C_8@8 | |
1696 int *v25; // edi@8 | |
1697 int v26; // esi@8 | |
1698 int *v27; // edi@10 | |
1699 int v28; // esi@10 | |
2334 | 1700 // int result; // eax@12 |
0 | 1701 __int64 v30; // [sp+A8h] [bp-30h]@8 |
1702 float v31; // [sp+B0h] [bp-28h]@6 | |
1703 float v32; // [sp+B4h] [bp-24h]@6 | |
1704 int v33; // [sp+B8h] [bp-20h]@6 | |
1705 int v34; // [sp+BCh] [bp-1Ch]@2 | |
1706 stru6_stru1_indoor_sw_billboard *v35; // [sp+C0h] [bp-18h]@1 | |
1707 float v36; // [sp+C4h] [bp-14h]@6 | |
1708 int v37; // [sp+C8h] [bp-10h]@6 | |
1709 int v38; // [sp+CCh] [bp-Ch]@1 | |
1710 float v39; // [sp+D0h] [bp-8h]@6 | |
1711 int *v40; // [sp+D4h] [bp-4h]@2 | |
1712 | |
2101 | 1713 __debugbreak();//íóæíî ïî÷èñòèòü |
1390 | 1714 v2 = (char *)&this->field_64[4 * this->uNumVertices]; |
0 | 1715 v38 = 0; |
1390 | 1716 *(int *)v2 = this->field_64[0]; |
0 | 1717 v2 += 4; |
1390 | 1718 *(int *)v2 = this->field_64[1]; |
0 | 1719 v2 += 4; |
1390 | 1720 *(int *)v2 = this->field_64[2]; |
1721 *((int *)v2 + 1) = this->field_64[3]; | |
1722 v3 = this->uNumVertices; | |
0 | 1723 v35 = this; |
1724 if ( v3 > 0 ) | |
1725 { | |
1390 | 1726 v40 = &this->field_64[20]; |
1727 v4 = (char *)&this->field_64[3] + 3; | |
0 | 1728 v34 = v3; |
1729 while ( 1 ) | |
1730 { | |
1731 v5 = v4 - 15; | |
1732 if ( *(float *)(v4 - 15) >= (double)a2 && *(float *)(v4 + 1) >= (double)a2 ) | |
1418 | 1733 { |
1734 v4 += 16; | |
1735 --v34; | |
1736 if ( !v34 ) | |
1737 return this->uNumVertices = v38; | |
1738 continue; | |
1739 } | |
0 | 1740 if ( *(float *)v5 >= (double)a2 ) |
1418 | 1741 { |
1742 v6 = (a2 - *(float *)v5) / (*(float *)(v4 + 1) - *(float *)v5); | |
1743 v7 = (unsigned __int8)v4[16] - (unsigned int)(unsigned __int8)*v4; | |
1744 v36 = v6; | |
1745 v31 = (*(float *)(v4 + 5) - *(float *)(v4 - 11)) * v6 + *(float *)(v4 - 11); | |
1746 v32 = (*(float *)(v4 + 9) - *(float *)(v4 - 7)) * v6 + *(float *)(v4 - 7); | |
1747 *(float *)&v37 = (double)v7 * v6; | |
1748 v8 = *(float *)&v37 + 6.7553994e15; | |
1749 v9 = (unsigned __int8)*v4; | |
1750 *(float *)&v37 = (double)((unsigned __int8)v4[15] - (unsigned int)(unsigned __int8)*(v4 - 1)) * v36; | |
1751 v10 = *(float *)&v37 + 6.7553994e15; | |
1752 v11 = (unsigned __int8)*(v4 - 2); | |
1753 v37 = LODWORD(v10) + (unsigned __int8)*(v4 - 1); | |
1754 v39 = (double)((unsigned int)(unsigned __int8)v4[14] - v11) * v36; | |
1755 v12 = v39 + 6.7553994e15; | |
1756 v13 = LODWORD(v12) + (unsigned __int8)*(v4 - 2); | |
1757 v39 = (double)((*(int *)(v4 + 13) & 0xFF) - (*(int *)(v4 - 3) & 0xFFu)) * v36; | |
1758 v14 = v39 + 6.7553994e15; | |
1759 v33 = (LODWORD(v14) + (*(int *)(v4 - 3) & 0xFF)) | ((v13 | ((v37 | ((LODWORD(v8) + v9) << 8)) << 8)) << 8); | |
1760 //this = v35; | |
1761 v5 = (char *)&v30 + 4; | |
1762 } | |
1763 else if ( *(float *)(v4 + 1) >= (double)a2 ) | |
0 | 1764 { |
1765 v15 = (a2 - *(float *)v5) / (*(float *)(v4 + 1) - *(float *)v5); | |
1766 v16 = (unsigned __int8)*v4; | |
1767 HIDWORD(v30) = LODWORD(a2); | |
1768 v17 = (unsigned __int8)v4[16] - v16; | |
1769 v36 = v15; | |
1770 v31 = (*(float *)(v4 + 5) - *(float *)(v4 - 11)) * v15 + *(float *)(v4 - 11); | |
1771 v32 = (*(float *)(v4 + 9) - *(float *)(v4 - 7)) * v15 + *(float *)(v4 - 7); | |
1772 v39 = (double)v17 * v15; | |
1773 v18 = v39 + 6.7553994e15; | |
1774 v19 = (unsigned __int8)*v4; | |
1775 v39 = (double)((unsigned __int8)v4[15] - (unsigned int)(unsigned __int8)*(v4 - 1)) * v36; | |
1776 v20 = v39 + 6.7553994e15; | |
1777 v21 = (unsigned __int8)*(v4 - 2); | |
1778 v37 = LODWORD(v20) + (unsigned __int8)*(v4 - 1); | |
1779 v39 = (double)((unsigned int)(unsigned __int8)v4[14] - v21) * v36; | |
1780 v22 = v39 + 6.7553994e15; | |
1781 v23 = LODWORD(v22) + (unsigned __int8)*(v4 - 2); | |
1782 v39 = (double)((*(int *)(v4 + 13) & 0xFF) - (*(int *)(v4 - 3) & 0xFFu)) * v36; | |
1783 v24 = v39 + 6.7553994e15; | |
1784 v33 = (LODWORD(v24) + (*(int *)(v4 - 3) & 0xFF)) | ((v23 | ((v37 | ((LODWORD(v18) + v19) << 8)) << 8)) << 8); | |
1785 v25 = v40; | |
1786 *v40 = *(int *)v5; | |
1787 v26 = (int)(v5 + 4); | |
1788 ++v25; | |
1789 *v25 = *(int *)v26; | |
1790 v26 += 4; | |
1791 ++v25; | |
1792 ++v38; | |
1793 v40 += 4; | |
1794 *v25 = *(int *)v26; | |
1795 v25[1] = *(int *)(v26 + 4); | |
1418 | 1796 v5 = (char *)&v30 + 4; |
0 | 1797 } |
1798 v27 = v40; | |
1799 ++v38; | |
1800 *v40 = *(int *)v5; | |
1801 v28 = (int)(v5 + 4); | |
1802 ++v27; | |
1803 *v27 = *(int *)v28; | |
1804 v28 += 4; | |
1805 ++v27; | |
1806 v40 += 4; | |
1807 *v27 = *(int *)v28; | |
1808 v27[1] = *(int *)(v28 + 4); | |
1809 v4 += 16; | |
1810 --v34; | |
1811 if ( !v34 ) | |
1418 | 1812 return this->uNumVertices = v38; |
0 | 1813 } |
1418 | 1814 } |
1390 | 1815 return this->uNumVertices = v38; |
0 | 1816 } |
1817 | |
1818 //----- (00477C61) -------------------------------------------------------- | |
1819 int stru6_stru1_indoor_sw_billboard::sub_477C61() | |
1820 { | |
998 | 1821 //stru6_stru1_indoor_sw_billboard *v1; // ebx@1 |
0 | 1822 int v2; // ecx@2 |
1823 int v3; // eax@3 | |
1824 double v4; // st7@4 | |
1825 double v5; // st7@5 | |
1826 double v6; // st6@5 | |
1827 double v7; // st5@6 | |
1828 float v8; // ST30_4@8 | |
1829 float v9; // ST24_4@8 | |
1830 double v10; // st7@8 | |
1831 double v11; // st6@8 | |
1832 double v12; // st5@8 | |
1833 float v13; // ST24_4@13 | |
1834 int v14; // esi@13 | |
1835 char *v15; // esi@15 | |
1638
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
1836 //signed int v16; // eax@16 |
2334 | 1837 // __int16 v17; // fps@16 |
1838 // unsigned __int8 v18; // c2@16 | |
1839 // unsigned __int8 v19; // c3@16 | |
0 | 1840 double v20; // st6@16 |
1841 float v21; // ST18_4@17 | |
1842 float v22; // ST2C_4@17 | |
1843 float v23; // ST34_4@17 | |
1844 float v24; // ST24_4@17 | |
1845 double v25; // st7@17 | |
1846 double v26; // st6@17 | |
1847 float v27; // ST34_4@18 | |
1848 float v28; // ST30_4@18 | |
1849 int v29; // eax@19 | |
1850 signed int v31; // [sp+8h] [bp-28h]@15 | |
1851 float v32; // [sp+Ch] [bp-24h]@16 | |
1852 float v33; // [sp+14h] [bp-1Ch]@16 | |
1853 float v34; // [sp+18h] [bp-18h]@16 | |
1854 float v35; // [sp+1Ch] [bp-14h]@17 | |
1855 float v36; // [sp+20h] [bp-10h]@4 | |
1856 float v37; // [sp+24h] [bp-Ch]@4 | |
1857 float v38; // [sp+24h] [bp-Ch]@16 | |
1858 float v39; // [sp+28h] [bp-8h]@9 | |
1859 float v40; // [sp+28h] [bp-8h]@16 | |
1860 float v41; // [sp+2Ch] [bp-4h]@6 | |
1861 float v42; // [sp+2Ch] [bp-4h]@9 | |
1862 | |
2198 | 1863 //__debugbreak();//íóæíî ïî÷èñòèòü, ñðàáàòûâàåò ïðè ïðèìåíåíèè çàêëà Òî÷å÷íûé âçðûâ |
0 | 1864 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) |
1865 { | |
2198 | 1866 |
1390 | 1867 if ( this->uNumVertices > 0 ) |
998 | 1868 { |
1869 v3 = (int)&this->field_14[1]; | |
2198 | 1870 //do |
1871 for ( v2 = 0; v2 < this->uNumVertices; ++v2 ) | |
0 | 1872 { |
1873 v4 = *(float *)(v3 - 4); | |
1874 LODWORD(v37) = *(int *)v3; | |
1875 LODWORD(v36) = *(int *)(v3 + 4); | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
1876 if (pGame->pIndoorCameraD3D->sRotationX) |
0 | 1877 { |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
1878 v5 = v4 - (double)pGame->pIndoorCameraD3D->vPartyPos.x; |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
1879 v6 = v37 - (double)pGame->pIndoorCameraD3D->vPartyPos.y; |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
1880 //if ( pRenderer->pRenderD3D ) |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
1881 //{ |
1642 | 1882 v41 = pGame->pIndoorCameraD3D->fRotationYSine * v6 + pGame->pIndoorCameraD3D->fRotationYCosine * v5; |
1883 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
|
1884 /*} |
0 | 1885 else |
1886 { | |
1887 v41 = pBLVRenderParams->fCosineY * v5 - pBLVRenderParams->fSineY * v6; | |
1888 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
|
1889 }*/ |
0 | 1890 v8 = v7; |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
1891 v9 = v36 - (double)pGame->pIndoorCameraD3D->vPartyPos.z; |
1642 | 1892 v10 = pGame->pIndoorCameraD3D->fRotationXCosine * v41 - pGame->pIndoorCameraD3D->fRotationXSine * v9; |
0 | 1893 v11 = v8; |
1642 | 1894 v12 = pGame->pIndoorCameraD3D->fRotationXCosine * v9 + pGame->pIndoorCameraD3D->fRotationXSine * v41; |
0 | 1895 } |
1896 else | |
1897 { | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
1898 v42 = v4 - (double)pGame->pIndoorCameraD3D->vPartyPos.x; |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
1899 v39 = v37 - (double)pGame->pIndoorCameraD3D->vPartyPos.y; |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
1900 //if ( pRenderer->pRenderD3D ) |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
1901 //{ |
1642 | 1902 v10 = pGame->pIndoorCameraD3D->fRotationYSine * v39 + pGame->pIndoorCameraD3D->fRotationYCosine * v42; |
1903 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
|
1904 /*} |
0 | 1905 else |
1906 { | |
1907 v10 = pBLVRenderParams->fCosineY * v42 - pBLVRenderParams->fSineY * v39; | |
1908 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
|
1909 }*/ |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
1910 v12 = v36 - (double)pGame->pIndoorCameraD3D->vPartyPos.z; |
0 | 1911 } |
1912 v13 = v12; | |
2198 | 1913 //++v2; |
0 | 1914 *(int *)(v3 + 84) = LODWORD(v13); |
1915 v14 = *(int *)(v3 + 8); | |
1916 *(float *)(v3 + 76) = v10; | |
1917 *(int *)(v3 + 88) = v14; | |
1918 *(float *)(v3 + 80) = v11; | |
1919 v3 += 16; | |
1920 } | |
2198 | 1921 //while ( v2 < this->uNumVertices ); |
0 | 1922 } |
1923 } | |
1924 else | |
1925 { | |
1926 v15 = (char *)&this->field_14[1]; | |
2198 | 1927 //do |
1928 for ( v31 = 3; v31; --v31 ) | |
0 | 1929 { |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
1930 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
|
1931 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
|
1932 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
|
1933 v33 = (double)stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationY) * 0.0000152587890625; |
1638
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
1934 //v16 = stru_5C6E00->Sin(pODMRenderParams->rotation_y); |
0 | 1935 LODWORD(v38) = *(int *)v15; |
1936 //UNDEF(v17); | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
1937 v20 = *((float *)v15 - 1) - (double)pGame->pIndoorCameraD3D->vPartyPos.x; |
1090 | 1938 //if ( v19 | v18 ) |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
1939 if (pGame->pIndoorCameraD3D->vPartyPos.x == 0) |
0 | 1940 { |
1941 v27 = v20; | |
1942 LODWORD(v35) = *((int *)v15 + 1); | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
1943 v28 = v38 - (double)pGame->pIndoorCameraD3D->vPartyPos.y; |
0 | 1944 v25 = v33 * v28 + v34 * v27; |
1945 v26 = v34 * v28 - v33 * v27; | |
1946 } | |
1947 else | |
1948 { | |
1949 v21 = v20; | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
1950 v22 = v38 - (double)pGame->pIndoorCameraD3D->vPartyPos.y; |
0 | 1951 v23 = v33 * v22 + v34 * v21; |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
1952 v24 = *((float *)v15 + 1) - (double)pGame->pIndoorCameraD3D->vPartyPos.z; |
0 | 1953 v25 = v32 * v24 + v40 * v23; |
1954 v26 = v34 * v22 - v33 * v21; | |
1955 v35 = v40 * v24 - v32 * v23; | |
1956 } | |
1957 *((int *)v15 + 21) = LODWORD(v35); | |
1958 v29 = *((int *)v15 + 2); | |
1959 *((float *)v15 + 19) = v25; | |
1960 *((int *)v15 + 22) = v29; | |
1961 *((float *)v15 + 20) = v26; | |
1962 v15 += 16; | |
2198 | 1963 //--v31; |
0 | 1964 } |
2198 | 1965 //while ( v31 ); |
0 | 1966 } |
1390 | 1967 this->uNumVertices = 3; |
0 | 1968 return 1; |
1969 } | |
1970 | |
1971 //----- (00477F63) -------------------------------------------------------- | |
1972 bool stru6_stru1_indoor_sw_billboard::sub_477F63() | |
1973 { | |
1974 signed int v1; // ebx@1 | |
1975 double v3; // st7@2 | |
2184 | 1976 //int v4; // edx@4 |
0 | 1977 char *v5; // ecx@5 |
1978 int v6; // edi@5 | |
1979 float v7; // ST08_4@13 | |
1980 signed int v9; // [sp+Ch] [bp-8h]@1 | |
1981 float v10; // [sp+10h] [bp-4h]@2 | |
1982 | |
2204 | 1983 //__debugbreak();// ïî÷èñòèòü |
0 | 1984 v1 = 0; |
1985 v9 = 0; | |
1986 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) | |
1987 { | |
1988 v10 = 16192.0; | |
1641 | 1989 v3 = (double)pBLVRenderParams->fov_rad_fixpoint * 0.000015258789; |
0 | 1990 } |
2184 | 1991 else if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) |
0 | 1992 { |
1637 | 1993 v10 = (double)pODMRenderParams->shading_dist_mist; |
0 | 1994 v3 = 8.0; |
1995 } | |
2184 | 1996 else |
1997 __debugbreak();//Error | |
1998 if ( this->uNumVertices <= 0 ) | |
1418 | 1999 { |
2184 | 2000 memcpy(&this->field_14[40], &this->field_14[20], 16 * this->uNumVertices); |
2101 | 2001 return this->uNumVertices != 0; |
1418 | 2002 } |
2101 | 2003 v5 = (char *)&this->field_14[20]; |
2184 | 2004 for ( v6 = 0; v6 < this->uNumVertices; v6++ ) |
0 | 2005 { |
2006 if ( v3 >= *(float *)v5 || *(float *)v5 >= (double)v10 ) | |
2007 { | |
2008 if ( v3 < *(float *)v5 ) | |
2009 v9 = 1; | |
2010 else | |
2011 v1 = 1; | |
2012 } | |
2013 v5 += 16; | |
2014 } | |
2015 if ( !v1 ) | |
2016 { | |
2017 if ( v9 ) | |
2018 { | |
2101 | 2019 this->_477927(v10); |
2020 return this->uNumVertices != 0; | |
0 | 2021 } |
2184 | 2022 memcpy(&this->field_14[40], &this->field_14[20], 16 * this->uNumVertices); |
2101 | 2023 return this->uNumVertices != 0; |
0 | 2024 } |
2025 v7 = v3; | |
2026 _4775ED(v7); | |
2101 | 2027 return this->uNumVertices != 0; |
0 | 2028 } |
2029 | |
2030 //----- (0047802A) -------------------------------------------------------- | |
2031 int stru6_stru1_indoor_sw_billboard::sub_47802A() | |
2032 { | |
2033 double v6; // st7@4 | |
2034 signed int v16; // [sp+38h] [bp-Ch]@1 | |
2035 int a6; // [sp+3Ch] [bp-8h]@5 | |
2036 int a5; // [sp+40h] [bp-4h]@5 | |
2037 | |
2204 | 2038 // __debugbreak(); //íåîáõîäèìî ïðîâåðèòü this->field_B4[i*4+16] |
0 | 2039 v16 = 0; |
2040 if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) | |
2041 { | |
2101 | 2042 for(int i = 0; i < this->uNumVertices; i++) |
1117
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
2043 { |
2101 | 2044 v6 = (double)pBLVRenderParams->fov_rad_fixpoint * 0.000015258789 / this->field_B4[i*4]; |
2154 | 2045 //if ( pRenderer->pRenderD3D ) |
2101 | 2046 { |
2125 | 2047 pGame->pIndoorCameraD3D->Project(round_to_int(this->field_B4[i*4]), round_to_int(this->field_B4[i*4+1]), round_to_int(this->field_B4[i*4+2]), |
2101 | 2048 &a5, &a6); |
2049 this->field_B4[i*4+16] = (double)a5; | |
2050 this->field_B4[i*4+17] = (double)a6; | |
2125 | 2051 this->field_B4[i*4+18] = round_to_int(this->field_B4[i*4]); |
2101 | 2052 } |
2154 | 2053 /*else |
2101 | 2054 { |
2055 this->field_B4[i*4+16] = (double)pBLVRenderParams->uViewportCenterX - v6 * this->field_B4[i*4+1]; | |
2056 this->field_B4[i*4+17] = (double)pBLVRenderParams->uViewportCenterY - v6 * this->field_B4[i*4+2]; | |
2057 this->field_B4[i*4+18] = this->field_B4[i*4]; | |
2154 | 2058 }*/ |
2101 | 2059 this->field_B4[i*4+19] = this->field_B4[i*4+3]; |
2060 if ( (double)(signed int)pViewport->uViewportTL_X <= this->field_B4[i*4+16] && (double)(signed int)pViewport->uViewportBR_X > this->field_B4[i*4+16] | |
2061 && (double)(signed int)pViewport->uViewportTL_Y <= this->field_B4[i*4+17] && (double)(signed int)pViewport->uViewportBR_Y > this->field_B4[i*4+17] ) | |
2062 v16 = 1; | |
1117
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
2063 } |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
2064 } |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
2065 else |
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
2066 { |
2101 | 2067 for(int i = 0; i < this->uNumVertices; i++) |
1117
ad89d1905b48
* stru6_stru1_indoor_sw_billboard::sub_47802A() cleaned, fireball working
zipi
parents:
1113
diff
changeset
|
2068 { |
2101 | 2069 this->field_B4[i*4+20] = (double)pViewport->uScreenCenterX - (double)pODMRenderParams->int_fov_rad / this->field_B4[i*4] * this->field_B4[i*4+1]; |
2070 this->field_B4[i*4+21] = (double)pViewport->uScreenCenterY - (double)pODMRenderParams->int_fov_rad / this->field_B4[i*4] * this->field_B4[i*4+2]; | |
2071 *((int *)&this->field_B4[i*4+22]) = (int)this->field_B4[i*4]; | |
2072 *((int *)&this->field_B4[i*4+23]) = this->field_B4[i*4+3]; | |
2073 if ( (double)(signed int)pViewport->uViewportTL_X <= this->field_B4[i*4+20] && (double)(signed int)pViewport->uViewportBR_X > this->field_B4[i*4+20] | |
2074 && (double)(signed int)pViewport->uViewportTL_Y <= this->field_B4[i*4+21] && (double)(signed int)pViewport->uViewportBR_Y > this->field_B4[i*4+21] ) | |
2075 v16 = 1; | |
0 | 2076 } |
2077 } | |
2078 return v16; | |
2079 } | |
2080 | |
2081 // 73C84C: using guessed type char static_RenderBuildingsD3D_byte_73C84C_init_flag; | |
2082 | |
2083 //----- (00479089) -------------------------------------------------------- | |
323 | 2084 bool __fastcall IsBModelVisible(unsigned int uModelID, int *reachable) |
0 | 2085 { |
2086 int v3; // edi@1 | |
2087 int v4; // ebx@1 | |
2088 int v9; // eax@3 | |
2089 signed int v11; // esi@6 | |
2090 int v12; // esi@8 | |
2091 bool result; // eax@9 | |
2092 int v17; // [sp+1Ch] [bp-10h]@1 | |
2093 int v19; // [sp+20h] [bp-Ch]@3 | |
2094 int angle; // [sp+24h] [bp-8h]@1 | |
2101 | 2095 |
2096 angle = (signed int)(pODMRenderParams->uCameraFovInDegrees << 11) / 360 / 2; | |
2097 v3 = pOutdoor->pBModels[uModelID].vBoundingCenter.x - pGame->pIndoorCameraD3D->vPartyPos.x; | |
2098 v4 = pOutdoor->pBModels[uModelID].vBoundingCenter.y - pGame->pIndoorCameraD3D->vPartyPos.y; | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2099 stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationX); |
2101 | 2100 v17 = v3 * stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationY) + v4 * stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationY); |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2101 if (pGame->pIndoorCameraD3D->sRotationX) |
2206 | 2102 v17 = fixpoint_mul(v17, stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationX)); |
2101 | 2103 v19 = v4 * stru_5C6E00->Cos(pGame->pIndoorCameraD3D->sRotationY) - v3 * stru_5C6E00->Sin(pGame->pIndoorCameraD3D->sRotationY); |
2104 v9 = int_get_vector_length(abs(v3), abs(v4), 0); | |
323 | 2105 //v10 = v14 * 188; |
2106 //v22 = v9; | |
2107 *reachable = false; | |
2108 if ( v9 < pOutdoor->pBModels[uModelID].sBoundingRadius + 256 ) | |
2109 *reachable = true; | |
0 | 2110 if ( v19 >= 0 ) |
2206 | 2111 v11 = fixpoint_mul(stru_5C6E00->Sin(angle), v17) - fixpoint_mul(stru_5C6E00->Cos(angle), v19); |
323 | 2112 else |
2206 | 2113 v11 = fixpoint_mul(stru_5C6E00->Cos(angle), v19) + fixpoint_mul(stru_5C6E00->Sin(angle), v17); |
0 | 2114 v12 = v11 >> 16; |
1637 | 2115 if ( v9 <= pODMRenderParams->shading_dist_mist + 2048 ) |
0 | 2116 { |
79 | 2117 //if ( abs(v12) > *(int *)((char *)&pOutdoor->pBModels->sBoundingRadius + v10) + 512 ) |
323 | 2118 if ( abs(v12) > pOutdoor->pBModels[uModelID].sBoundingRadius + 512 ) |
0 | 2119 { |
2120 result = v12 < 0; | |
2121 LOBYTE(result) = v12 >= 0; | |
323 | 2122 return result; |
2123 } | |
2124 else | |
2125 return true; | |
2126 } | |
2127 return false; | |
0 | 2128 } |
2129 | |
2130 //----- (00479295) -------------------------------------------------------- | |
1391
cc9a3a24d61d
Moved stru11, stru12 and some SW Rendering stuff to the archives.
Nomad
parents:
1390
diff
changeset
|
2131 int Polygon::_479295() |
0 | 2132 { |
2133 int v3; // ecx@4 | |
2134 int v4; // eax@4 | |
2135 int v5; // edx@4 | |
2334 | 2136 // int v6; // ST14_4@5 |
0 | 2137 Vec3_int_ thisa; // [sp+Ch] [bp-10h]@8 |
2138 int v11; // [sp+18h] [bp-4h]@4 | |
2139 | |
2101 | 2140 if ( !this->pODMFace->pFacePlane.vNormal.z ) |
0 | 2141 { |
2101 | 2142 v3 = this->pODMFace->pFacePlane.vNormal.x; |
2143 v4 = -this->pODMFace->pFacePlane.vNormal.y; | |
0 | 2144 v5 = 0; |
2145 v11 = 65536; | |
1418 | 2146 } |
2101 | 2147 else if ( (this->pODMFace->pFacePlane.vNormal.x || this->pODMFace->pFacePlane.vNormal.y) |
2148 && abs(this->pODMFace->pFacePlane.vNormal.z) < 59082 ) | |
0 | 2149 { |
2101 | 2150 thisa.x = -this->pODMFace->pFacePlane.vNormal.y; |
2151 thisa.y = this->pODMFace->pFacePlane.vNormal.x; | |
0 | 2152 thisa.z = 0; |
2153 thisa.Normalize_float(); | |
2154 v4 = thisa.x; | |
2155 v3 = thisa.y; | |
1418 | 2156 v5 = 0; |
2157 v11 = 65536; | |
2158 } | |
2159 else | |
2160 { | |
2161 v3 = 0; | |
2162 v4 = 65536; | |
2163 v11 = 0; | |
2164 v5 = -65536; | |
2165 } | |
2101 | 2166 sTextureDeltaU = this->pODMFace->sTextureDeltaU; |
2167 sTextureDeltaV = this->pODMFace->sTextureDeltaV; | |
2168 ptr_38->_48616B_frustum_odm(v4, v3, 0, 0, v5, v11); | |
0 | 2169 return 1; |
2170 } | |
2171 | |
2172 | |
168 | 2173 unsigned short *LoadTgaTexture(const wchar_t *filename, int *out_width = nullptr, int *out_height = nullptr) |
2174 { | |
2175 #pragma pack(push, 1) | |
2176 struct TGAHeader | |
2177 { | |
2178 unsigned char tgaSkip; | |
2179 unsigned char colourmaptype; // type of colour map 0=none, 1=has palette | |
2180 unsigned char tgaType; // type of image 0=none,1=indexed,2=rgb,3=grey,+8=rle packed | |
2181 | |
2182 short colourmapstart; // first colour map entry in palette | |
2183 short colourmaplength; // number of colours in palette | |
2184 char colourmapbits; // number of bits per palette entry 15,16,24,32 | |
2185 | |
2186 //unsigned char tgaDontCare2[9]; | |
2187 short xstart; // image x origin | |
2188 short ystart; // image y origin | |
2189 | |
2190 unsigned short tgaWidth; | |
2191 unsigned short tgaHeight; | |
2192 unsigned char tgaBPP; | |
2193 | |
2194 char descriptor; // image descriptor bits: 00vhaaaa | |
2195 // h horizontal flip | |
2196 // v vertical flip | |
2197 // a alpha bits | |
2198 }; | |
2199 #pragma pack(pop) | |
2200 | |
2201 if (out_width) | |
2202 *out_width = 0; | |
2203 if (out_height) | |
2204 *out_height = 0; | |
2205 | |
2206 DWORD w; | |
1980 | 2207 void* file = CreateFileW(filename, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr); |
168 | 2208 if (file == INVALID_HANDLE_VALUE) |
2209 return nullptr; | |
2210 | |
2211 TGAHeader header; | |
2212 ReadFile(file, &header, sizeof(header), &w, nullptr); | |
2213 SetFilePointer(file, header.tgaSkip, nullptr, FILE_CURRENT); | |
2214 | |
2215 if (header.tgaBPP != 24 || header.tgaType != 2) | |
2216 { | |
2217 CloseHandle(file); | |
2218 return nullptr; | |
2219 } | |
2220 | |
2221 int imgSize = header.tgaWidth * header.tgaHeight * 3; | |
1980 | 2222 unsigned char* pixels = new unsigned char[imgSize]; |
168 | 2223 ReadFile(file, pixels, imgSize, &w, nullptr); |
2224 CloseHandle(file); | |
2225 | |
2226 if (w != imgSize) | |
2227 { | |
2228 delete [] pixels; | |
2229 return nullptr; | |
2230 } | |
2231 | |
2232 if (out_width) | |
2233 *out_width = header.tgaWidth; | |
2234 if (out_height) | |
2235 *out_height = header.tgaHeight; | |
2236 | |
1980 | 2237 unsigned short* pixels_16bit = new unsigned short[imgSize / 3]; |
168 | 2238 for (int i = 0; i < imgSize / 3; ++i) |
2239 { | |
2240 pixels_16bit[i] = (pixels[i * 3] / 8 & 0x1F) | | |
2241 ((pixels[i * 3 + 1] / 4 & 0x3F) << 5) | | |
2242 ((pixels[i * 3 + 2] / 8 & 0x1F) << 11); | |
2243 } | |
2244 delete [] pixels; | |
2245 return pixels_16bit; | |
2246 } | |
2247 | |
2248 unsigned short *skybox_xn, *skybox_xp, | |
2249 *skybox_yn, *skybox_yp, | |
2250 *skybox_zn, *skybox_zp; | |
2251 int skybox_width, skybox_height; | |
781 | 2252 |
168 | 2253 IDirect3DTexture2 *skybox_texture; |
2254 IDirectDrawSurface4 *skybox_surface; | |
781 | 2255 |
168 | 2256 bool Skybox_Initialize(const wchar_t *skybox_name) |
2257 { | |
2258 wchar_t xn_filename[1024], xp_filename[1024], | |
2259 yn_filename[1024], yp_filename[1024], | |
2260 zn_filename[1024], zp_filename[1024]; | |
1165
29a8defbad9e
temporary _CRT_SECURE_NO_WARNINGS to remove some warnings
Grumpy7
parents:
1160
diff
changeset
|
2261 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
|
2262 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
|
2263 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 | 2264 |
2265 int xn_width, xn_height; | |
2266 skybox_xn = LoadTgaTexture(xn_filename, &xn_width, &xn_height); | |
2267 if (!skybox_xn) | |
2268 return false; | |
2269 | |
2270 int xp_width, xp_height; | |
2271 skybox_xp = LoadTgaTexture(xp_filename, &xp_width, &xp_height); | |
2272 if (!skybox_xp || xp_width != xn_width || xp_height != xn_height) | |
2273 { | |
2274 delete [] skybox_xn; | |
2370 | 2275 delete [] skybox_xp; |
168 | 2276 return false; |
2277 } | |
2278 | |
2279 int yn_width, yn_height; | |
2280 skybox_yn = LoadTgaTexture(yn_filename, &yn_width, &yn_height); | |
2281 if (!skybox_yn || yn_width != xn_width || yn_height != xn_height) | |
2282 { | |
2283 delete [] skybox_xn; | |
2370 | 2284 delete [] skybox_xp; |
2285 delete [] skybox_yn; | |
168 | 2286 return false; |
2287 } | |
2288 | |
2289 int yp_width, yp_height; | |
2290 skybox_yp = LoadTgaTexture(yp_filename, &yp_width, &yp_height); | |
2291 if (!skybox_yp || yp_width != xn_width || yp_height != xn_height) | |
2292 { | |
2293 delete [] skybox_xn; | |
2370 | 2294 delete [] skybox_xp; |
2295 delete [] skybox_yn; | |
2296 delete [] skybox_yp; | |
168 | 2297 return false; |
2298 } | |
2299 | |
2300 int zn_width, zn_height; | |
2301 skybox_zn = LoadTgaTexture(zn_filename, &zn_width, &zn_height); | |
2302 if (!skybox_zn || zn_width != xn_width || zn_height != xn_height) | |
2303 { | |
2304 delete [] skybox_xn; | |
2370 | 2305 delete [] skybox_xp; |
2306 delete [] skybox_yn; | |
2307 delete [] skybox_yp; | |
2308 delete [] skybox_zn; | |
168 | 2309 return false; |
2310 } | |
2311 | |
2312 int zp_width, zp_height; | |
2313 skybox_zp = LoadTgaTexture(zp_filename, &zp_width, &zp_height); | |
2314 if (!skybox_zp || zp_width != xn_width || zp_height != xn_height) | |
2315 { | |
2316 delete [] skybox_xn; | |
2370 | 2317 delete [] skybox_xp; |
2318 delete [] skybox_yn; | |
2319 delete [] skybox_yp; | |
2320 delete [] skybox_zn; | |
2321 delete [] skybox_zp; | |
168 | 2322 return false; |
2323 } | |
2324 | |
2325 skybox_width = xn_width; | |
2326 skybox_height = xn_height; | |
2327 | |
2154 | 2328 __debugbreak(); |
2329 //if (!pRenderer->pRenderD3D->CreateTexture(skybox_width, skybox_height, &skybox_surface, &skybox_texture, | |
2330 //false, false, pRenderer->uMinDeviceTextureDim)) | |
168 | 2331 return false; |
2332 | |
2333 return true; | |
2334 } | |
2335 | |
2336 struct vector | |
2337 { | |
2338 float x, y, z; | |
2339 }; | |
781 | 2340 |
168 | 2341 struct matrix |
2342 { | |
2343 float m[4][4]; | |
2344 }; | |
781 | 2345 |
168 | 2346 void VectorNormalize(vector *v) |
2347 { | |
2348 float invmag = 1.0f / sqrtf(v->x * v->x + v->y * v->y + v->z * v->z); | |
2349 v->x *= invmag; | |
2350 v->y *= invmag; | |
2351 v->z *= invmag; | |
2352 } | |
781 | 2353 |
168 | 2354 void MatrixRotationAxis(matrix *pout, CONST vector *pv, float angle) |
2355 { | |
2356 memset(pout, 0, sizeof(matrix)); | |
2357 pout->m[3][0] = 0; | |
2358 pout->m[3][1] = 0; | |
2359 pout->m[3][2] = 0; | |
2360 pout->m[3][3] = 1; | |
2361 | |
2362 vector v; | |
2363 v.x = pv->x; v.y = pv->y; v.z = pv->z; | |
2364 VectorNormalize(&v); | |
2365 | |
2366 pout->m[0][0] = (1.0f - cos(angle)) * v.x * v.x + cos(angle); | |
2367 pout->m[1][0] = (1.0f - cos(angle)) * v.x * v.y - sin(angle) * v.z; | |
2368 pout->m[2][0] = (1.0f - cos(angle)) * v.x * v.z + sin(angle) * v.y; | |
2369 pout->m[0][1] = (1.0f - cos(angle)) * v.y * v.x + sin(angle) * v.z; | |
2370 pout->m[1][1] = (1.0f - cos(angle)) * v.y * v.y + cos(angle); | |
2371 pout->m[2][1] = (1.0f - cos(angle)) * v.y * v.z - sin(angle) * v.x; | |
2372 pout->m[0][2] = (1.0f - cos(angle)) * v.z * v.x - sin(angle) * v.y; | |
2373 pout->m[1][2] = (1.0f - cos(angle)) * v.z * v.y + sin(angle) * v.x; | |
2374 pout->m[2][2] = (1.0f - cos(angle)) * v.z * v.z + cos(angle); | |
2375 } | |
781 | 2376 |
168 | 2377 void VectorTransform(const matrix *m, const vector *v, vector *out) |
2378 { | |
2379 out->x = m->m[0][0] * v->x + m->m[1][0] * v->y + m->m[2][0] * v->z + m->m[3][0]; | |
2380 out->y = m->m[0][1] * v->x + m->m[1][1] * v->y + m->m[2][1] * v->z + m->m[3][1]; | |
2381 out->z = m->m[0][2] * v->x + m->m[1][2] * v->y + m->m[2][2] * v->z + m->m[3][2]; | |
2382 } | |
2383 | |
2384 bool DrawSkyD3D_Skybox() | |
2385 { | |
2386 static bool initialized = false, | |
2387 initialization_failed = false; | |
2388 if (initialization_failed) | |
2389 return false; | |
2390 | |
2391 static int last_camera_rot_y, | |
2392 last_camera_rot_x; | |
2393 if (!initialized) | |
2394 { | |
2395 if (!Skybox_Initialize(L"data/skybox/stars")) | |
2396 { | |
2397 initialization_failed = true; | |
2398 return false; | |
2399 } | |
2400 initialized = true; | |
2401 | |
2402 last_camera_rot_y = pParty->sRotationY + 1; // force update for the first run | |
2403 last_camera_rot_x = pParty->sRotationX + 1; | |
2404 } | |
2405 | |
2406 /* | |
2407 r(y) = | |
2408 cos y 0 sin y 0 | |
2409 0 1 0 0 | |
2410 -sin y 0 cos y 0 | |
2411 0 0 0 1 | |
2412 | |
2413 x cos y - z sin y | |
2414 y | |
2415 x sin y + z cos y | |
2416 1 | |
2417 | |
2418 | |
2419 | |
2420 r(x) = // should be r(right) actually | |
2421 1 0 0 0 | |
2422 0 cos x -sin x 0 | |
2423 0 sin x cos x 0 | |
2424 0 0 0 1 | |
2425 | |
2426 | |
2427 x | |
2428 y cos x + z sin x | |
2429 -y sin x + z cos x | |
2430 1 | |
2431 | |
2432 */ | |
2433 | |
2434 if (last_camera_rot_y == pParty->sRotationY && | |
2435 last_camera_rot_x == pParty->sRotationX) | |
2436 { | |
2437 draw: | |
2438 struct RenderVertexD3D3 v[6]; | |
2439 | |
692 | 2440 v[0].pos.x = pViewport->uScreen_TL_X; |
2441 v[0].pos.y = pViewport->uScreen_TL_Y; | |
168 | 2442 v[0].pos.z = 0.99989998; |
2443 v[0].rhw = 1; | |
2006 | 2444 v[0].diffuse = -1; |
168 | 2445 v[0].specular = 0; |
2446 v[0].texcoord.x = 0; | |
2447 v[0].texcoord.y = 0; | |
2448 | |
692 | 2449 v[1].pos.x = pViewport->uScreen_TL_X + pViewport->uScreenWidth; |
2450 v[1].pos.y = pViewport->uScreen_TL_Y + pViewport->uScreenHeight; | |
168 | 2451 v[1].pos.z = 0.99989998; |
2452 v[1].rhw = 1; | |
2006 | 2453 v[1].diffuse = -1; |
168 | 2454 v[1].specular = 0; |
2455 v[1].texcoord.x = (float)pViewport->uScreenWidth / skybox_width; | |
2456 v[1].texcoord.y = (float)pViewport->uScreenHeight / skybox_height; | |
2457 | |
692 | 2458 v[2].pos.x = pViewport->uScreen_TL_X + pViewport->uScreenWidth; |
2459 v[2].pos.y = pViewport->uScreen_TL_Y; | |
168 | 2460 v[2].pos.z = 0.99989998; |
2461 v[2].rhw = 1; | |
2006 | 2462 v[2].diffuse = -1; |
168 | 2463 v[2].specular = 0; |
2464 v[2].texcoord.x = (float)pViewport->uScreenWidth / skybox_width; | |
2465 v[2].texcoord.y = 0; | |
2466 | |
2467 memcpy(&v[3], &v[0], sizeof(*v)); | |
2468 | |
692 | 2469 v[4].pos.x = pViewport->uScreen_TL_X; |
2470 v[4].pos.y = pViewport->uScreen_TL_Y + pViewport->uScreenHeight; | |
168 | 2471 v[4].pos.z = 0.99989998; |
2472 v[4].rhw = 1; | |
2006 | 2473 v[4].diffuse = -1; |
168 | 2474 v[4].specular = 0; |
2475 v[4].texcoord.x = 0; | |
2476 v[4].texcoord.y = (float)pViewport->uScreenHeight / skybox_height; | |
2477 | |
2478 memcpy(&v[5], &v[1], sizeof(*v)); | |
2479 | |
2155 | 2480 __debugbreak(); |
2481 /* | |
168 | 2482 pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_CULLMODE, D3DCULL_NONE); |
2483 pRenderer->pRenderD3D->pDevice->SetTexture(0, skybox_texture); | |
2484 pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLELIST, D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, v, 6, D3DDP_DONOTUPDATEEXTENTS | D3DDP_DONOTLIGHT); | |
2155 | 2485 */ |
168 | 2486 return true; |
2487 } | |
2488 | |
2489 | |
2490 DDSURFACEDESC2 desc; | |
2491 desc.dwSize = sizeof(desc); | |
2492 if (!pRenderer->LockSurface_DDraw4(skybox_surface, &desc, DDLOCK_WAIT | DDLOCK_WRITEONLY)) | |
2493 return false; | |
2494 | |
2495 last_camera_rot_y = pParty->sRotationY; | |
2496 last_camera_rot_x = pParty->sRotationX; | |
2497 | |
2498 float aspect = (float)pViewport->uScreenWidth / (float)pViewport->uScreenHeight; | |
1637 | 2499 float fov_x = 3.141592f * (pODMRenderParams->uCameraFovInDegrees + 0) / 360.0f; |
168 | 2500 float fov_y = fov_x / aspect; |
2501 | |
2502 float ray_dx = fov_x / (float)pViewport->uScreenWidth, | |
2503 ray_dy = fov_y / (float)pViewport->uScreenHeight; | |
2504 float party_angle_x = 2 * 3.141592653589 * pParty->sRotationX / 2048.0, | |
2505 party_angle_y = 2 * 3.141592653589 * pParty->sRotationY / 2048.0; | |
2506 for (int y = 0; y < pViewport->uScreenHeight; ++y) | |
2507 for (int x = 0; x < pViewport->uScreenWidth; ++x) | |
2508 { | |
2509 float angle_x = party_angle_x - (y - pViewport->uScreenHeight / 2) * ray_dy; | |
2510 float angle_y = party_angle_y - (x - pViewport->uScreenWidth / 2) * ray_dx; | |
2511 | |
2512 float _dir_x_ = 1, | |
2513 _dir_y_ = 0, | |
2514 _dir_z_ = 0; | |
2515 | |
2516 float dir_x_ = _dir_x_ * cosf(angle_y);// - _dir_z_ * sinf(angle_y); // rotation around y | |
2517 //float dir_y_ = _dir_y_; | |
2518 float dir_z_ = _dir_x_ * sinf(angle_y);// + _dir_z_ * cosf(angle_y); | |
2519 | |
2520 //float dir_x = dir_x_; // rotation around x | |
2521 //float dir_y = /*dir_y_ * cosf(angle_x)*/ + dir_z_ * sinf(angle_x); | |
2522 //float dir_z = /*-dir_y_ * sinf(angle_x)*/ + dir_z_ * cosf(angle_x); | |
2523 | |
2524 vector right; // rotate around right actually to avoid space distortion | |
2525 right.x = /*dir_y * 0*/ - dir_z_ * 1; | |
2526 right.y = /*dir_z_ * 0 - dir_x_ * */0; | |
2527 right.z = dir_x_ * 1/* - dir_y_ * 0*/; | |
2528 //VectorNormalize(&right); | |
2529 | |
2530 matrix rightMatrix; | |
2531 MatrixRotationAxis(&rightMatrix, &right, angle_x); | |
2532 | |
2533 vector v1, v2; | |
2534 v1.x = dir_x_; v1.y = 0; v1.z = dir_z_; | |
2535 VectorTransform(&rightMatrix, &v1, &v2); | |
2536 | |
2537 float dir_x = v2.x, | |
2538 dir_y = v2.y, | |
2539 dir_z = v2.z; | |
2540 | |
2541 float abs_dir_x = fabsf(dir_x), | |
2542 abs_dir_y = fabsf(dir_y), | |
2543 abs_dir_z = fabsf(dir_z); | |
2544 | |
2545 unsigned short color = (0x1F << 11) | (0x1F << 5) | (5); //default to orange | |
2546 if (abs_dir_x >= abs_dir_y) | |
2547 { | |
2548 if (abs_dir_x >= abs_dir_z) | |
2549 { | |
2550 if (dir_x >= 0) | |
2551 { | |
2552 float instersect_y = dir_y / (2.0f * dir_x); // plane equation for this side is x + 0.5 = 0 | |
2553 float instersect_z = dir_z / (2.0f * dir_x); | |
2554 | |
2555 float u = 1.0f - (instersect_z + 0.5f), | |
2556 v = 1.0f - (instersect_y + 0.5f); | |
2557 | |
2558 int tx = u * (skybox_width - 1), | |
2559 ty = v * (skybox_height - 1); | |
2560 | |
2561 color = skybox_xp[ty * skybox_width + tx]; | |
2562 //color = ty * 0x1F / skybox_height; | |
2563 } | |
2564 else | |
2565 { | |
2566 float instersect_y = dir_y / (2.0f * dir_x); | |
2567 float instersect_z = dir_z / (2.0f * dir_x); | |
2568 | |
2569 float u = 1.0f - (instersect_z + 0.5f), | |
2570 v = instersect_y + 0.5f; | |
2571 | |
2572 int tx = u * (skybox_width - 1), | |
2573 ty = v * (skybox_height - 1); | |
2574 | |
2575 color = skybox_xn[ty * skybox_width + tx]; | |
2576 //color = tx * 0x1F / skybox_height; | |
2577 } | |
2578 } | |
2579 else if (dir_z >= 0) | |
2580 goto DIR_ZP; | |
2581 else | |
2582 goto DIR_ZN; | |
2583 } | |
2584 else if (abs_dir_y >= abs_dir_z) | |
2585 { | |
2586 if (dir_y >= 0) | |
2587 { | |
2588 float instersect_x = dir_x / (2.0f * dir_y); | |
2589 float instersect_z = dir_z / (2.0f * dir_y); | |
2590 | |
2591 float u = instersect_x + 0.5f, | |
2592 v = instersect_z + 0.5f; | |
2593 | |
2594 int tx = u * (skybox_width - 1), | |
2595 ty = v * (skybox_height - 1); | |
2596 | |
2597 color = skybox_yp[ty * skybox_width + tx]; | |
2598 //color = tx * 0x1F / skybox_height; | |
2599 } | |
2600 /*else should never be seen i guess | |
2601 { | |
2602 __debugbreak(); | |
2603 // -y | |
2604 //Log::Warning(L"(%03u, %03u): -y", x, y); | |
2605 }*/ | |
2606 } | |
2607 else if (dir_z >= 0) | |
2608 { | |
2609 DIR_ZP: | |
2610 // +z | |
2611 float instersect_x = dir_x / (2.0f * dir_z); | |
2612 float instersect_y = dir_y / (2.0f * dir_z); | |
2613 //float intersect_z = 0.5f; | |
2614 | |
2615 float u = instersect_x + 0.5f, | |
2616 v = -instersect_y + 0.5f; | |
2617 | |
2618 int tx = u * (skybox_width - 1), | |
2619 ty = v * (skybox_height - 1); | |
2620 | |
2621 color = skybox_zp[ty * skybox_width + tx]; | |
2622 } | |
2623 else | |
2624 { | |
2625 DIR_ZN: | |
2626 // -z | |
2627 float instersect_x = -dir_x / (2.0f * dir_z); | |
2628 float instersect_y = -dir_y / (2.0f * dir_z); | |
2629 //float intersect_z = -0.5f; | |
2630 | |
2631 float u = 1.0f - instersect_x - 0.5f, | |
2632 v = -instersect_y + 0.5f; | |
2633 | |
2634 int tx = u * (skybox_width - 1), | |
2635 ty = v * (skybox_height - 1); | |
2636 | |
2637 color = skybox_zn[ty * skybox_width + tx]; | |
2638 } | |
2639 | |
2640 //pRenderer->pTargetSurface[(pViewport->uScreenY + y) * pRenderer->uTargetSurfacePitch + pViewport->uScreenX + x] = color; | |
2641 ((unsigned __int16 *)((char *)desc.lpSurface + y * desc.lPitch))[x] = color; | |
2642 } | |
2643 | |
2644 ErrD3D((skybox_surface)->Unlock(0)); | |
2645 goto draw; | |
2646 } | |
0 | 2647 //----- (0047A384) -------------------------------------------------------- |
1637 | 2648 void ODM_LoadAndInitialize(const char *pLevelFilename, ODMRenderParams *thisa) |
0 | 2649 { |
2650 int v2; // ebx@3 | |
2651 unsigned int v3; // eax@3 | |
2652 MapInfo *v4; // edi@4 | |
2653 //int v5; // eax@8 | |
2654 //SpawnPointMM7 *v6; // edx@14 | |
2655 size_t v7; // eax@19 | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
2656 //char *v8; // eax@19 |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
2657 //char *v9; // eax@21 |
0 | 2658 char Source[120]; // [sp+Ch] [bp-84h]@19 |
2659 const char *pFilename; // [sp+84h] [bp-Ch]@1 | |
2660 //unsigned int v12; // [sp+88h] [bp-8h]@12 | |
2661 //int v13; // [sp+8Ch] [bp-4h]@11 | |
2662 | |
2663 pFilename = pLevelFilename; | |
1583 | 2664 //thisa->AllocSoftwareDrawBuffers(); |
1637 | 2665 pODMRenderParams->Initialize(); |
2128 | 2666 pWeather->bRenderSnow = false; |
0 | 2667 pRenderer->ClearZBuffer(0, 479); |
1637 | 2668 thisa = (ODMRenderParams *)1; |
0 | 2669 GetAlertStatus(); |
2182 | 2670 if ( _A750D8_player_speech_timer ) |
2671 _A750D8_player_speech_timer = 0; | |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1470
diff
changeset
|
2672 v2 = pMapStats->GetMapInfo(pCurrentMapName); |
0 | 2673 v3 = 0; |
2674 if ( v2 ) | |
2675 { | |
2676 v4 = &pMapStats->pInfos[v2]; | |
2677 v3 = v4->uRespawnIntervalDays; | |
2678 } | |
2679 else | |
2680 { | |
2681 v4 = (MapInfo *)thisa; | |
2682 } | |
767 | 2683 day_attrib &= ~DAY_ATTRIB_FOG; |
0 | 2684 dword_6BE13C_uCurrentlyLoadedLocationID = v2; |
2685 pOutdoor->Initialize( | |
2686 pFilename, | |
2687 (unsigned int)(signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 0x3C / 0x3C / 0x18 + 1, | |
2688 v3, | |
2689 (int)&thisa); | |
2061 | 2690 if ( !(dword_6BE364_game_settings_1 & GAME_SETTINGS_2000) ) |
0 | 2691 { |
2338
1e865e8690ba
Moving some function declarations from unsorted subs to Actor.h and SpriteObject.h
Grumpy7
parents:
2337
diff
changeset
|
2692 Actor::InitializeActors(); |
1e865e8690ba
Moving some function declarations from unsorted subs to Actor.h and SpriteObject.h
Grumpy7
parents:
2337
diff
changeset
|
2693 SpriteObject::InitializeSpriteObjects(); |
0 | 2694 } |
2061 | 2695 dword_6BE364_game_settings_1 &= ~GAME_SETTINGS_2000; |
0 | 2696 //v5 = 0; |
2697 if ( !v2 ) | |
2698 thisa = 0; | |
1637 | 2699 if ( thisa == (ODMRenderParams *)1 ) |
0 | 2700 { |
2701 //v13 = 0; | |
2702 for (uint i = 0; i < pOutdoor->uNumSpawnPoints; ++i) | |
2703 { | |
2704 //v12 = 0; | |
2705 //while ( 1 ) | |
2706 //{ | |
1980 | 2707 SpawnPointMM7* spawn = pOutdoor->pSpawnPoints + i; |
0 | 2708 //v6 = &pOutdoor->pSpawnPoints[v12 / 0x18]; |
2709 if (spawn->uKind == 3 ) | |
2710 SpawnEncounter(v4, spawn, 0, 0, 0); | |
2711 else | |
2712 v4->SpawnRandomTreasure(spawn); | |
2713 //++v13; | |
2714 //v12 += 24; | |
2715 //if ( v13 >= (signed int)pOutdoor->uNumSpawnPoints ) | |
2716 // break; | |
2717 //v5 = 0; | |
2718 //} | |
2719 } | |
2720 RespawnGlobalDecorations(); | |
2721 } | |
2722 pOutdoor->PrepareDecorations(); | |
2065
87be06553c76
rename int _47F223_LooksLikeGenerateMonsterLoot() to void ArrangeSpriteObjects()
Ritor1
parents:
2061
diff
changeset
|
2723 pOutdoor->ArrangeSpriteObjects(); |
0 | 2724 pOutdoor->InitalizeActors(v2); |
2725 pOutdoor->MessWithLUN(); | |
2726 v7 = strlen("levels\\"); | |
2727 strcpy(Source, &pFilename[v7]); | |
2728 strcpy(pOutdoor->pLevelFilename, Source); | |
2729 pWeather->Initialize(); | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2730 pGame->pIndoorCameraD3D->sRotationY = pParty->sRotationY; |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
2731 pGame->pIndoorCameraD3D->sRotationX = pParty->sRotationX; |
1642 | 2732 //pODMRenderParams->RotationToInts(); |
0 | 2733 pOutdoor->UpdateSunlightVectors(); |
1638
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
2734 |
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
2735 float fov_rad; |
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
2736 float fov_rad_inv; |
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
2737 //----- (0042394D) -------------------------------------------------------- |
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
2738 //void IndoorCamera::Initialize(int degFov, unsigned int uViewportWidth, unsigned int uViewportHeight) |
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
2739 { |
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
2740 //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
|
2741 // viewparams->uScreen_BttmR_Y - viewparams->uScreen_topL_Y + 1); |
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
2742 |
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
2743 int uViewportWidth = viewparams->uScreen_BttmR_X - viewparams->uScreen_topL_X + 1; |
1641 | 2744 |
2745 extern float _calc_fov(int viewport_width, int angle_degree); | |
2746 fov_rad = _calc_fov(uViewportWidth, 65); | |
2747 fov_rad_inv = 65536.0 / fov_rad; | |
1638
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
2748 } |
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
2749 pODMRenderParams->int_fov_rad = (signed __int64)fov_rad; |
ccde94f02b75
class IndoorCamera split into BLVRenderParams and ODMRenderParams
Nomad
parents:
1637
diff
changeset
|
2750 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
|
2751 |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
2752 for (int i = 0; i < 20000; ++i) |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
2753 { |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
2754 array_77EC08[i].ptr_38 = &stru_8019C8; |
1644 | 2755 |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
2756 array_77EC08[i].ptr_48 = nullptr; |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
2757 } |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
2758 |
0 | 2759 MM7Initialization(); |
2760 } | |
2761 | |
2762 //----- (0047C370) -------------------------------------------------------- | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
2763 unsigned int GetLevelFogColor() |
0 | 2764 { |
2765 signed __int64 v1; // qax@5 | |
2766 int v2; // eax@6 | |
2767 | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
2768 if (bUnderwater) |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
2769 return 0xFF258F5C; |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
2770 |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
2771 if (day_attrib & DAY_ATTRIB_FOG) |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
2772 { |
767 | 2773 if ( pWeather->bNight ) // night-time fog |
750 | 2774 { |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
2775 __debugbreak(); // decompilation can be inaccurate, please send savegame to Nomad |
750 | 2776 v2 = -(pWeather->bNight != 1); |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
2777 return (v2 & 0xE0E0E1) - 0xE0E0E1; |
0 | 2778 } |
2779 else | |
2780 { | |
2781 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
|
2782 return v1 | (((unsigned int)v1 | (((unsigned int)v1 | 0xFFFFFF00) << 8)) << 8); |
0 | 2783 } |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
2784 } |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
2785 |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
2786 return 0; |
0 | 2787 } |
2788 | |
2789 //----- (0047C3D7) -------------------------------------------------------- | |
2193
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
2790 int __fastcall sub_47C3D7_get_fog_specular(int a1, int a2, float a3) |
0 | 2791 { |
2215
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2792 int v3; // ecx@1 |
0 | 2793 signed int v7; // ecx@11 |
2215
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2794 |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2795 v3 = pWeather->bNight; |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2796 if ( bUnderwater == 1 ) |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2797 v3 = 0; |
767 | 2798 if ( pParty->armageddon_timer || !(day_attrib & DAY_ATTRIB_FOG) && !bUnderwater ) |
349 | 2799 return 0xFF000000; |
2215
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2800 if ( v3 ) |
0 | 2801 { |
2215
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2802 if ( a3 < (double)day_fogrange_1 ) |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2803 { |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2804 v7 = 0; |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2805 if ( a3 == 0.0 ) |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2806 v7 = 216; |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2807 if ( a2 ) |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2808 v7 = 248; |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2809 return (-1 - v7) << 24; |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2810 } |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2811 else |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2812 { |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2813 if ( a3 > (double)day_fogrange_2 ) |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2814 { |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2815 v7 = 216; |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2816 if ( a3 == 0.0 ) |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2817 v7 = 216; |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2818 if ( a2 ) |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2819 v7 = 248; |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2820 return (-1 - v7) << 24; |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2821 } |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2822 v7 = (signed __int64)((a3 - (double)day_fogrange_1) / ((double)day_fogrange_2 - (double)day_fogrange_1) * 216.0); |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2823 } |
0 | 2824 } |
2825 else | |
2826 { | |
2215
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2827 if ( a3 < (double)day_fogrange_1 ) |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2828 { |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2829 v7 = 0; |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2830 if ( a3 == 0.0 ) |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2831 v7 = 216; |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2832 if ( a2 ) |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2833 v7 = 248; |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2834 return (-1 - v7) << 24; |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2835 } |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2836 else |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2837 { |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2838 if ( a3 > (double)day_fogrange_2 ) |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2839 { |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2840 v7 = 216; |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2841 if ( a3 == 0.0 ) |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2842 v7 = 216; |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2843 if ( a2 ) |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2844 v7 = 248; |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2845 return (-1 - v7) << 24; |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2846 } |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2847 else |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2848 v7 = floorf(((a3 - (double)day_fogrange_1) * 216.0 / ((double)day_fogrange_2 - (double)day_fogrange_1)) + 0.5f); |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2849 } |
1418 | 2850 } |
2851 if ( v7 > 216 ) | |
2215
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2852 v7 = 216; |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2853 else |
1418 | 2854 { |
2215
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2855 if ( a3 == 0.0 ) |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2856 v7 = 216; |
1418 | 2857 } |
2215
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2858 if ( a2 ) |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2859 v7 = 248; |
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
2860 return (-1 - v7) << 24; |
0 | 2861 } |
349 | 2862 |
0 | 2863 //----- (0047C4FC) -------------------------------------------------------- |
1459 | 2864 int __fastcall GetActorTintColor(int max_dimm, int min_dimm, float distance, int a4, RenderBillboard *a5) |
349 | 2865 { |
2866 //int v5; // esi@1 | |
0 | 2867 signed int v6; // edx@1 |
349 | 2868 //signed int result; // eax@2 |
0 | 2869 int v8; // eax@3 |
2870 double v9; // st7@12 | |
750 | 2871 //double v10; // ST0C_8@18 |
0 | 2872 int v11; // ecx@28 |
349 | 2873 //signed int v12; // edi@28 |
2874 //double v13; // ST0C_8@33 | |
2875 //double v14; // ST0C_8@34 | |
0 | 2876 double v15; // st7@44 |
349 | 2877 //double v16; // ST0C_8@44 |
2878 //double v17; // ST0C_8@44 | |
0 | 2879 int v18; // ST14_4@44 |
349 | 2880 //double v19; // ST0C_8@44 |
0 | 2881 signed int v20; // [sp+10h] [bp-4h]@10 |
2334 | 2882 // float a3a; // [sp+1Ch] [bp+8h]@33 |
638 | 2883 //float a3b; // [sp+1Ch] [bp+8h]@34 |
0 | 2884 float a3c; // [sp+1Ch] [bp+8h]@44 |
349 | 2885 //float a3d; // [sp+1Ch] [bp+8h]@44 |
750 | 2886 //float a4b; // [sp+20h] [bp+Ch]@18 |
638 | 2887 //int a4a; // [sp+20h] [bp+Ch]@33 |
349 | 2888 //float a4c; // [sp+20h] [bp+Ch]@44 |
2889 //float a4d; // [sp+20h] [bp+Ch]@44 | |
0 | 2890 int a5a; // [sp+24h] [bp+10h]@44 |
2891 | |
349 | 2892 //v5 = a2; |
0 | 2893 v6 = 0; |
349 | 2894 |
2895 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
638 | 2896 return 8 * (31 - max_dimm) | ((8 * (31 - max_dimm) | ((31 - max_dimm) << 11)) << 8); |
2897 | |
349 | 2898 if (pParty->armageddon_timer) |
2899 return 0xFFFF0000; | |
2900 | |
750 | 2901 v8 = pWeather->bNight; |
638 | 2902 if (bUnderwater) |
0 | 2903 v8 = 0; |
2904 if ( v8 ) | |
2905 { | |
2906 v20 = 1; | |
349 | 2907 if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uExpireTime > 0 ) |
2908 v20 = pParty->pPartyBuffs[PARTY_BUFF_TORCHLIGHT].uPower; | |
0 | 2909 v9 = (double)v20 * 1024.0; |
2910 if ( a4 ) | |
1901 | 2911 { |
2912 v6 = 216; | |
2913 goto LABEL_20; | |
2914 } | |
638 | 2915 if ( distance <= v9 ) |
2916 { | |
2917 if ( distance > 0.0 ) | |
2918 { | |
750 | 2919 //a4b = distance * 216.0 / v9; |
2920 //v10 = a4b + 6.7553994e15; | |
2921 //v6 = LODWORD(v10); | |
2922 v6 = floorf(0.5f + distance * 216.0 / v9); | |
2923 if (v6 > 216 ) | |
1901 | 2924 { |
2925 v6 = 216; | |
2926 goto LABEL_20; | |
2927 } | |
0 | 2928 } |
2929 } | |
2930 else | |
2931 { | |
2932 v6 = 216; | |
2933 } | |
638 | 2934 if ( distance != 0.0 ) |
0 | 2935 { |
2936 LABEL_20: | |
2937 if ( a5 ) | |
2938 v6 = 8 * _43F55F_get_billboard_light_level(a5, v6 >> 3); | |
2939 if ( v6 > 216 ) | |
2940 v6 = 216; | |
2941 return (255 - v6) | ((255 - v6) << 16) | ((255 - v6) << 8); | |
2942 } | |
1901 | 2943 //LABEL_19: |
0 | 2944 v6 = 216; |
2945 goto LABEL_20; | |
2946 } | |
349 | 2947 |
2948 | |
2949 | |
638 | 2950 if (fabsf(distance) < 1.0e-6f) |
349 | 2951 return 0xFFF8F8F8; |
2952 | |
638 | 2953 // dim in measured in 8-steps |
2954 v11 = 8 * (max_dimm - min_dimm); | |
349 | 2955 //v12 = v11; |
0 | 2956 if ( v11 >= 0 ) |
2957 { | |
2958 if ( v11 > 216 ) | |
349 | 2959 v11 = 216; |
2960 } | |
2961 else | |
2962 v11 = 0; | |
2963 | |
638 | 2964 float fog_density_mult = 216.0f; |
2965 if (a4) | |
1637 | 2966 fog_density_mult += distance / (double)pODMRenderParams->shading_dist_shade * 32.0; |
638 | 2967 |
2968 v6 = v11 + floorf(pOutdoor->fFogDensity * fog_density_mult + 0.5f); | |
2969 /*if ( a4 ) | |
2970 { | |
2971 //a3b = pOutdoor->fFogDensity * 216.0; | |
349 | 2972 //v14 = a3b + 6.7553994e15; |
638 | 2973 //a4a = floorf(a3b + 0.5f);//LODWORD(v14); |
2974 } | |
2975 else | |
2976 { | |
1637 | 2977 //a3a = (distance / (double)pODMRenderParams->shading_dist_shade * 32.0 + 216.0) * pOutdoor->fFogDensity; |
349 | 2978 //v13 = a3a + 6.7553994e15; |
638 | 2979 //a4a = floorf(a3a + 0.5f);//LODWORD(v13); |
2980 } | |
2981 v6 = a4a + v11;*/ | |
0 | 2982 if ( a5 ) |
2983 v6 = 8 * _43F55F_get_billboard_light_level(a5, v6 >> 3); | |
2984 if ( v6 > 216 ) | |
2985 v6 = 216; | |
349 | 2986 if ( v6 < v11 ) |
2987 v6 = v11; | |
638 | 2988 if ( v6 > 8 * pOutdoor->max_terrain_dimming_level ) |
2989 v6 = 8 * pOutdoor->max_terrain_dimming_level; | |
0 | 2990 if ( !bUnderwater ) |
2991 return (255 - v6) | ((255 - v6) << 16) | ((255 - v6) << 8); | |
349 | 2992 else |
2993 { | |
0 | 2994 v15 = (double)(255 - v6) * 0.0039215689; |
2995 a3c = v15; | |
349 | 2996 //a4c = v15 * 16.0; |
2997 //v16 = a4c + 6.7553994e15; | |
2998 a5a = floorf(v15 * 16.0 + 0.5f);//LODWORD(v16); | |
2999 //a4d = a3c * 194.0; | |
3000 //v17 = a4d + 6.7553994e15; | |
3001 v18 = floorf(a3c * 194.0 + 0.5f);//LODWORD(v17); | |
3002 //a3d = a3c * 153.0; | |
3003 //v19 = a3d + 6.7553994e15; | |
3004 return (int)floorf(a3c * 153.0 + 0.5f)/*LODWORD(v19)*/ | ((v18 | (a5a << 8)) << 8); | |
3005 } | |
0 | 3006 } |
3007 // 6BE3C4: using guessed type char bUnderwater; | |
3008 | |
3009 //----- (0047F44B) -------------------------------------------------------- | |
1412 | 3010 unsigned int WorldPosToGridCellX(int sWorldPosX) |
67 | 3011 { |
1412 | 3012 return (sWorldPosX >> 9) + 64; // sar is in original exe, resulting -880 / 512 = -1 |
3013 // and -880 sar 9 = -2 | |
0 | 3014 } |
3015 | |
3016 //----- (0047F458) -------------------------------------------------------- | |
1412 | 3017 unsigned int WorldPosToGridCellZ(int sWorldPosZ) |
67 | 3018 { |
1412 | 3019 return 64 - (sWorldPosZ >> 9); // sar is in original exe, resulting -880 / 512 = -1 |
3020 // and -880 sar 9 = -2 | |
0 | 3021 } |
3022 | |
3023 //----- (0047F469) -------------------------------------------------------- | |
1459 | 3024 int GridCellToWorldPosX(int a1) |
0 | 3025 { |
3026 return (a1 - 64) << 9; | |
3027 } | |
3028 | |
3029 //----- (0047F476) -------------------------------------------------------- | |
1459 | 3030 int GridCellToWorldPosZ(int a1) |
0 | 3031 { |
3032 return (64 - a1) << 9; | |
3033 } | |
3034 | |
3035 | |
3036 | |
3037 //----- (00481ED9) -------------------------------------------------------- | |
1637 | 3038 void sub_481ED9_MessWithODMRenderParams() |
0 | 3039 { |
1544 | 3040 stru_8019C8._48616B_frustum_odm(65536, 0, 0, 0, 65536, 0); |
1637 | 3041 pODMRenderParams->uNumPolygons = 0; |
1642 | 3042 //pODMRenderParams->uNumEdges = 0; |
3043 //pODMRenderParams->uNumSpans = 0; | |
3044 //pODMRenderParams->uNumSurfs = 0; | |
1637 | 3045 pODMRenderParams->uNumBillboards = 0; |
3046 pODMRenderParams->field_44 = 0; | |
0 | 3047 } |
3048 | |
3049 //----- (004823F4) -------------------------------------------------------- | |
138 | 3050 bool IsTerrainSlopeTooHigh(int pos_x, int pos_z) |
3051 { | |
3052 //unsigned int v2; // ebx@1 | |
3053 //unsigned int v3; // edi@1 | |
3054 //int v4; // eax@1 | |
3055 //int v6; // esi@5 | |
3056 //int v7; // ecx@6 | |
3057 //int v8; // edx@6 | |
3058 //int v9; // eax@6 | |
2193
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3059 //int y_min; // esi@10 |
138 | 3060 //int v11; // [sp+14h] [bp-8h]@1 |
3061 //int v12; // [sp+18h] [bp-4h]@1 | |
3062 | |
3063 //v12 = a1; | |
3064 //v11 = a2; | |
1980 | 3065 unsigned int grid_x = WorldPosToGridCellX(pos_x); |
3066 unsigned int grid_z = WorldPosToGridCellZ(pos_z) - 1; | |
3067 | |
3068 int party_grid_x1 = GridCellToWorldPosX(grid_x); | |
138 | 3069 //dword_76D56C_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(grid_x + 1); |
3070 //dword_76D570_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(grid_x + 1); | |
3071 //dword_76D574_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(grid_x); | |
1980 | 3072 int party_grid_z1 = GridCellToWorldPosZ(grid_z); |
138 | 3073 //dword_76D55C_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(grid_z); |
3074 //dword_76D560_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(grid_z + 1); | |
3075 //dword_76D564_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(grid_z + 1); | |
1980 | 3076 int party_x1z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z); |
3077 int party_x2z1_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z); | |
3078 int party_x2z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z + 1); | |
3079 int party_x1z2_y = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z + 1); | |
138 | 3080 //dword_76D554_terrain_cell_world_pos_around_party_y = v4; |
3081 if (party_x1z1_y == party_x2z1_y && | |
3082 party_x2z1_y == party_x2z2_y && | |
3083 party_x2z2_y == party_x1z2_y ) | |
3084 return false; | |
3085 | |
1980 | 3086 int dx = abs(pos_x - party_grid_x1), |
138 | 3087 dz = abs(party_grid_z1 - pos_z); |
3088 | |
3089 int y1, y2, y3; | |
3090 if (dz >= dx) | |
3091 { | |
3092 y1 = party_x1z2_y; // lower-left triangle | |
3093 y2 = party_x2z2_y; // y3 | \ | |
3094 y3 = party_x1z1_y; // | \ | |
3095 /* | \ | |
3096 |______ \ | |
3097 y1 y2 */ | |
3098 } | |
3099 else | |
3100 { | |
3101 y1 = party_x2z1_y; // upper-right | |
3102 y2 = party_x1z1_y; // y2_______ y1 | |
3103 y3 = party_x2z2_y; // \ | | |
3104 /* \ | | |
3105 \ | | |
3106 y3 */ | |
3107 } | |
3108 | |
2193
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3109 int y_min = min(y1, min(y2, y3));// íå âåðíî ïðè ïîäú¸ìå íà ñêëîí |
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3110 int y_max = max(y1, max(y2, y3)); |
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3111 return (y_max - y_min) > 512; |
0 | 3112 } |
3113 | |
3114 //----- (0048257A) -------------------------------------------------------- | |
812 | 3115 int __fastcall GetTerrainHeightsAroundParty2(int a1, int a2, int *pIsOnWater, int bFloatAboveWater) |
3116 { | |
2334 | 3117 // int result; // eax@9 |
0 | 3118 int v8; // ebx@11 |
3119 int v9; // eax@11 | |
3120 int v10; // ecx@11 | |
3121 int v13; // [sp+10h] [bp-8h]@11 | |
3122 signed int v14; // [sp+14h] [bp-4h]@3 | |
3123 int v15; // [sp+24h] [bp+Ch]@11 | |
3124 | |
1980 | 3125 unsigned int grid_x = WorldPosToGridCellX(a1); |
3126 unsigned int grid_z = WorldPosToGridCellZ(a2) - 1; | |
3127 | |
3128 int grid_x1 = GridCellToWorldPosX(grid_x), | |
812 | 3129 grid_x2 = GridCellToWorldPosX(grid_x + 1); |
1980 | 3130 int grid_z1 = GridCellToWorldPosZ(grid_z), |
812 | 3131 grid_z2 = GridCellToWorldPosZ(grid_z + 1); |
3132 | |
1980 | 3133 int y_x1z1 = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z), |
812 | 3134 y_x2z1 = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z), |
3135 y_x2z2 = pOutdoor->DoGetHeightOnTerrain(grid_x + 1, grid_z + 1), | |
3136 y_x1z2 = pOutdoor->DoGetHeightOnTerrain(grid_x, grid_z + 1); | |
3137 //v4 = WorldPosToGridCellX(a1); | |
3138 //v5 = WorldPosToGridCellZ(v12) - 1; | |
3139 //dword_76D538_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v4); | |
3140 //dword_76D53C_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v4 + 1); | |
3141 //dword_76D540_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v4 + 1); | |
3142 //dword_76D544_terrain_cell_world_pos_around_party_x = GridCellToWorldPosX(v4); | |
3143 //dword_76D528_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v5); | |
3144 //dword_76D52C_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v5); | |
3145 //dword_76D530_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v5 + 1); | |
3146 //dword_76D534_terrain_cell_world_pos_around_party_z = GridCellToWorldPosZ(v5 + 1); | |
3147 //dword_76D518_terrain_cell_world_pos_around_party_y = pOutdoor->DoGetHeightOnTerrain(v4, v5); | |
3148 //dword_76D51C_terrain_cell_world_pos_around_party_y = pOutdoor->DoGetHeightOnTerrain(v4 + 1, v5); | |
3149 //dword_76D520_terrain_cell_world_pos_around_party_y = pOutdoor->DoGetHeightOnTerrain(v4 + 1, v5 + 1); | |
3150 //dword_76D524_terrain_cell_world_pos_around_party_y = pOutdoor->DoGetHeightOnTerrain(v4, v5 + 1); | |
791 | 3151 *pIsOnWater = false; |
812 | 3152 if ( pOutdoor->ActuallyGetSomeOtherTileInfo(grid_x, grid_z) & 2 ) |
791 | 3153 *pIsOnWater = true; |
0 | 3154 v14 = 0; |
812 | 3155 if ( !bFloatAboveWater && *pIsOnWater ) |
0 | 3156 v14 = -60; |
812 | 3157 if ( y_x1z1 != y_x2z1 || |
3158 y_x2z1 != y_x2z2 || | |
3159 y_x2z2 != y_x1z2 ) | |
3160 { | |
3161 if ( abs(grid_z1 - a2) >= abs(a1 - grid_x1) ) | |
3162 { | |
3163 v8 = y_x1z2; | |
3164 v9 = y_x2z2; | |
3165 v10 = y_x1z1; | |
3166 v15 = a1 - grid_x1; | |
3167 v13 = a2 - grid_z2; | |
0 | 3168 } |
3169 else | |
3170 { | |
812 | 3171 v8 = y_x2z1; |
3172 v9 = y_x1z1; | |
3173 v10 = y_x2z2; | |
3174 v15 = grid_x2 - a1; | |
3175 v13 = grid_z1 - a2; | |
3176 } | |
1643 | 3177 return v14 + v8 + fixpoint_mul(v13, (v10 - v8) * 128) + fixpoint_mul(v15, (v9 - v8) * 128); |
812 | 3178 } |
3179 else | |
3180 return y_x1z1; | |
0 | 3181 } |
3182 | |
3183 //----- (00485F53) -------------------------------------------------------- | |
1458 | 3184 void sr_485F53(Vec2_int_ *v) |
0 | 3185 { |
3186 ++v->y; | |
3187 if ( v->y > 1000 ) | |
3188 v->y = 0; | |
3189 } | |
3190 | |
3191 //----- (0048607B) -------------------------------------------------------- | |
1427 | 3192 void Polygon::Create_48607B(stru149 *a2) |
0 | 3193 { |
3194 this->pTexture = 0; | |
3195 this->ptr_38 = a2; | |
3196 } | |
3197 | |
3198 //----- (00486089) -------------------------------------------------------- | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3199 void Polygon::_normalize_v_18() |
0 | 3200 { |
2101 | 3201 //double v2; // st7@1 |
3202 //double v3; // st6@1 | |
3203 //double v5; // st5@1 | |
3204 | |
3205 // v2 = (double)this->v_18.x; | |
3206 //v3 = (double)this->v_18.y; | |
3207 // v5 = (double)this->v_18.z; | |
3208 float len = sqrt((double)this->v_18.z * (double)this->v_18.z + (double)this->v_18.y * (double)this->v_18.y + (double)this->v_18.x * (double)this->v_18.x); | |
1410
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3209 if (fabsf(len) < 1e-6f) |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3210 { |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3211 v_18.x = 0; |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3212 v_18.y = 0; |
38df78aba732
deleted stru220.h and stru220 (bezier terrain stuff)
Nomad
parents:
1401
diff
changeset
|
3213 v_18.z = 65536; |
0 | 3214 } |
3215 else | |
3216 { | |
2125 | 3217 v_18.x = round_to_int((double)this->v_18.x / len * 65536.0); |
3218 v_18.y = round_to_int((double)this->v_18.y / len * 65536.0); | |
3219 v_18.y = round_to_int((double)this->v_18.z / len * 65536.0); | |
0 | 3220 } |
3221 } | |
3222 | |
3223 //----- (0048616B) -------------------------------------------------------- | |
1544 | 3224 void stru149::_48616B_frustum_odm(int a2, int a3, int a4, int a5, int a6, int a7) |
0 | 3225 { |
3226 int v7; // ebx@1 | |
3227 int v9; // edi@1 | |
3228 int v11; // edx@1 | |
3229 int v17; // ST0C_4@6 | |
3230 int v19; // ST0C_4@9 | |
3231 int v24; // [sp+14h] [bp-14h]@1 | |
3232 int v25; // [sp+18h] [bp-10h]@1 | |
3233 int v27; // [sp+24h] [bp-4h]@1 | |
3234 | |
1642 | 3235 v25 = pGame->pIndoorCameraD3D->int_cosine_x; |
3236 v7 = pGame->pIndoorCameraD3D->int_sine_y; | |
3237 v27 = pGame->pIndoorCameraD3D->int_sine_x; | |
1544 | 3238 //v8 = -pIndoorCamera->pos.y; |
1642 | 3239 v9 = pGame->pIndoorCameraD3D->int_cosine_y; |
1544 | 3240 //v26 = -pIndoorCamera->pos.z; |
1642 | 3241 v11 = pGame->pIndoorCameraD3D->int_cosine_y * -pGame->pIndoorCameraD3D->vPartyPos.x + pGame->pIndoorCameraD3D->int_sine_y * -pGame->pIndoorCameraD3D->vPartyPos.y; |
3242 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
|
3243 if (pGame->pIndoorCameraD3D->sRotationX) |
0 | 3244 { |
1643 | 3245 this->field_0_party_dir_x = fixpoint_mul(v11, pGame->pIndoorCameraD3D->int_cosine_x) + |
3246 fixpoint_mul((-pGame->pIndoorCameraD3D->vPartyPos.z) << 16, pGame->pIndoorCameraD3D->int_sine_x); | |
1544 | 3247 this->field_4_party_dir_y = v24; |
1643 | 3248 this->field_8_party_dir_z = fixpoint_mul((-pGame->pIndoorCameraD3D->vPartyPos.z) << 16, v25) - fixpoint_mul(v11, v27); |
0 | 3249 } |
3250 else | |
3251 { | |
755 | 3252 this->field_0_party_dir_x = v11; |
1544 | 3253 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
|
3254 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
|
3255 } |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
3256 |
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
3257 if (pGame->pIndoorCameraD3D->sRotationX) |
1544 | 3258 { |
1643 | 3259 v17 = fixpoint_mul(a2, v9) + fixpoint_mul(a3, v7); |
3260 | |
1809 | 3261 this->angle_from_north = fixpoint_mul(v17, v25) + fixpoint_mul(a4, v27); |
3262 this->angle_from_west = fixpoint_mul(a3, v9) - fixpoint_mul(a2, v7); | |
1844 | 3263 this->viewing_angle_from_west_east = fixpoint_mul(a4, v25) - fixpoint_mul(v17, v27); |
0 | 3264 } |
3265 else | |
3266 { | |
1809 | 3267 this->angle_from_north = fixpoint_mul(a2, v9) + fixpoint_mul(a3, v7); |
3268 this->angle_from_west = fixpoint_mul(a3, v9) - fixpoint_mul(a2, v7); | |
1844 | 3269 this->viewing_angle_from_west_east = a4; |
1544 | 3270 } |
3271 | |
1640
afc1c3514dd5
Some common code from ODM and BLV RenderParams moved to IndoorCameraD3D
Nomad
parents:
1638
diff
changeset
|
3272 if (pGame->pIndoorCameraD3D->sRotationX) |
1544 | 3273 { |
1643 | 3274 v19 = fixpoint_mul(a5, v9) + fixpoint_mul(a6, v7); |
3275 | |
1809 | 3276 this->angle_from_east = fixpoint_mul(v19, v25) + fixpoint_mul(a7, v27); |
3277 this->angle_from_south = fixpoint_mul(a6, v9) - fixpoint_mul(a5, v7); | |
1844 | 3278 this->viewing_angle_from_north_south = fixpoint_mul(a7, v25) - fixpoint_mul(v19, v27); |
0 | 3279 } |
3280 else | |
3281 { | |
1809 | 3282 this->angle_from_east = fixpoint_mul(a5, v9) + fixpoint_mul(a6, v7); |
3283 this->angle_from_south = fixpoint_mul(a6, v9) - fixpoint_mul(a5, v7); | |
1844 | 3284 this->viewing_angle_from_north_south = a7; |
1544 | 3285 } |
3286 | |
1809 | 3287 this->angle_from_east = -this->angle_from_east; |
3288 this->angle_from_south = -this->angle_from_south; | |
1844 | 3289 this->viewing_angle_from_north_south = -this->viewing_angle_from_north_south; |
1544 | 3290 |
1809 | 3291 this->field_24 = fixpoint_dot(this->angle_from_north, this->field_0_party_dir_x, |
3292 this->angle_from_west, this->field_4_party_dir_y, | |
1844 | 3293 this->viewing_angle_from_west_east, this->field_8_party_dir_z); |
1809 | 3294 this->field_28 = fixpoint_dot(this->angle_from_east, this->field_0_party_dir_x, |
3295 this->angle_from_south, this->field_4_party_dir_y, | |
1844 | 3296 this->viewing_angle_from_north_south, this->field_8_party_dir_z); |
0 | 3297 } |
3298 | |
3299 //----- (0048694B) -------------------------------------------------------- | |
1544 | 3300 void stru149::_48694B_frustum_sky() |
0 | 3301 { |
1809 | 3302 this->angle_from_east = -this->angle_from_east; |
3303 this->angle_from_south = -this->angle_from_south; | |
1844 | 3304 this->viewing_angle_from_north_south = -this->viewing_angle_from_north_south; |
1544 | 3305 |
1809 | 3306 this->field_24 = fixpoint_dot(this->angle_from_north, this->field_0_party_dir_x, |
3307 this->angle_from_west, this->field_4_party_dir_y, | |
1844 | 3308 this->viewing_angle_from_west_east, this->field_8_party_dir_z); |
1809 | 3309 this->field_28 = fixpoint_dot(this->angle_from_east, this->field_0_party_dir_x, |
3310 this->angle_from_south, this->field_4_party_dir_y, | |
1844 | 3311 this->viewing_angle_from_north_south, this->field_8_party_dir_z); |
0 | 3312 } |
3313 | |
3314 | |
3315 //----- (00441A4E) -------------------------------------------------------- | |
910 | 3316 __int16 __fastcall sub_441A4E(int a1)//for blessing |
0 | 3317 { |
3318 __int16 result; // ax@1 | |
3319 int v2; // ebx@1 | |
2334 | 3320 // char *v3; // esi@1 |
3321 // int v4; // edi@4 | |
1110 | 3322 bool v5; // ecx@4 |
1523
53265d238d94
interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents:
1504
diff
changeset
|
3323 SpriteFrame *pFrame; // eax@6 |
53265d238d94
interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents:
1504
diff
changeset
|
3324 //SpriteFrame *v7; // edi@6 |
0 | 3325 int v8; // eax@6 |
2334 | 3326 // unsigned __int16 v9; // ax@6 |
0 | 3327 RenderBillboardTransform_local0 v10; // [sp+Ch] [bp-5Ch]@1 |
3328 int v11; // [sp+5Ch] [bp-Ch]@6 | |
3329 int v12; // [sp+60h] [bp-8h]@1 | |
2207 | 3330 //int v13; // [sp+64h] [bp-4h]@6 |
0 | 3331 |
2002 | 3332 v10.sParentBillboardID = -1; |
0 | 3333 v10.pTarget = pRenderer->pTargetSurface; |
3334 v10.pTargetZ = pRenderer->pActiveZBuffer; | |
2154 | 3335 v10.uTargetPitch = pRenderer->GetRenderWidth(); |
0 | 3336 result = 0; |
3337 v2 = a1; | |
3338 v10.uViewportX = 0; | |
3339 v10.uViewportY = 0; | |
2216 | 3340 v10.uViewportZ = window->GetWidth() - 1; |
3341 v10.uViewportW = window->GetHeight() - 1; | |
0 | 3342 v12 = 0; |
921 | 3343 //v3 = (char *)&pOtherOverlayList->pOverlays[0].field_C; |
3344 //do | |
3345 for ( uint i = 0; i < 50; ++i ) | |
3346 { | |
3347 if ( pOtherOverlayList->pOverlays[i].field_6 > 0 ) | |
3348 { | |
3349 result = pOtherOverlayList->pOverlays[i].field_0; | |
3350 if ( pOtherOverlayList->pOverlays[i].field_0 >= 300 ) | |
3351 { | |
3352 //v4 = result; | |
3353 v5 = pOtherOverlayList->pOverlays[i].field_0 == v2 + 320 | |
1110 | 3354 || pOtherOverlayList->pOverlays[i].field_0 == v2 + 330 |
3355 || pOtherOverlayList->pOverlays[i].field_0 == v2 + 340 | |
3356 || pOtherOverlayList->pOverlays[i].field_0 == v2 + 350; | |
921 | 3357 pOtherOverlayList->pOverlays[i].field_0 = v2 + 310; |
1110 | 3358 if ( pOtherOverlayList->pOverlays[i].field_0 == v2 + 310 || v5 ) |
921 | 3359 { |
3360 if ( !pOtherOverlayList->pOverlays[i].field_0 ) | |
3361 { | |
1523
53265d238d94
interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents:
1504
diff
changeset
|
3362 pFrame = pSpriteFrameTable->GetFrame(pOverlayList->pOverlays[pOtherOverlayList->pOverlays[i].field_2].uSpriteFramesetID, |
921 | 3363 pOtherOverlayList->pOverlays[i].field_4); |
1523
53265d238d94
interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents:
1504
diff
changeset
|
3364 //v7 = v6; |
921 | 3365 v11 = pOtherOverlayList->pOverlays[i].field_E; |
1523
53265d238d94
interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents:
1504
diff
changeset
|
3366 //v13 = pFrame->scale; |
2207 | 3367 //v13 = fixpoint_mul(v11, pFrame->scale); |
921 | 3368 v10.uScreenSpaceX = pOtherOverlayList->pOverlays[i].field_8; |
3369 v10.uScreenSpaceY = pOtherOverlayList->pOverlays[i].field_A; | |
2207 | 3370 v10._screenspace_x_scaler_packedfloat = fixpoint_mul(v11, pFrame->scale); |
3371 v10._screenspace_y_scaler_packedfloat = fixpoint_mul(v11, pFrame->scale); | |
1523
53265d238d94
interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents:
1504
diff
changeset
|
3372 v10.pPalette = PaletteManager::Get_Dark_or_Red_LUT(pFrame->uPaletteIndex, 0, 1); |
921 | 3373 v8 = pOtherOverlayList->pOverlays[i].field_2; |
0 | 3374 v10.sZValue = 0; |
3375 v10.uFlags = 0; | |
2207 | 3376 //v9 = pOverlayList->pOverlays[v8].uOverlayType; |
3377 if ( !pOverlayList->pOverlays[v8].uOverlayType || pOverlayList->pOverlays[v8].uOverlayType == 2 ) | |
3378 v10.uScreenSpaceY += pSprites_LOD->pSpriteHeaders[pFrame->pHwSpriteIDs[0]].uHeight / 2; | |
1523
53265d238d94
interaction_distance_limit for 3DModel in DrawStatusText
Ritor1
parents:
1504
diff
changeset
|
3379 result = pSprites_LOD->pSpriteHeaders[pFrame->pHwSpriteIDs[0]]._4AD2D1(&v10, 0); |
0 | 3380 ++v12; |
3381 if ( v12 == 5 ) | |
3382 break; | |
3383 } | |
3384 } | |
3385 } | |
3386 } | |
921 | 3387 //v3 += 20; |
3388 } | |
3389 //while ( (signed int)v3 < (signed int)&pOverlayList->pOverlays ); | |
0 | 3390 return result; |
3391 } | |
3392 | |
3393 | |
3394 //----- (00443E31) -------------------------------------------------------- | |
601 | 3395 void LoadLevel_InitializeLevelStr() |
3396 { | |
329 | 3397 |
2334 | 3398 // char Args[100]; |
329 | 3399 int string_num; |
3400 int max_string_length; | |
2334 | 3401 // int current_string_length; |
329 | 3402 int prev_string_offset; |
3403 | |
3404 if (sizeof(pLevelStrOffsets) != 2000) | |
0 | 3405 Log::Warning(L"pLevelStrOffsets: deserialization warning"); |
1202 | 3406 memset(pLevelStrOffsets.data(), 0, 2000); |
0 | 3407 |
329 | 3408 max_string_length = 0; |
3409 string_num = 1; | |
3410 prev_string_offset = 0; | |
336 | 3411 pLevelStrOffsets[0]=0; |
0 | 3412 for (uint i = 0; i < uLevelStrFileSize; ++i) |
3413 { | |
3414 if ( !pLevelStr[i] ) | |
3415 { | |
329 | 3416 pLevelStrOffsets[string_num] = i + 1; |
2101 | 3417 ++string_num; |
329 | 3418 if ( i - prev_string_offset > max_string_length ) |
3419 max_string_length = i - prev_string_offset; | |
3420 prev_string_offset = i; | |
3421 } | |
3422 } | |
3423 | |
3424 uLevelStrNumStrings = string_num - 1; | |
3425 if ( max_string_length > 800 ) | |
1545 | 3426 Error("MAX_EVENT_TEXT_LENGTH needs to be increased to %lu", max_string_length+1); |
329 | 3427 |
3428 if ( uLevelStrNumStrings > 0 ) | |
3429 { | |
336 | 3430 for(uint i = 0; i <uLevelStrNumStrings ; ++i) |
329 | 3431 { |
3432 if ( RemoveQuotes(&pLevelStr[pLevelStrOffsets[i]]) != &pLevelStr[pLevelStrOffsets[i]] ) | |
3433 ++pLevelStrOffsets[i]; | |
3434 } | |
0 | 3435 } |
3436 } | |
3437 | |
3438 //----- (00443F95) -------------------------------------------------------- | |
1458 | 3439 void OnMapLeave() |
0 | 3440 { |
336 | 3441 _evt_raw *test_event; |
3442 if ( uLevelEVT_NumEvents > 0 ) | |
3443 { | |
3444 for (uint i = 0; i < uLevelEVT_NumEvents; ++i) | |
3445 { | |
2101 | 3446 test_event=(_evt_raw*)&pLevelEVT[pLevelEVT_Index[i].uEventOffsetInEVT]; |
1052 | 3447 if ( test_event->_e_type == EVENT_OnMapLeave ) |
3448 { | |
3449 EventProcessor(pLevelEVT_Index[i].uEventID, 0, 1, pLevelEVT_Index[i].event_sequence_num); | |
336 | 3450 } |
3451 } | |
0 | 3452 } |
3453 } | |
3454 | |
3455 //----- (00443FDC) -------------------------------------------------------- | |
3456 void OnMapLoad() | |
781 | 3457 { |
2334 | 3458 // __int16 v4; // cx@9 |
2101 | 3459 int v6; // eax@9 |
2193
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3460 unsigned __int64 v8; // qax@26 |
2334 | 3461 // unsigned int v9; // ecx@26 |
2193
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3462 unsigned __int64 v10; // qax@26 |
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3463 unsigned __int64 v11; // qax@26 |
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3464 unsigned __int64 v13; // qax@26 |
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3465 unsigned __int64 v14; // qax@26 |
2334 | 3466 // int v15; // ST58_4@26 |
2193
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3467 unsigned __int64 v16; // qax@26 |
2101 | 3468 int hours; // ebx@26 |
3469 unsigned __int64 v18; // [sp+Ch] [bp-44h]@12 | |
2193
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3470 unsigned int seconds; // [sp+14h] [bp-3Ch]@26 |
2101 | 3471 unsigned __int64 v20; // [sp+1Ch] [bp-34h]@7 |
2193
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3472 unsigned int minutes; // [sp+2Ch] [bp-24h]@26 |
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3473 unsigned int years; // [sp+34h] [bp-1Ch]@26 |
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3474 unsigned int weeks; // [sp+38h] [bp-18h]@26 |
2101 | 3475 int v26; // [sp+3Ch] [bp-14h]@15 |
2193
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3476 unsigned int days; // [sp+3Ch] [bp-14h]@26 |
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3477 unsigned int months; // [sp+40h] [bp-10h]@26 |
2334 | 3478 // __int16 v29; // [sp+46h] [bp-Ah]@9 |
3479 // __int16 v30; // [sp+48h] [bp-8h]@9 | |
3480 // __int16 v32; // [sp+4Ch] [bp-4h]@9 | |
3481 // __int16 v33; // [sp+4Eh] [bp-2h]@9 | |
2101 | 3482 |
3483 for (uint i = 0; i < uLevelEVT_NumEvents; ++i) | |
3484 { | |
3485 EventIndex pEvent = pLevelEVT_Index[i]; | |
3486 | |
3487 _evt_raw* _evt = (_evt_raw *)(&pLevelEVT[pEvent.uEventOffsetInEVT]); | |
3488 | |
3489 if (_evt->_e_type == EVENT_PlaySound) | |
3490 pSoundList->LoadSound(EVT_DWORD(_evt->v5), 0); | |
3491 else if (_evt->_e_type == EVENT_OnMapReload) | |
3492 EventProcessor(pEvent.uEventID, 0, 0, pEvent.event_sequence_num); | |
3493 else if (_evt->_e_type == EVENT_OnTimer || _evt->_e_type == EVENT_Initialize) | |
3494 { | |
3495 //v3 = &array_5B5928_timers[dword_5B65C8_timers_count]; | |
3496 v20 = pOutdoor->loc_time.uLastVisitDay; | |
3497 if (uCurrentlyLoadedLevelType == LEVEL_Indoor) | |
3498 v20 = pIndoor->stru1.uLastVisitDay; | |
3499 | |
3500 array_5B5928_timers[dword_5B65C8_timers_count].timer_evt_type = _evt->_e_type; | |
3501 array_5B5928_timers[dword_5B65C8_timers_count].timer_evt_ID = pEvent.uEventID; | |
3502 array_5B5928_timers[dword_5B65C8_timers_count].timer_evt_seq_num = pEvent.event_sequence_num; | |
3503 | |
3504 array_5B5928_timers[dword_5B65C8_timers_count].field_10 = _evt->v5; | |
3505 array_5B5928_timers[dword_5B65C8_timers_count].field_12 = _evt->v6; | |
3506 array_5B5928_timers[dword_5B65C8_timers_count].field_14 = _evt->v7; | |
3507 array_5B5928_timers[dword_5B65C8_timers_count].field_16 = _evt->v8; | |
3508 array_5B5928_timers[dword_5B65C8_timers_count].field_18 = _evt->v9; | |
3509 array_5B5928_timers[dword_5B65C8_timers_count].field_1A = _evt->v10; | |
3510 | |
3511 | |
3512 v6 = ((unsigned short)_evt->v12 << 8) + _evt->v11; | |
3513 | |
3514 array_5B5928_timers[dword_5B65C8_timers_count].time_left_to_fire = ((unsigned short)_evt->v12 << 8) + _evt->v11; | |
3515 array_5B5928_timers[dword_5B65C8_timers_count].fire_interval = ((unsigned short)_evt->v12 << 8) + _evt->v11; | |
3516 if (array_5B5928_timers[dword_5B65C8_timers_count].timer_evt_type == EVENT_Initialize && !(short)v6 ) | |
3517 { | |
3518 if ( v20 ) | |
3519 v18 = pParty->uTimePlayed - v20; | |
3520 else | |
2193
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3521 v18 = 0; |
2101 | 3522 v26 = (signed int)(signed __int64)((double)(signed __int64)v18 * 0.234375) / 60 / 60 / 24; |
3523 | |
2193
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3524 if ( v26 / 7 / 4 / 12 != 0 && array_5B5928_timers[dword_5B65C8_timers_count].field_10 || |
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3525 v26 / 7 / 4 != 0 && array_5B5928_timers[dword_5B65C8_timers_count].field_12 != 0 || |
2101 | 3526 v26 / 7 != 0 && array_5B5928_timers[dword_5B65C8_timers_count].field_14 != 0 || |
3527 v26 != 0 || !v20) | |
3528 { | |
3529 ++dword_5B65C8_timers_count; | |
3530 array_5B5928_timers[dword_5B65C8_timers_count].next_fire_time = 0; | |
3531 continue; | |
3532 } | |
3533 } | |
3534 else | |
3535 { | |
2193
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3536 v8 = (__int64)((double)pParty->uTimePlayed * 0.234375); |
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3537 seconds = v8 % 60; |
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3538 v10 = v8 / 60; |
2101 | 3539 minutes = v10 % 60; |
2193
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3540 v11 = v10 / 60; |
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3541 hours = v11 % 24; |
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3542 v13 = v11 / 24; |
2101 | 3543 days = v13 % 7; |
2193
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3544 v14 = v13 / 7; |
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3545 weeks = v14 % 4; |
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3546 v16 = v14 / 4; |
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3547 months = v16 % 12; |
2101 | 3548 years = v16 / 12; |
3549 | |
3550 if ( array_5B5928_timers[dword_5B65C8_timers_count].field_10 ) | |
3551 ++years; | |
2193
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3552 else if ( array_5B5928_timers[dword_5B65C8_timers_count].field_12 ) |
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3553 ++months; |
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3554 else if ( array_5B5928_timers[dword_5B65C8_timers_count].field_14 ) |
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3555 ++weeks; |
2101 | 3556 else |
3557 { | |
2193
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3558 ++days; |
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3559 minutes = array_5B5928_timers[dword_5B65C8_timers_count].field_18; |
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3560 hours = array_5B5928_timers[dword_5B65C8_timers_count].field_16; |
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3561 seconds = array_5B5928_timers[dword_5B65C8_timers_count].field_1A; |
2101 | 3562 } |
3563 array_5B5928_timers[dword_5B65C8_timers_count].next_fire_time = (signed __int64)((double)((seconds | |
3564 + 60 * minutes | |
3565 + 3600 * hours | |
2193
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3566 + 86400 * days |
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3567 + 604800 * weeks |
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3568 + 2419200 * months |
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3569 + 29030400 * years) << 7) |
2101 | 3570 * 0.033333335); |
3571 | |
3572 ++dword_5B65C8_timers_count; | |
3573 } | |
3574 } | |
3575 } | |
781 | 3576 } |
0 | 3577 |
3578 //----- (00444360) -------------------------------------------------------- | |
1411 | 3579 void Level_LoadEvtAndStr(const char *pLevelName) |
0 | 3580 { |
3581 char pContainerName[120]; // [sp+8h] [bp-98h]@1 | |
3582 | |
3583 sprintf(pContainerName, "%s.evt", pLevelName); | |
1541 | 3584 uLevelEVT_Size = LoadEventsToBuffer(pContainerName, pLevelEVT.data(), 9216); |
0 | 3585 |
3586 sprintf(pContainerName, "%s.str", pLevelName); | |
1541 | 3587 uLevelStrFileSize = LoadEventsToBuffer(pContainerName, pLevelStr.data(), 9216); |
0 | 3588 if (uLevelStrFileSize) |
3589 LoadLevel_InitializeLevelStr(); | |
3590 } | |
3591 | |
3592 | |
3593 //----- (004451A8) -------------------------------------------------------- | |
3594 void __fastcall sub_4451A8_press_any_key(int a1, int a2, int a4) | |
3595 { | |
3596 if ( !pGUIWindow2 ) | |
3597 { | |
3598 if ( pParty->uFlags & 2 ) | |
3599 pGame->Draw(); | |
1052 | 3600 pAudioPlayer->StopChannels(-1, -1); |
0 | 3601 pMiscTimer->Pause(); |
3602 pEventTimer->Pause(); | |
2101 | 3603 dword_5C3418 = a1; |
3604 dword_5C341C = a2; | |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
515
diff
changeset
|
3605 _591094_decoration = activeLevelDecoration; |
2215
e9625ad08541
fog fix and change 640,480 - window->GetWidth(), window->GetHeight()
Ritor1
parents:
2207
diff
changeset
|
3606 pGUIWindow2 = GUIWindow::Create(0, 0, window->GetWidth(), window->GetHeight(), WINDOW_GreetingNPC, a4, 0); |
948 | 3607 pGUIWindow2->CreateButton( 61, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0); |
3608 pGUIWindow2->CreateButton(177, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0); | |
3609 pGUIWindow2->CreateButton(292, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0); | |
3610 pGUIWindow2->CreateButton(407, 424, 31, 40, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0); | |
0 | 3611 } |
3612 } | |
3613 | |
3614 //----- (004452BB) -------------------------------------------------------- | |
1546 | 3615 void sub_4452BB() |
0 | 3616 { |
3617 pGUIWindow2->Release(); | |
3618 pGUIWindow2 = 0; | |
520
35f28d4c0ff9
GlobalEventInfo changed to LevelDecoration* activeLevelDecoration
Gloval
parents:
515
diff
changeset
|
3619 activeLevelDecoration = _591094_decoration; |
1052 | 3620 EventProcessor(dword_5C3418, 0, 1, dword_5C341C); |
2369
bddcaf5d5db2
removing non-nullptr conditions before frees, chaning 0 and NULL assignmnets to pointers to nullptr assignments
Grumpy7
parents:
2355
diff
changeset
|
3621 activeLevelDecoration = nullptr; |
0 | 3622 pEventTimer->Resume(); |
3623 } | |
3624 | |
3625 //----- (004465DF) -------------------------------------------------------- | |
2101 | 3626 bool sub_4465DF_check_season(int a1) |
0 | 3627 { |
2193
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3628 unsigned int monthPlusOne; // eax@1 |
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3629 unsigned int daysPlusOne; // edx@1 |
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3630 |
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3631 monthPlusOne = pParty->uCurrentMonth + 1; |
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3632 daysPlusOne = pParty->uDaysPlayed + 1; |
2125 | 3633 |
3634 switch (a1) | |
0 | 3635 { |
2193
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3636 case 3: //winter 12.21 -> 3.20 |
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3637 return (monthPlusOne == 12 && daysPlusOne >= 21 || monthPlusOne == 1 || monthPlusOne == 2 || monthPlusOne == 3 && daysPlusOne <= 20); |
2125 | 3638 break; |
2193
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3639 case 2:// autumn/fall 9.21 -> 12.20 |
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3640 return (monthPlusOne == 9 && daysPlusOne >= 21 || monthPlusOne == 10 || monthPlusOne == 11 || monthPlusOne == 12 && daysPlusOne <= 20); |
2125 | 3641 break; |
2193
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3642 case 1://summer 6.21 -> 9.20 |
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3643 return (monthPlusOne == 6 && daysPlusOne >= 21 || monthPlusOne == 7 || monthPlusOne == 8 || monthPlusOne == 9 && daysPlusOne <= 20); |
2125 | 3644 break; |
2193
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3645 case 0: //spring 3.21 -> 6.20 |
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3646 return (monthPlusOne == 3 && daysPlusOne >= 21 || monthPlusOne == 4 || monthPlusOne == 5 || monthPlusOne == 6 && daysPlusOne <= 20); |
2125 | 3647 break; |
0 | 3648 } |
2193
4842f58715ea
sub_47C3D7_get_fog_related_stuff to sub_47C3D7_get_fog_specular cleanup, IsTerrainSlopeTooHigh restoring commented out min,min/max,max implementation, some small changes in OnMapLoad, sub_4465DF_check_season attempted to pick the best readabilty/maintainability tradeoff
Grumpy7
parents:
2186
diff
changeset
|
3649 Error("Unknown season"); |
2101 | 3650 return false; |
0 | 3651 } |
3652 | |
3653 //----- (0044861E) -------------------------------------------------------- | |
3654 void __fastcall sub_44861E_set_texture(unsigned int uFaceCog, const char *pFilename) | |
3655 { | |
2101 | 3656 unsigned int texture; // eax@2 |
3657 | |
0 | 3658 if ( uFaceCog ) |
3659 { | |
2101 | 3660 texture = pBitmaps_LOD->LoadTexture(pFilename); |
3661 if ( texture != -1 ? (int)&pBitmaps_LOD->pTextures[texture] : 0 ) | |
0 | 3662 { |
2101 | 3663 pBitmaps_LOD->pTextures[texture].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[texture].palette_id1); |
0 | 3664 |
3665 if ( uCurrentlyLoadedLevelType == 1 ) | |
3666 { | |
3667 if ( (signed int)pIndoor->uNumFaceExtras > 1 ) | |
3668 { | |
2101 | 3669 for ( uint i = 1; i < (signed int)pIndoor->uNumFaceExtras; ++i ) |
0 | 3670 { |
2101 | 3671 if ( pIndoor->pFaceExtras[i].sCogNumber == uFaceCog ) |
0 | 3672 { |
2166 | 3673 if ( pIndoor->pFaces[pIndoor->pFaceExtras[i].field_C].uAttributes & FACE_TEXTURE_FRAME ) |
0 | 3674 { |
2101 | 3675 pIndoor->pFaces[pIndoor->pFaceExtras[i].field_C].uBitmapID = pTextureFrameTable->FindTextureByName(pFilename); |
3676 if ( pIndoor->pFaces[pIndoor->pFaceExtras[i].field_C].uBitmapID) | |
0 | 3677 { |
2101 | 3678 pTextureFrameTable->LoadAnimationSequenceAndPalettes(pIndoor->pFaces[pIndoor->pFaceExtras[i].field_C].uBitmapID); |
0 | 3679 } |
3680 else | |
3681 { | |
2101 | 3682 pIndoor->pFaces[pIndoor->pFaceExtras[i].field_C].uBitmapID = texture; |
2166 | 3683 pIndoor->pFaces[pIndoor->pFaceExtras[i].field_C].uAttributes &= 0xBF00; |
0 | 3684 } |
3685 } | |
3686 else | |
3687 { | |
2101 | 3688 pIndoor->pFaces[pIndoor->pFaceExtras[i].field_C].uBitmapID = texture; |
0 | 3689 } |
3690 } | |
3691 } | |
3692 } | |
2101 | 3693 pParty->uFlags |= 2; |
0 | 3694 } |
3695 else | |
3696 { | |
2101 | 3697 for ( uint j = 0; j < (unsigned int)pOutdoor->uNumBModels; ++j ) |
0 | 3698 { |
2101 | 3699 for ( uint i = 0; i < pOutdoor->pBModels[j].uNumFaces; ++i ) |
0 | 3700 { |
2101 | 3701 if ( pOutdoor->pBModels[j].pFaces[i].sCogNumber == uFaceCog ) |
0 | 3702 { |
2166 | 3703 if ( pOutdoor->pBModels[j].pFaces[i].uAttributes & FACE_TEXTURE_FRAME ) |
0 | 3704 { |
2101 | 3705 pOutdoor->pBModels[j].pFaces[i].uTextureID = pTextureFrameTable->FindTextureByName(pFilename); |
3706 if ( pOutdoor->pBModels[j].pFaces[i].uTextureID ) | |
3707 pTextureFrameTable->LoadAnimationSequenceAndPalettes(pOutdoor->pBModels[j].pFaces[i].uTextureID); | |
3708 else | |
0 | 3709 { |
2101 | 3710 pOutdoor->pBModels[j].pFaces[i].uTextureID = texture; |
2166 | 3711 pOutdoor->pBModels[j].pFaces[i].uAttributes &= 0xBF00; |
0 | 3712 } |
3713 } | |
2101 | 3714 else |
3715 pOutdoor->pBModels[j].pFaces[i].uTextureID = texture; | |
0 | 3716 } |
3717 } | |
3718 } | |
3719 } | |
2101 | 3720 pParty->uFlags |= 2; |
0 | 3721 } |
3722 } | |
3723 } | |
3724 | |
3725 //----- (0044882F) -------------------------------------------------------- | |
1515 | 3726 void __fastcall SetDecorationSprite(uint16_t uCog, bool bHide, const char *pFileName) |
0 | 3727 { |
1515 | 3728 for (size_t i = 0; i < uNumLevelDecorations; i++) |
3729 { | |
3730 if (pLevelDecorations[i].uCog == uCog) | |
0 | 3731 { |
1515 | 3732 if (pFileName && strcmp(pFileName, "0")) |
0 | 3733 { |
1515 | 3734 pLevelDecorations[i].uDecorationDescID = pDecorationList->GetDecorIdByName(pFileName); |
3735 pDecorationList->InitializeDecorationSprite(pLevelDecorations[i].uDecorationDescID); | |
0 | 3736 } |
1515 | 3737 |
3738 if (bHide) | |
3739 pLevelDecorations[i].uFlags &= ~LEVEL_DECORATION_INVISIBLE; | |
3740 else | |
3741 pLevelDecorations[i].uFlags |= LEVEL_DECORATION_INVISIBLE; | |
3742 | |
2101 | 3743 pParty->uFlags |= 2; |
0 | 3744 } |
3745 } | |
3746 } | |
3747 | |
3748 //----- (0044892E) -------------------------------------------------------- | |
3749 void __fastcall sub_44892E_set_faces_bit(int sCogNumber, int bit, int on) | |
3750 { | |
3751 if ( sCogNumber ) | |
3752 { | |
3753 if ( uCurrentlyLoadedLevelType == 1 ) | |
3754 { | |
2101 | 3755 for ( uint i = 1; i < (unsigned int)pIndoor->uNumFaceExtras; ++i ) |
0 | 3756 { |
2101 | 3757 if ( pIndoor->pFaceExtras[i].sCogNumber == sCogNumber ) |
0 | 3758 { |
2101 | 3759 if ( on ) |
3760 pIndoor->pFaces[pIndoor->pFaceExtras[i].field_C].uAttributes |= bit; | |
3761 else | |
3762 pIndoor->pFaces[pIndoor->pFaceExtras[i].field_C].uAttributes &= ~bit; | |
0 | 3763 } |
3764 } | |
2101 | 3765 pParty->uFlags |= 2; |
0 | 3766 } |
3767 else | |
3768 { | |
2101 | 3769 for ( uint j = 0; j < (unsigned int)pOutdoor->uNumBModels; ++j ) |
0 | 3770 { |
2101 | 3771 for ( uint i = 0; i < (unsigned int)pOutdoor->pBModels[j].uNumFaces; ++i ) |
0 | 3772 { |
2101 | 3773 if ( pOutdoor->pBModels[j].pFaces[i].sCogNumber == sCogNumber ) |
0 | 3774 { |
2101 | 3775 if ( on ) |
3776 pOutdoor->pBModels[j].pFaces[i].uAttributes |= bit; | |
3777 else | |
3778 pOutdoor->pBModels[j].pFaces[i].uAttributes &= ~bit; | |
0 | 3779 } |
3780 } | |
3781 } | |
3782 } | |
2101 | 3783 pParty->uFlags |= 2; |
0 | 3784 } |
3785 } | |
3786 | |
3787 | |
3788 //----- (00448B45) -------------------------------------------------------- | |
1458 | 3789 void GameUI_StatusBar_UpdateTimedString(unsigned int bForceHide) |
0 | 3790 { |
783 | 3791 if ( bForceHide || GameUI_Footer_TimeLeft && GetTickCount() >= GameUI_Footer_TimeLeft ) |
3792 GameUI_Footer_TimeLeft = 0; | |
0 | 3793 } |
3794 | |
3795 //----- (00448B67) -------------------------------------------------------- | |
2154 | 3796 void OnTimer(int) |
790 | 3797 { |
789 | 3798 if (pEventTimer->bPaused) |
3799 return; | |
3800 | |
1980 | 3801 long long v13 = (signed __int64)(pParty->uTimePlayed - _5773B8_event_timer) / 128; |
789 | 3802 if (!v13) |
3803 return; | |
3804 | |
3805 //uint _v2v3 = pParty->uTimePlayed; | |
3806 //v3 = HIDWORD(pParty->uTimePlayed); | |
3807 //v2 = LODWORD(pParty->uTimePlayed); | |
3808 | |
3809 _5773B8_event_timer = pParty->uTimePlayed; | |
3810 | |
3811 for (uint i = 0; i < dword_5B65C8_timers_count; ++i) | |
3812 { | |
3813 //v4 = (char *)&array_5B5928_timers[0].field_C; | |
1980 | 3814 stru176* timer = &array_5B5928_timers[i]; |
789 | 3815 //while ( 1 ) |
3816 //{ | |
3817 //v5 = *(short *)v4; | |
3818 if (timer->time_left_to_fire) | |
3819 { | |
3820 if (v13 < timer->time_left_to_fire) | |
3821 timer->time_left_to_fire -= v13; | |
3822 else | |
3823 { | |
3824 timer->time_left_to_fire = timer->fire_interval; | |
1052 | 3825 EventProcessor(timer->timer_evt_ID, 0, 1, timer->timer_evt_seq_num); |
789 | 3826 } |
3827 } | |
3828 else | |
3829 { | |
3830 if (timer->next_fire_time < pParty->uTimePlayed) | |
3831 { | |
3832 uint next_trigger_time = 1 * 60 * 60 * 24; // 1 day | |
3833 if (timer->field_10) | |
3834 next_trigger_time = 336 * 60 * 60 * 24; // 1 year | |
3835 else if (timer->field_12) | |
3836 next_trigger_time = 28 * 60 * 60 * 24; // 1 month | |
3837 else if (timer->field_14) | |
3838 next_trigger_time = 7 * 60 * 60 * 24; // 1 week | |
3839 | |
3840 timer->next_fire_time += (next_trigger_time * 128) / 3.0f; | |
1052 | 3841 if (timer->next_fire_time < pParty->uTimePlayed) // make sure in wont fire several times in a row if big time interval has lapsed |
789 | 3842 timer->next_fire_time = pParty->uTimePlayed; |
3843 | |
1052 | 3844 EventProcessor(timer->timer_evt_ID, 0, 1, timer->timer_evt_seq_num); |
0 | 3845 } |
3846 } | |
3847 } | |
3848 } | |
3849 | |
3850 //----- (00481D77) -------------------------------------------------------- | |
3851 void _outdoor_project(RenderVertexSoft *v) | |
3852 { | |
3853 double v1; // st7@1 | |
3854 double v2; // st7@1 | |
3855 | |
3856 v1 = 1.0 / (v->vWorldViewPosition.x + 0.0000001); | |
168 | 3857 v->_rhw = v1; |
1637 | 3858 v2 = v1 * (double)pODMRenderParams->int_fov_rad; |
0 | 3859 v->vWorldViewProjX = (double)pViewport->uScreenCenterX - v2 * v->vWorldViewPosition.y; |
3860 v->vWorldViewProjY = (double)pViewport->uScreenCenterY - v2 * v->vWorldViewPosition.z; | |
3861 } | |
3862 | |
3863 //----- (00448CF4) -------------------------------------------------------- | |
3864 void __fastcall sub_448CF4_spawn_monsters(__int16 typeindex, __int16 level, int count, int x, int y, int z, int group, unsigned int uUniqueName) | |
3865 { | |
2101 | 3866 unsigned int map_id; // eax@1 |
3867 size_t old_num_actors; // ebx@2 | |
0 | 3868 AIDirection v15; // [sp+28h] [bp-34h]@2 |
2101 | 3869 SpawnPointMM7 pSpawnPoint; // [sp+44h] [bp-18h]@1 |
3870 | |
3871 pSpawnPoint.vPosition.x = x; | |
3872 pSpawnPoint.vPosition.y = y; | |
3873 pSpawnPoint.vPosition.z = z; | |
3874 pSpawnPoint.uGroup = group; | |
3875 pSpawnPoint.uRadius = 32; | |
3876 pSpawnPoint.uKind = 3; | |
3877 pSpawnPoint.uIndex = typeindex + 2 * level + level; | |
3878 map_id = pMapStats->GetMapInfo(pCurrentMapName); | |
3879 if ( map_id ) | |
0 | 3880 { |
2101 | 3881 old_num_actors = uNumActors; |
3882 SpawnEncounter(&pMapStats->pInfos[map_id], &pSpawnPoint, 0, count, 0); | |
3883 Actor::GetDirectionInfo(PID(OBJECT_Actor, old_num_actors), 4, &v15, 1); | |
3884 for ( uint i = (unsigned int)old_num_actors; i < (unsigned int)uNumActors; ++i ) | |
0 | 3885 { |
2101 | 3886 pActors[i].PrepareSprites(0); |
3887 pActors[i].uYawAngle = v15.uYawAngle; | |
3888 pActors[i].dword_000334_unique_name = uUniqueName; | |
0 | 3889 } |
3890 } | |
3891 } | |
3892 | |
3893 //----- (0044987B) -------------------------------------------------------- | |
2101 | 3894 void Transition_StopSound_Autosave(const char *pMapName, MapStartPoint start_point) |
0 | 3895 { |
3896 pAudioPlayer->StopChannels(-1, -1); | |
434 | 3897 pGameLoadingUI_ProgressBar->Initialize(GUIProgressBar::TYPE_None); |
2101 | 3898 if ( _stricmp(pCurrentMapName, pMapName) ) |
0 | 3899 SaveGame(1, 0); |
783 | 3900 |
2124 | 3901 uGameState = GAME_STATE_CHANGE_LOCATION; |
2101 | 3902 strcpy(pCurrentMapName, pMapName); |
783 | 3903 uLevel_StartingPointType = start_point; |
0 | 3904 } |
3905 // 6BE35C: using guessed type int uLevel_StartingPointType; | |
3906 | |
3907 //----- (004498D5) -------------------------------------------------------- | |
783 | 3908 void TeleportToStartingPoint(MapStartPoint point) |
3909 { | |
2101 | 3910 const char *model_name; // [sp-4h] [bp-84h]@6 |
0 | 3911 char pName[128]; // [sp+8h] [bp-78h]@11 |
3912 | |
783 | 3913 switch (point) |
3914 { | |
2101 | 3915 case MapStartPoint_Party: model_name = "Party Start"; break; |
3916 case MapStartPoint_North: model_name = "North Start"; break; | |
3917 case MapStartPoint_South: model_name = "South Start"; break; | |
3918 case MapStartPoint_East: model_name = "East Start"; break; | |
3919 case MapStartPoint_West: model_name = "West Start"; break; | |
1546 | 3920 default: |
3921 Error("Invalid enum value: %u", point); | |
783 | 3922 } |
3923 | |
2101 | 3924 strcpy(pName, model_name); |
3925 if ( pDecorationList->GetDecorIdByName(pName) ) | |
0 | 3926 { |
2101 | 3927 |
0 | 3928 if ( (signed int)uNumLevelDecorations > 0 ) |
3929 { | |
2101 | 3930 for ( uint i = 0; i < (signed int)uNumLevelDecorations; ++i ) |
0 | 3931 { |
2101 | 3932 if ( pLevelDecorations[i].uDecorationDescID == (signed __int16)pDecorationList->GetDecorIdByName(pName) ) |
3933 { | |
3934 pParty->vPosition.x = pLevelDecorations[i].vPosition.x; | |
3935 pParty->vPosition.y = pLevelDecorations[i].vPosition.y; | |
3936 pParty->vPosition.z = pLevelDecorations[i].vPosition.z; | |
3937 pParty->uFallStartY = pParty->vPosition.z; | |
3938 pParty->sRotationY = (signed int)(stru_5C6E00->uIntegerHalfPi * pLevelDecorations[i].field_1A) / 90; | |
3939 if ( pLevelDecorations[i].field_10_y_rot ) | |
3940 pParty->sRotationY = pLevelDecorations[i].field_10_y_rot; | |
3941 pParty->sRotationX = 0; | |
3942 pParty->uFallSpeed = 0; | |
3943 } | |
0 | 3944 } |
3945 } | |
3946 if ( dword_5B65C0 ) | |
3947 { | |
3948 if ( _5B65A8_npcdata_uflags_or_other ) | |
3949 pParty->vPosition.x = _5B65A8_npcdata_uflags_or_other; | |
3950 if ( _5B65AC_npcdata_fame_or_other ) | |
3951 pParty->vPosition.y = _5B65AC_npcdata_fame_or_other; | |
3952 if ( _5B65B0_npcdata_rep_or_other ) | |
3953 { | |
3954 pParty->vPosition.z = _5B65B0_npcdata_rep_or_other; | |
3955 pParty->uFallStartY = _5B65B0_npcdata_rep_or_other; | |
3956 } | |
1516
f3cd08b89476
Fix assertion error when exiting Harmondale's castle. Possibly original bug.
yoctozepto
parents:
1515
diff
changeset
|
3957 if ( _5B65B4_npcdata_loword_house_or_other != -1 ) |
0 | 3958 pParty->sRotationY = _5B65B4_npcdata_loword_house_or_other; |
3959 if ( _5B65B8_npcdata_hiword_house_or_other ) | |
3960 pParty->sRotationX = _5B65B8_npcdata_hiword_house_or_other; | |
3961 if ( dword_5B65BC ) | |
3962 pParty->uFallSpeed = dword_5B65BC; | |
3963 } | |
3964 _5B65B4_npcdata_loword_house_or_other = -1; | |
3965 dword_5B65C0 = 0; | |
3966 dword_5B65BC = 0; | |
3967 _5B65B8_npcdata_hiword_house_or_other = 0; | |
3968 _5B65B0_npcdata_rep_or_other = 0; | |
3969 _5B65AC_npcdata_fame_or_other = 0; | |
3970 _5B65A8_npcdata_uflags_or_other = 0; | |
3971 } | |
3972 } | |
1035 | 3973 |
0 | 3974 //----- (00449B57) -------------------------------------------------------- |
521 | 3975 bool _449B57_test_bit( unsigned __int8 *a1, __int16 a2 ) |
1035 | 3976 { |
1113
39eaa6b00141
something to bool cast (performance warning) mostly fixed
Grumpy7
parents:
1112
diff
changeset
|
3977 return (a1[(a2 - 1) >> 3] & (0x80u >> (a2 - 1) % 8)) != 0; |
0 | 3978 } |
3979 | |
3980 //----- (00449B7E) -------------------------------------------------------- | |
501 | 3981 void _449B7E_toggle_bit(unsigned char *pArray, __int16 a2, unsigned __int16 bToggle) |
0 | 3982 { |
3983 signed int v3; // esi@1 | |
501 | 3984 unsigned char set_bit; // edx@1 |
0 | 3985 |
3986 v3 = a2 - 1; | |
501 | 3987 set_bit = 0x80 >> v3 % 8; |
0 | 3988 if ( bToggle ) |
501 | 3989 pArray[v3 / 8] |= set_bit; |
3990 else | |
3991 pArray[v3 / 8] &= ~set_bit; | |
0 | 3992 } |
3993 | |
3994 //----- (0044C175) -------------------------------------------------------- | |
1160 | 3995 void ShowStatusBarString( const char *pString, unsigned int uNumSeconds ) |
1546 | 3996 { |
1205
8c02e6f74b29
arrays to std::arrays phase 2 - mm7_data.h converted
Grumpy7
parents:
1202
diff
changeset
|
3997 strcpy(GameUI_Footer_TimedString.data(), pString); |
1546 | 3998 GameUI_Footer_TimeLeft = 1000 * uNumSeconds + GetTickCount(); |
3999 | |
2085 | 4000 for (int i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()); i > 450; |
4001 i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString.data()) ) | |
1470 | 4002 GameUI_Footer_TimedString[strlen(GameUI_Footer_TimedString.data()) - 1] = 0; |
0 | 4003 } |
4004 | |
4005 //----- (0044C1D0) -------------------------------------------------------- | |
1035 | 4006 void ShowNothingHereStatus() |
0 | 4007 { |
783 | 4008 if ( !GameUI_Footer_TimeLeft ) |
1546 | 4009 ShowStatusBarString(pGlobalTXT_LocalizationStrings[521], 2);// Nothing here |
0 | 4010 } |
4011 | |
4012 //----- (0044C28B) -------------------------------------------------------- | |
1459 | 4013 int const_2() |
0 | 4014 { |
4015 return 2; | |
4016 } | |
4017 | |
4018 //----- (0044C28F) -------------------------------------------------------- | |
1459 | 4019 bool TeleportToNWCDungeon() |
0 | 4020 { |
1477
7ef4b64f6329
* LODFile::LoadBitmaps & LODFile::LoadIconsOrEvents are merged into LODFile::Load
Nomad
parents:
1470
diff
changeset
|
4021 if (!_stricmp("nwc.blv", pCurrentMapName)) |
1459 | 4022 return false; |
4023 | |
4024 _5B65A8_npcdata_uflags_or_other = 0; | |
4025 _5B65AC_npcdata_fame_or_other = 0; | |
4026 _5B65B0_npcdata_rep_or_other = 0; | |
4027 _5B65B4_npcdata_loword_house_or_other = 0; | |
4028 _5B65B8_npcdata_hiword_house_or_other = 0; | |
4029 dword_5B65BC = 0; | |
4030 dword_5B65C0 = 0; | |
4031 | |
4032 pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen; | |
2101 | 4033 Transition_StopSound_Autosave("nwc.blv", MapStartPoint_Party); |
1459 | 4034 pCurrentScreen = SCREEN_GAME; |
4035 return true; | |
0 | 4036 } |
4037 | |
4038 //----- (00401000) -------------------------------------------------------- | |
1458 | 4039 void mm7__vector_constructor(void *a1, int objSize, int numObjs, int ( *constructor)(int)) |
0 | 4040 { |
4041 void *v4; // esi@2 | |
2085 | 4042 |
4043 if ( numObjs > 0 ) | |
0 | 4044 { |
4045 v4 = a1; | |
2085 | 4046 for ( int i = numObjs; i; --i ) |
0 | 4047 { |
4048 constructor((int)v4); | |
4049 v4 = (char *)v4 + objSize; | |
4050 } | |
4051 } | |
4052 } | |
4053 | |
4054 //----- (0040261D) -------------------------------------------------------- | |
1546 | 4055 void stru298::Add(__int16 uID, __int16 a3, __int16 x, __int16 y, __int16 z, char a7, char a8) |
0 | 4056 { |
1546 | 4057 if (count < 100) |
4058 { | |
4059 pIDs[count] = uID; | |
4060 pXs[count] = x; | |
4061 pYs[count] = y; | |
4062 pZs[count] = z; | |
4063 field_324[count] = a3; | |
4064 field_3EC[count] = a8; | |
4065 field_450[count++] = a7; | |
4066 } | |
0 | 4067 } |
4068 | |
2331
9551756f46c4
Moving functions out of mm7_6.cpp into appropriate classes as static methods or free functions
Grumpy7
parents:
2276
diff
changeset
|
4069 |