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