Mercurial > mm7
annotate stru6.cpp @ 2152:d44b7775fc06
Removed DirectDraw2 compatibility.
3D Sound enabled (change 3DSoundProvider registry entry to activate it).
Moved all forward declarations to mm7_unsorted_subs.h (many cpp files do not need them anyweay).
author | Nomad |
---|---|
date | Thu, 09 Jan 2014 01:37:34 +0200 |
parents | 28cb79ae2f6f |
children | 9bd7522cdbbb |
rev | line source |
---|---|
0 | 1 #include "stru6.h" |
1016 | 2 |
3 #include "mm7_data.h" | |
4 #include "LightmapBuilder.h" | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
502
diff
changeset
|
5 #include "SpriteObject.h" |
0 | 6 #include "IndoorCameraD3D.h" |
7 #include "ParticleEngine.h" | |
8 #include "Game.h" | |
9 #include "LOD.h" | |
10 #include "Sprites.h" | |
11 #include "DecalBuilder.h" | |
12 #include "ObjectList.h" | |
13 #include "Actor.h" | |
14 #include "Random.h" | |
15 #include "Spells.h" | |
16 #include "IconFrameTable.h" | |
2044 | 17 #include "Timer.h" |
0 | 18 #include "Viewport.h" |
19 #include "PaletteManager.h" | |
20 #include "Overlays.h" | |
21 #include "stru160.h" | |
2037
7a9477135943
Renamed Math.h -> OurMath.h (file resolution was sometimes ambiguous)
Nomad
parents:
2002
diff
changeset
|
22 #include "OurMath.h" |
1262 | 23 #include "Lights.h" |
0 | 24 |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
822
diff
changeset
|
25 #include "MM7.h" |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
822
diff
changeset
|
26 |
0 | 27 |
28 | |
29 | |
30 | |
2152 | 31 //----- (004A7063) -------------------------------------------------------- |
32 unsigned int ModulateColor(unsigned int diffuse, float multiplier) | |
33 { | |
34 float alpha = multiplier * ((diffuse >> 24) & 0xFF); | |
35 int a = (int)floorf(alpha + 0.5f); | |
36 a = max(0, min(255, a)); | |
37 | |
38 float red = multiplier * ((diffuse >> 16) & 0xFF); | |
39 int r = (int)floorf(red + 0.5f); | |
40 r = max(0, min(255, r)); | |
41 | |
42 float green = multiplier * ((diffuse >> 8) & 0xFF); | |
43 int g = (int)floorf(green + 0.5f); | |
44 g = max(0, min(255, g)); | |
45 | |
46 float blue = multiplier * ((diffuse >> 0) & 0xFF); | |
47 int b = (int)floorf(blue + 0.5f); | |
48 b = max(0, min(255, b)); | |
49 | |
50 return (a << 24) | (r << 16) | (g << 8) | b; | |
51 } | |
52 | |
53 | |
1459 | 54 //----- (0042620A) -------------------------------------------------------- |
55 bool sr_42620A(RenderVertexSoft *p) | |
56 { | |
57 __int16 v1; // fps@1 | |
58 unsigned __int8 v2; // c0@2 | |
59 char v3; // c2@2 | |
60 unsigned __int8 v4; // c3@2 | |
61 bool result; // eax@2 | |
62 unsigned __int8 v6; // c0@4 | |
63 char v7; // c2@4 | |
64 unsigned __int8 v8; // c3@4 | |
65 unsigned __int8 v9; // c0@6 | |
66 char v10; // c2@6 | |
67 unsigned __int8 v11; // c3@6 | |
68 double v12; // st6@7 | |
69 float v13; // ST04_4@7 | |
70 float v14; // ST00_4@7 | |
71 double v15; // st7@7 | |
72 double v16; // st6@8 | |
73 float v17; // ST04_4@8 | |
74 float v18; // ST00_4@8 | |
75 double v19; // st7@8 | |
76 | |
77 //UNDEF(v1); | |
78 if ( p->vWorldViewPosition.x < 300.0 | |
79 || (v2 = 300.0 < p[1].vWorldViewPosition.x, | |
80 v3 = 0, | |
81 v4 = 300.0 == p[1].vWorldViewPosition.x, | |
82 //BYTE1(result) = HIBYTE(v1), | |
83 !(v2 | v4)) ) | |
84 { | |
85 if ( p->vWorldViewPosition.x < 300.0 ) | |
86 { | |
87 v6 = 300.0 < p[1].vWorldViewPosition.x; | |
88 v7 = 0; | |
89 v8 = 300.0 == p[1].vWorldViewPosition.x; | |
90 //BYTE1(result) = HIBYTE(v1); | |
91 if ( !(v6 | v8) ) | |
92 { | |
93 //LOBYTE(result) = 0; | |
94 return false; | |
95 } | |
96 } | |
97 v9 = 300.0 < p->vWorldViewPosition.x; | |
98 v10 = 0; | |
99 v11 = 300.0 == p->vWorldViewPosition.x; | |
100 //BYTE1(result) = HIBYTE(v1); | |
101 if ( v9 | v11 ) | |
102 { | |
103 v16 = 1.0 / (p->vWorldViewPosition.x - p[1].vWorldViewPosition.x); | |
104 v17 = (p->vWorldViewPosition.y - p[1].vWorldViewPosition.y) * v16; | |
105 v18 = (p->vWorldViewPosition.z - p[1].vWorldViewPosition.z) * v16; | |
106 v19 = 300.0 - p[1].vWorldViewPosition.x; | |
107 p[1].vWorldViewPosition.x = v19 + p[1].vWorldViewPosition.x; | |
108 p[1].vWorldViewPosition.y = v17 * v19 + p[1].vWorldViewPosition.y; | |
109 p[1].vWorldViewPosition.z = v19 * v18 + p[1].vWorldViewPosition.z; | |
110 } | |
111 else | |
112 { | |
113 v12 = 1.0 / (p[1].vWorldViewPosition.x - p->vWorldViewPosition.x); | |
114 v13 = (p[1].vWorldViewPosition.y - p->vWorldViewPosition.y) * v12; | |
115 v14 = (p[1].vWorldViewPosition.z - p->vWorldViewPosition.z) * v12; | |
116 v15 = 300.0 - p->vWorldViewPosition.x; | |
117 p->vWorldViewPosition.x = v15 + p->vWorldViewPosition.x; | |
118 p->vWorldViewPosition.y = v13 * v15 + p->vWorldViewPosition.y; | |
119 p->vWorldViewPosition.z = v15 * v14 + p->vWorldViewPosition.z; | |
120 } | |
121 } | |
122 //LOBYTE(result) = 1; | |
123 return true; | |
124 } | |
125 | |
126 | |
127 | |
1106
3395579f6c4d
stru6_stru1_indoor_sw_billboard destructor fix, removing "extern" from struct definition, fixing probable typo in SPELL_AIR_SPARKS
Grumpy7
parents:
1102
diff
changeset
|
128 //----- (004775C4) -------------------------------------------------------- |
3395579f6c4d
stru6_stru1_indoor_sw_billboard destructor fix, removing "extern" from struct definition, fixing probable typo in SPELL_AIR_SPARKS
Grumpy7
parents:
1102
diff
changeset
|
129 stru6_stru1_indoor_sw_billboard::~stru6_stru1_indoor_sw_billboard() |
3395579f6c4d
stru6_stru1_indoor_sw_billboard destructor fix, removing "extern" from struct definition, fixing probable typo in SPELL_AIR_SPARKS
Grumpy7
parents:
1102
diff
changeset
|
130 { |
3395579f6c4d
stru6_stru1_indoor_sw_billboard destructor fix, removing "extern" from struct definition, fixing probable typo in SPELL_AIR_SPARKS
Grumpy7
parents:
1102
diff
changeset
|
131 if (pArray1) |
3395579f6c4d
stru6_stru1_indoor_sw_billboard destructor fix, removing "extern" from struct definition, fixing probable typo in SPELL_AIR_SPARKS
Grumpy7
parents:
1102
diff
changeset
|
132 delete [] pArray1; |
3395579f6c4d
stru6_stru1_indoor_sw_billboard destructor fix, removing "extern" from struct definition, fixing probable typo in SPELL_AIR_SPARKS
Grumpy7
parents:
1102
diff
changeset
|
133 pArray1 = nullptr; |
3395579f6c4d
stru6_stru1_indoor_sw_billboard destructor fix, removing "extern" from struct definition, fixing probable typo in SPELL_AIR_SPARKS
Grumpy7
parents:
1102
diff
changeset
|
134 |
3395579f6c4d
stru6_stru1_indoor_sw_billboard destructor fix, removing "extern" from struct definition, fixing probable typo in SPELL_AIR_SPARKS
Grumpy7
parents:
1102
diff
changeset
|
135 if (pArray2) |
3395579f6c4d
stru6_stru1_indoor_sw_billboard destructor fix, removing "extern" from struct definition, fixing probable typo in SPELL_AIR_SPARKS
Grumpy7
parents:
1102
diff
changeset
|
136 delete [] pArray2; |
3395579f6c4d
stru6_stru1_indoor_sw_billboard destructor fix, removing "extern" from struct definition, fixing probable typo in SPELL_AIR_SPARKS
Grumpy7
parents:
1102
diff
changeset
|
137 pArray2 = nullptr; |
3395579f6c4d
stru6_stru1_indoor_sw_billboard destructor fix, removing "extern" from struct definition, fixing probable typo in SPELL_AIR_SPARKS
Grumpy7
parents:
1102
diff
changeset
|
138 } |
3395579f6c4d
stru6_stru1_indoor_sw_billboard destructor fix, removing "extern" from struct definition, fixing probable typo in SPELL_AIR_SPARKS
Grumpy7
parents:
1102
diff
changeset
|
139 |
0 | 140 |
141 //----- (00478211) -------------------------------------------------------- | |
142 void stru6_stru1_indoor_sw_billboard::Initialize(int a2) | |
143 { | |
144 uNumVec4sInArray1 = 66; | |
145 pArray1 = new stru16x[66]; | |
146 | |
147 uNumVec3sInArray2 = 128; | |
148 pArray2 = new stru160[128]; | |
149 | |
150 for (uint i = 0; i < uNumVec4sInArray1; ++i) | |
151 { | |
152 pArray1[i].field_0 = array_4EB8B8[i].field_0; | |
153 pArray1[i].field_4 = array_4EB8B8[i].field_4; | |
154 pArray1[i].field_8 = array_4EB8B8[i].field_8; | |
155 pArray1[i].field_C = a2; | |
156 } | |
1207
96a81634669e
arrays to std::arrays phase 3 - finishing global arrays
Grumpy7
parents:
1106
diff
changeset
|
157 memcpy(pArray2, array_4EBBD0_x.data()/*array_4EBBD0*/, uNumVec3sInArray2 * sizeof(stru160)); |
0 | 158 } |
159 | |
160 //----- (0047829F) -------------------------------------------------------- | |
1390 | 161 void stru6_stru1_indoor_sw_billboard::_47829F_sphere_particle(float x_offset, float y_offset, float z_offset, float scale, int diffuse) |
0 | 162 { |
1390 | 163 int v7 = 0; |
0 | 164 |
1390 | 165 for (unsigned int i = 0; i < uNumVec3sInArray2; ++i) |
0 | 166 { |
1390 | 167 for (unsigned int j = 0; j < 3; ++j) |
0 | 168 { |
1390 | 169 field_14[j].x = x_offset + scale * *(&pArray1->field_0 + 4 * *(int *)((char *)&pArray2->field_0 + v7)); |
170 field_14[j].y = y_offset + scale * *(&pArray1->field_4 + 4 * *(int *)((char *)&pArray2->field_0 + v7)); | |
171 field_14[j].z = z_offset + scale * *(&pArray1->field_8 + 4 * *(int *)((char *)&pArray2->field_0 + v7)); | |
172 int v10 = *(int *)((char *)&pArray2->field_0 + v7); | |
173 | |
174 field_14[j].diffuse = *((int *)&pArray1[1].field_0 + 4 * v10); | |
0 | 175 v7 += 4; |
176 } | |
1390 | 177 |
178 uNumVertices = 3; | |
179 if ( sub_477C61() && sub_477F63() ) | |
0 | 180 { |
1390 | 181 if ( sub_47802A() ) |
182 pRenderer->_4A4CC9_AddSomeBillboard(this, diffuse); | |
0 | 183 } |
184 } | |
185 } | |
186 | |
187 | |
188 | |
189 | |
190 //----- (004A71FE) -------------------------------------------------------- | |
191 void stru6::DoAddProjectile(float srcX, float srcY, float srcZ, float dstX, float dstY, float dstZ, unsigned int uTextureID) | |
192 { | |
486 | 193 //int v8; // eax@1 |
0 | 194 |
486 | 195 //v8 = uNumProjectiles; |
196 if (uNumProjectiles < 32) | |
0 | 197 { |
486 | 198 pProjectiles[uNumProjectiles].srcX = srcX; |
199 pProjectiles[uNumProjectiles].srcY = srcY; | |
0 | 200 pProjectiles[uNumProjectiles].srcZ = srcZ; |
201 pProjectiles[uNumProjectiles].dstX = dstX; | |
202 pProjectiles[uNumProjectiles].dstY = dstY; | |
203 pProjectiles[uNumProjectiles].dstZ = dstZ; | |
204 pProjectiles[uNumProjectiles++].uTextureID = uTextureID; | |
205 } | |
206 } | |
207 | |
208 //----- (004A7298) -------------------------------------------------------- | |
209 void stru6::DrawProjectiles() | |
210 { | |
211 float v10; // ST1C_4@8 | |
212 float v11; // ST0C_4@8 | |
213 IDirect3DTexture2 *v12; // [sp+20h] [bp-78h]@6 | |
214 RenderVertexSoft v[2]; // [sp+30h] [bp-68h]@1 | |
215 | |
216 for (uint i = 0; i < uNumProjectiles; ++i) | |
217 { | |
1980 | 218 ProjectileAnim* p = &pProjectiles[i]; |
0 | 219 |
220 v[0].vWorldPosition.x = p->srcX; | |
221 v[0].vWorldPosition.y = p->srcY; | |
222 v[0].vWorldPosition.z = p->srcZ; | |
223 v[1].vWorldPosition.x = p->dstX; | |
224 v[1].vWorldPosition.y = p->dstY; | |
225 v[1].vWorldPosition.z = p->dstZ; | |
226 pGame->pIndoorCameraD3D->ViewTransform(v, 2); | |
227 | |
228 sr_42620A(v); | |
229 | |
230 pGame->pIndoorCameraD3D->Project(v, 2, 0); | |
231 | |
232 if (p->uTextureID != -1) | |
233 v12 = pBitmaps_LOD->pHardwareTextures[p->uTextureID]; | |
234 else | |
235 v12 = 0; | |
236 | |
237 v10 = pGame->pIndoorCameraD3D->fov_x / v[1].vWorldViewPosition.x * 20.0; | |
238 v11 = pGame->pIndoorCameraD3D->fov_x / v[0].vWorldViewPosition.x * 20.0; | |
239 pRenderer->DrawProjectile( | |
240 v[0].vWorldViewProjX, | |
241 v[0].vWorldViewProjY, | |
242 v[0].vWorldViewPosition.x, | |
243 v11, | |
244 v[1].vWorldViewProjX, | |
245 v[1].vWorldViewProjY, | |
246 v[1].vWorldViewPosition.x, | |
247 v10, | |
248 v12); | |
249 } | |
250 } | |
251 | |
252 //----- (004A73AA) -------------------------------------------------------- | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
502
diff
changeset
|
253 void stru6::_4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc(SpriteObject *a2, unsigned int uDiffuse, unsigned int uTextureID) |
0 | 254 { |
255 stru6 *v4; // edi@1 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
502
diff
changeset
|
256 SpriteObject *v5; // esi@1 |
0 | 257 int v6; // eax@1 |
258 stru6_stru2 *v7; // eax@2 | |
259 double v8; // st7@2 | |
260 double v9; // st6@2 | |
261 double v10; // st7@3 | |
619 | 262 Particle_sw local_0; // [sp+8h] [bp-68h]@1 |
0 | 263 float x; // [sp+78h] [bp+8h]@2 |
264 | |
265 v4 = this; | |
266 memset(&local_0, 0, 0x68u); | |
267 v5 = a2; | |
268 v6 = a2->field_54; | |
269 if ( v6 ) | |
270 { | |
486 | 271 v7 = &v4->array_4[v6 & 0x1F]; |
272 x = ((double)a2->vPosition.x - v7->flt_0_x) * 0.5 + v7->flt_0_x; | |
273 v8 = ((double)v5->vPosition.y - v7->flt_4_y) * 0.5 + v7->flt_4_y; | |
274 v9 = ((double)v5->vPosition.z - v7->flt_8_z) * 0.5 + v7->flt_8_z; | |
619 | 275 local_0.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8; |
0 | 276 local_0.uDiffuse = uDiffuse; |
277 local_0.x = x + 4.0; | |
278 local_0.y = v8; | |
279 local_0.z = v9; | |
1390 | 280 local_0.r = 0.0; |
281 local_0.g = 0.0; | |
282 local_0.b = 0.0; | |
0 | 283 local_0.timeToLive = (rand() & 0x40) + 96; |
284 local_0.uTextureID = uTextureID; | |
285 local_0.flt_28 = 1.0; | |
286 pGame->pParticleEngine->AddParticle(&local_0); | |
287 local_0.x = x - 4.0; | |
288 pGame->pParticleEngine->AddParticle(&local_0); | |
289 local_0.x = (double)v5->vPosition.x + 4.0; | |
290 local_0.y = (double)v5->vPosition.y; | |
291 local_0.z = (double)v5->vPosition.z; | |
292 pGame->pParticleEngine->AddParticle(&local_0); | |
293 local_0.x = (double)v5->vPosition.x - 4.0; | |
294 pGame->pParticleEngine->AddParticle(&local_0); | |
486 | 295 v4->array_4[v5->field_54 & 0x1F].flt_0_x = (double)v5->vPosition.x; |
296 v4->array_4[v5->field_54 & 0x1F].flt_4_y = (double)v5->vPosition.y; | |
297 v4->array_4[v5->field_54 & 0x1F].flt_8_z = (double)v5->vPosition.z; | |
0 | 298 } |
299 else | |
300 { | |
486 | 301 a2->field_54 = v4->field_0++; |
302 v4->array_4[a2->field_54 & 0x1F].flt_0_x = (double)a2->vPosition.x; | |
303 v4->array_4[a2->field_54 & 0x1F].flt_4_y = (double)a2->vPosition.y; | |
304 v4->array_4[a2->field_54 & 0x1F].flt_8_z = (double)a2->vPosition.z; | |
0 | 305 v10 = (double)a2->vPosition.x; |
619 | 306 local_0.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8; |
0 | 307 local_0.uDiffuse = uDiffuse; |
308 local_0.x = v10 + 4.0; | |
309 local_0.y = (double)a2->vPosition.y; | |
310 local_0.z = (double)a2->vPosition.z; | |
1390 | 311 local_0.r = 0.0; |
312 local_0.g = 0.0; | |
313 local_0.b = 0.0; | |
0 | 314 local_0.flt_28 = 1.0; |
315 local_0.timeToLive = (rand() & 0x7F) + 128; | |
316 local_0.uTextureID = uTextureID; | |
317 pGame->pParticleEngine->AddParticle(&local_0); | |
318 local_0.x = (double)a2->vPosition.x - 4.0; | |
319 pGame->pParticleEngine->AddParticle(&local_0); | |
320 } | |
321 } | |
322 | |
323 //----- (004A75CC) -------------------------------------------------------- | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
502
diff
changeset
|
324 void stru6::_4A75CC_single_spell_collision_particle(SpriteObject *a1, unsigned int uDiffuse, unsigned int uTextureID) |
0 | 325 { |
326 double v4; // st7@1 | |
327 signed int v5; // edi@1 | |
619 | 328 Particle_sw local_0; // [sp+8h] [bp-68h]@1 |
0 | 329 |
330 memset(&local_0, 0, 0x68u); | |
619 | 331 local_0.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_1; |
0 | 332 local_0.x = (double)a1->vPosition.x; |
333 local_0.y = (double)a1->vPosition.y; | |
334 v4 = (double)a1->vPosition.z; | |
335 local_0.uDiffuse = uDiffuse; | |
336 local_0.z = v4; | |
337 v5 = 10; | |
338 local_0.timeToLive = (rand() & 0x7F) + 128; | |
339 local_0.uTextureID = uTextureID; | |
340 local_0.flt_28 = 1.0; | |
341 do | |
342 { | |
1390 | 343 local_0.r = (double)(rand() & 0x1FF) - 255.0; |
344 local_0.g = (double)(rand() & 0x1FF) - 255.0; | |
345 local_0.b = (double)(rand() & 0x1FF) - 255.0; | |
0 | 346 pGame->pParticleEngine->AddParticle(&local_0); |
347 --v5; | |
348 } | |
349 while ( v5 ); | |
350 } | |
351 | |
352 //----- (004A7688) -------------------------------------------------------- | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
502
diff
changeset
|
353 void stru6::_4A7688_fireball_collision_particle(SpriteObject *a2) |
0 | 354 { |
355 double v3; // st7@1 | |
356 double v4; // st7@2 | |
357 int v6; // eax@6 | |
358 float v7; // ST0C_4@6 | |
359 float v8; // ST08_4@6 | |
360 float v9; // ST04_4@6 | |
361 float v10; // ST00_4@6 | |
619 | 362 Particle_sw local_0; // [sp+1Ch] [bp-7Ch]@1 |
0 | 363 float v13; // [sp+88h] [bp-10h]@1 |
364 | |
365 memset(&local_0, 0, 0x68u); | |
1390 | 366 |
0 | 367 v3 = (double)a2->uSpriteFrameID / (double)pObjectList->pObjects[a2->uObjectDescID].uLifetime; |
368 v13 = 512.0 * v3; | |
369 if ( v3 >= 0.75 ) | |
370 v4 = (1.0 - v3) * 4.0; | |
371 else | |
372 v4 = v3 * 1.333333333333333; | |
1390 | 373 |
619 | 374 local_0.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_1; |
375 local_0.uDiffuse = 0xFF3C1E; | |
1390 | 376 local_0.x = (double)a2->vPosition.x; |
0 | 377 local_0.y = (double)a2->vPosition.y; |
378 local_0.z = (double)a2->vPosition.z; | |
379 local_0.timeToLive = (rand() & 0x7F) + 128; | |
380 local_0.uTextureID = pBitmaps_LOD->LoadTexture("effpar01", TEXTURE_DEFAULT); | |
381 local_0.flt_28 = 1.0; | |
1390 | 382 |
383 // 10 fireball sparks | |
384 for (unsigned int i = 0; i < 10; ++i) | |
0 | 385 { |
1390 | 386 local_0.r = (rand() & 0x1FF) - 255; |
387 local_0.g = (rand() & 0x1FF) - 255; | |
388 local_0.b = (rand() & 0x1FF) - 255; | |
0 | 389 pGame->pParticleEngine->AddParticle(&local_0); |
390 } | |
1390 | 391 |
392 v6 = ModulateColor(0xFF3C1E, v4); | |
393 v7 = (double)floorf(0.5f + v13); | |
394 v8 = (double)a2->vPosition.z; | |
395 v9 = (double)a2->vPosition.y; | |
396 v10 = (double)a2->vPosition.x; | |
397 pStru1->_47829F_sphere_particle(v10, v9, v8, v7, v6); | |
0 | 398 } |
399 | |
400 //----- (004A77FD) -------------------------------------------------------- | |
1390 | 401 void stru6::_4A77FD_implosion_particle(SpriteObject *a1) |
0 | 402 { |
403 double v4; // st7@1 | |
404 double v5; // st7@2 | |
405 int v7; // eax@4 | |
406 float v8; // ST0C_4@4 | |
407 float v9; // ST08_4@4 | |
408 float v10; // ST04_4@4 | |
409 float v11; // ST00_4@4 | |
410 float v12; // [sp+28h] [bp-4h]@1 | |
411 | |
412 v4 = (double)a1->uSpriteFrameID / (double)pObjectList->pObjects[a1->uObjectDescID].uLifetime; | |
413 v12 = 512.0 - v4 * 512.0; | |
414 if ( v4 >= 0.75 ) | |
415 v5 = v4 * 4.0; | |
416 else | |
417 v5 = v4 * 1.333333333333333; | |
1390 | 418 |
419 v7 = ModulateColor(0x7E7E7E, v5); | |
420 v8 = (double)floorf(0.5f + v12); | |
421 v9 = (double)a1->vPosition.z; | |
422 v10 = (double)a1->vPosition.y; | |
423 v11 = (double)a1->vPosition.x; | |
424 pStru1->_47829F_sphere_particle(v11, v10, v9, v8, v7); | |
0 | 425 } |
426 | |
427 //----- (004A78AE) -------------------------------------------------------- | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
502
diff
changeset
|
428 void stru6::_4A78AE_sparks_spell(SpriteObject *a1) |
0 | 429 { |
430 ObjectDesc *v2; // esi@1 | |
431 unsigned int v3; // eax@1 | |
432 double v4; // st7@1 | |
619 | 433 Particle_sw local_0; // [sp+8h] [bp-68h]@1 |
0 | 434 |
435 v2 = &pObjectList->pObjects[a1->uObjectDescID]; | |
436 memset(&local_0, 0, 0x68u); | |
437 v3 = a1->uSpriteFrameID; | |
438 local_0.x = (double)a1->vPosition.x; | |
439 v4 = (double)a1->vPosition.y; | |
619 | 440 local_0.type = ParticleType_Sprite; |
441 local_0.uDiffuse = 0x7F7F7F; | |
0 | 442 local_0.timeToLive = 1; |
443 local_0.y = v4; | |
444 local_0.z = (double)a1->vPosition.z; | |
1390 | 445 local_0.r = 0.0; |
446 local_0.g = 0.0; | |
447 local_0.b = 0.0; | |
0 | 448 local_0.uTextureID = pSpriteFrameTable->GetFrame(v2->uSpriteID, v3)->pHwSpriteIDs[0]; |
449 LODWORD(local_0.flt_28) = 0x40000000u; | |
450 pGame->pParticleEngine->AddParticle(&local_0); | |
451 } | |
452 | |
453 //----- (004A7948) -------------------------------------------------------- | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
502
diff
changeset
|
454 void stru6::_4A7948_mind_blast_after_effect(SpriteObject *a1) |
0 | 455 { |
456 ObjectDesc *v2; // esi@1 | |
457 unsigned int v3; // eax@1 | |
458 double v4; // st7@1 | |
459 char v5; // al@1 | |
460 signed int v6; // edi@1 | |
619 | 461 Particle_sw Dst; // [sp+8h] [bp-68h]@1 |
0 | 462 |
463 v2 = &pObjectList->pObjects[a1->uObjectDescID]; | |
464 memset(&Dst, 0, 0x68u); | |
465 v3 = a1->uSpriteFrameID; | |
466 Dst.x = (double)a1->vPosition.x; | |
467 v4 = (double)a1->vPosition.y; | |
619 | 468 Dst.type = ParticleType_Sprite | ParticleType_Rotating | ParticleType_1; |
469 Dst.uDiffuse = 0x7F7F7F; | |
0 | 470 Dst.y = v4; |
471 Dst.z = (double)a1->vPosition.z; | |
472 Dst.uTextureID = pSpriteFrameTable->GetFrame(v2->uSpriteID, v3)->pHwSpriteIDs[0]; | |
473 v5 = rand(); | |
474 v6 = 10; | |
475 Dst.flt_28 = 1.0; | |
476 Dst.timeToLive = (v5 & 0x7F) + 128; | |
477 do | |
478 { | |
1390 | 479 Dst.r = (double)(rand() & 0x1FF) - 255.0; |
480 Dst.g = (double)(rand() & 0x1FF) - 255.0; | |
481 Dst.b = (double)(rand() & 0x1FF) - 255.0; | |
0 | 482 pGame->pParticleEngine->AddParticle(&Dst); |
483 --v6; | |
484 } | |
485 while ( v6 ); | |
486 } | |
487 | |
488 //----- (004A7A27) -------------------------------------------------------- | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
502
diff
changeset
|
489 bool stru6::AddMobileLight(SpriteObject *a1, unsigned int uDiffuse, int uRadius) |
0 | 490 { |
491 return pMobileLightsStack->AddLight( | |
492 a1->vPosition.x, | |
493 a1->vPosition.y, | |
494 a1->vPosition.z, | |
495 a1->uSectorID, | |
496 uRadius, | |
497 (uDiffuse & 0x00FF0000) >> 16, | |
498 (uDiffuse & 0x0000FF00) >> 8, | |
499 uDiffuse & 0x000000FF, | |
500 byte_4E94D3); | |
501 } | |
502 // 4E94D3: using guessed type char byte_4E94D3; | |
503 | |
504 //----- (004A7A66) -------------------------------------------------------- | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
502
diff
changeset
|
505 void stru6::_4A7A66_miltiple_spell_collision_partifles___like_after_sparks_or_lightning(SpriteObject *a1, unsigned int uDiffuse, unsigned int uTextureID, float a4) |
0 | 506 { |
507 int v5; // eax@1 | |
508 char v6; // al@1 | |
509 double v7; // st6@1 | |
510 double v8; // st6@1 | |
511 double v9; // st7@1 | |
512 double v10; // st6@1 | |
619 | 513 Particle_sw local_0; // [sp+0h] [bp-6Ch]@1 |
0 | 514 float v12; // [sp+68h] [bp-4h]@1 |
515 float a1a; // [sp+74h] [bp+8h]@1 | |
516 float uDiffusea; // [sp+78h] [bp+Ch]@1 | |
517 float uTextureIDa; // [sp+7Ch] [bp+10h]@1 | |
518 | |
519 memset(&local_0, 0, 0x68u); | |
619 | 520 local_0.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_1; |
0 | 521 local_0.x = (double)a1->vPosition.x; |
522 v5 = a1->vPosition.z; | |
523 local_0.y = (double)a1->vPosition.y; | |
524 local_0.uDiffuse = uDiffuse; | |
525 local_0.z = (double)(v5 + 32); | |
526 v6 = rand(); | |
527 local_0.flt_28 = 1.0; | |
528 v7 = 0.0 * a4; | |
529 local_0.timeToLive = (v6 & 0x7F) + 128; | |
530 local_0.uTextureID = uTextureID; | |
531 a1a = v7; | |
1390 | 532 local_0.r = v7; |
533 local_0.g = a4; | |
534 local_0.b = a4; | |
0 | 535 pGame->pParticleEngine->AddParticle(&local_0); |
536 v8 = 0.70710677 * a4; | |
537 uDiffusea = v8; | |
1390 | 538 local_0.r = v8; |
539 local_0.g = v8; | |
540 local_0.b = a4; | |
0 | 541 pGame->pParticleEngine->AddParticle(&local_0); |
1390 | 542 local_0.g = a1a; |
543 local_0.r = a4; | |
544 local_0.b = a4; | |
0 | 545 pGame->pParticleEngine->AddParticle(&local_0); |
1390 | 546 local_0.r = uDiffusea; |
547 local_0.b = a4; | |
0 | 548 v9 = -uDiffusea; |
549 uTextureIDa = v9; | |
1390 | 550 local_0.g = v9; |
0 | 551 pGame->pParticleEngine->AddParticle(&local_0); |
552 v10 = -1.0 * a4; | |
1390 | 553 local_0.r = a1a; |
0 | 554 v12 = v10; |
1390 | 555 local_0.g = v10; |
556 local_0.b = a4; | |
0 | 557 pGame->pParticleEngine->AddParticle(&local_0); |
1390 | 558 local_0.b = a4; |
559 local_0.r = uTextureIDa; | |
560 local_0.g = uTextureIDa; | |
0 | 561 pGame->pParticleEngine->AddParticle(&local_0); |
1390 | 562 local_0.r = v12; |
563 local_0.g = a1a; | |
564 local_0.b = a4; | |
0 | 565 pGame->pParticleEngine->AddParticle(&local_0); |
1390 | 566 local_0.r = uTextureIDa; |
567 local_0.g = uDiffusea; | |
568 local_0.b = a4; | |
0 | 569 pGame->pParticleEngine->AddParticle(&local_0); |
570 } | |
571 | |
572 //----- (004A7C07) -------------------------------------------------------- | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
502
diff
changeset
|
573 void stru6::_4A7C07(SpriteObject *a2) |
0 | 574 { |
575 stru6 *v2; // edi@1 | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
502
diff
changeset
|
576 SpriteObject *v3; // esi@1 |
0 | 577 int v4; // eax@1 |
578 ObjectDesc *v5; // ebx@1 | |
579 stru6_stru2 *v6; // eax@2 | |
580 double v7; // st6@2 | |
581 double v8; // st5@2 | |
582 double v9; // st4@2 | |
583 char v10; // al@2 | |
584 double v11; // st7@2 | |
585 double v12; // st7@3 | |
619 | 586 Particle_sw local_0; // [sp+Ch] [bp-68h]@1 |
0 | 587 float a2a; // [sp+7Ch] [bp+8h]@2 |
588 | |
589 v2 = this; | |
590 memset(&local_0, 0, 0x68u); | |
591 v3 = a2; | |
592 v4 = a2->field_54; | |
593 v5 = &pObjectList->pObjects[a2->uObjectDescID]; | |
594 if ( v4 ) | |
595 { | |
486 | 596 v6 = &v2->array_4[v4 & 0x1F]; |
597 v7 = ((double)a2->vPosition.x - v6->flt_0_x) * 0.5 + v6->flt_0_x; | |
598 v8 = ((double)a2->vPosition.y - v6->flt_4_y) * 0.5 + v6->flt_4_y; | |
599 v9 = ((double)a2->vPosition.z - v6->flt_8_z) * 0.5 + v6->flt_8_z; | |
619 | 600 local_0.type = ParticleType_Sprite; |
601 local_0.uDiffuse = 0xFFFFFF; | |
0 | 602 a2a = v9; |
603 local_0.x = v7; | |
604 local_0.z = a2a; | |
605 local_0.y = v8; | |
1390 | 606 local_0.r = 0.0; |
607 local_0.g = 0.0; | |
608 local_0.b = 0.0; | |
0 | 609 v10 = rand(); |
610 LODWORD(local_0.flt_28) = 0x40400000u; | |
611 local_0.timeToLive = (v10 & 0x3F) + 64; | |
612 local_0.uTextureID = pSpriteFrameTable->GetFrame(v5->uSpriteID, v3->uSpriteFrameID)->pHwSpriteIDs[0]; | |
613 pGame->pParticleEngine->AddParticle(&local_0); | |
614 v11 = (double)v3->vPosition.x; | |
615 LODWORD(local_0.flt_28) = 0x40800000u; | |
616 local_0.x = v11; | |
617 local_0.y = (double)v3->vPosition.y; | |
618 local_0.z = (double)v3->vPosition.z; | |
619 local_0.timeToLive = (rand() & 0x3F) + 64; | |
620 pGame->pParticleEngine->AddParticle(&local_0); | |
486 | 621 v2->array_4[v3->field_54 & 0x1F].flt_0_x = (double)v3->vPosition.x; |
622 v2->array_4[v3->field_54 & 0x1F].flt_4_y = (double)v3->vPosition.y; | |
623 v2->array_4[v3->field_54 & 0x1F].flt_8_z = (double)v3->vPosition.z; | |
0 | 624 } |
625 else | |
626 { | |
486 | 627 a2->field_54 = v2->field_0++; |
628 v2->array_4[a2->field_54 & 0x1F].flt_0_x = (double)a2->vPosition.x; | |
629 v2->array_4[a2->field_54 & 0x1F].flt_4_y = (double)a2->vPosition.y; | |
630 v2->array_4[a2->field_54 & 0x1F].flt_8_z = (double)a2->vPosition.z; | |
0 | 631 v12 = (double)a2->vPosition.x; |
619 | 632 local_0.type = ParticleType_Sprite; |
633 local_0.uDiffuse = 0xFFFFFF; | |
0 | 634 LODWORD(local_0.flt_28) = 0x40000000u; |
635 local_0.x = v12; | |
636 local_0.y = (double)a2->vPosition.y; | |
637 local_0.z = (double)a2->vPosition.z; | |
1390 | 638 local_0.r = 0.0; |
639 local_0.g = 0.0; | |
640 local_0.b = 0.0; | |
0 | 641 local_0.timeToLive = (rand() & 0x3F) + 64; |
642 local_0.uTextureID = pSpriteFrameTable->GetFrame(v5->uSpriteID, a2->uSpriteFrameID)->pHwSpriteIDs[0]; | |
643 pGame->pParticleEngine->AddParticle(&local_0); | |
644 } | |
645 } | |
646 | |
647 //----- (004A7E05) -------------------------------------------------------- | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
502
diff
changeset
|
648 void stru6::AddProjectile(SpriteObject *a2, int a3, unsigned int uTextureID) |
0 | 649 { |
1390 | 650 if (a2->field_54) |
0 | 651 { |
1390 | 652 DoAddProjectile(array_4[a2->field_54 & 0x1F].flt_0_x, |
653 array_4[a2->field_54 & 0x1F].flt_4_y, | |
654 array_4[a2->field_54 & 0x1F].flt_8_z, | |
655 a2->vPosition.x, | |
656 a2->vPosition.y, | |
657 a2->vPosition.z, | |
658 uTextureID); | |
0 | 659 } |
660 else | |
661 { | |
1390 | 662 a2->field_54 = field_0++; |
663 array_4[a2->field_54 & 0x1F].flt_0_x = (double)a2->vPosition.x; | |
664 array_4[a2->field_54 & 0x1F].flt_4_y = (double)a2->vPosition.y; | |
665 array_4[a2->field_54 & 0x1F].flt_8_z = (double)a2->vPosition.z; | |
0 | 666 } |
667 } | |
668 | |
669 //----- (004A7E89) -------------------------------------------------------- | |
142 | 670 void stru6::_4A7E89_sparkles_on_actor_after_it_casts_buff(Actor *pActor, unsigned int uDiffuse) |
0 | 671 { |
672 Actor *v3; // edi@1 | |
673 int v4; // ebx@3 | |
142 | 674 //int result; // eax@5 |
619 | 675 Particle_sw Dst; // [sp+Ch] [bp-6Ch]@1 |
0 | 676 int v7; // [sp+74h] [bp-4h]@2 |
677 signed int pActora; // [sp+80h] [bp+8h]@1 | |
678 | |
679 memset(&Dst, 0, 0x68u); | |
619 | 680 Dst.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8; |
0 | 681 Dst.timeToLive = (rand() & 0x7F) + 128; |
682 v3 = pActor; | |
683 Dst.uTextureID = pBitmaps_LOD->LoadTexture("effpar02", TEXTURE_DEFAULT); | |
684 pActora = 50; | |
685 Dst.flt_28 = 1.0; | |
686 do | |
687 { | |
688 v7 = (unsigned __int8)rand() + v3->vPosition.x - 127; | |
689 Dst.x = (double)v7; | |
690 v7 = (unsigned __int8)rand() + v3->vPosition.y - 127; | |
691 Dst.y = (double)v7; | |
692 v7 = v3->vPosition.z + (unsigned __int8)rand(); | |
693 Dst.z = (double)v7; | |
694 if ( uDiffuse ) | |
695 { | |
696 Dst.uDiffuse = uDiffuse; | |
697 } | |
698 else | |
699 { | |
700 v4 = rand() << 16; | |
701 Dst.uDiffuse = rand() | v4; | |
702 } | |
703 pGame->pParticleEngine->AddParticle(&Dst); | |
704 --pActora; | |
705 } | |
706 while ( pActora ); | |
707 } | |
708 | |
709 //----- (004A7F74) -------------------------------------------------------- | |
710 void stru6::_4A7F74(int x, int y, int z) | |
711 { | |
712 stru6 *v4; // esi@1 | |
713 char v5; // al@1 | |
714 signed int v6; // edi@1 | |
715 unsigned int v7; // eax@1 | |
716 double v8; // st7@2 | |
717 double v9; // st7@2 | |
619 | 718 Particle_sw local_0; // [sp+8h] [bp-78h]@1 |
0 | 719 double v11; // [sp+70h] [bp-10h]@1 |
720 double v12; // [sp+78h] [bp-8h]@1 | |
721 float z1; // [sp+88h] [bp+8h]@2 | |
722 | |
723 v4 = this; | |
724 memset(&local_0, 0, 0x68u); | |
619 | 725 local_0.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_1; |
726 local_0.uDiffuse = 0x7E7E7E; | |
0 | 727 v5 = rand(); |
728 local_0.flt_28 = 1.0; | |
729 v6 = 8; | |
730 local_0.timeToLive = (v5 & 0x7F) + 128; | |
731 v7 = v4->uTextureID_effpar1; | |
732 v12 = (double)x; | |
733 local_0.uTextureID = v7; | |
734 v11 = (double)y; | |
735 do | |
736 { | |
737 v8 = pRnd->GetRandom(); | |
738 local_0.x = v8 * 40.0 - 20.0 + v12; | |
739 v9 = pRnd->GetRandom(); | |
740 z1 = (double)z; | |
741 local_0.z = z1; | |
742 local_0.y = v9 * 40.0 - 20.0 + v11; | |
1390 | 743 local_0.r = pRnd->GetRandom() * 400.0 - 200.0; |
744 local_0.g = pRnd->GetRandom() * 400.0 - 200.0; | |
745 local_0.b = pRnd->GetRandom() * 150.0 + 50.0; | |
0 | 746 pGame->pParticleEngine->AddParticle(&local_0); |
747 --v6; | |
748 } | |
749 while ( v6 ); | |
750 } | |
751 | |
752 //----- (004A806F) -------------------------------------------------------- | |
753 int stru6::_4A806F(Actor *pActor) | |
754 { | |
755 int v2; // ecx@1 | |
756 unsigned int v3; // eax@1 | |
757 double v4; // st7@2 | |
758 float v5; // ST00_4@6 | |
759 | |
760 v2 = (int)pActor; | |
1954
730166317ed0
pActorBuffs[10] to pActorBuffs[ACTOR_BUFF_MASS_DISTORTION]
Grumpy7
parents:
1705
diff
changeset
|
761 v3 = LODWORD(pActor->pActorBuffs[ACTOR_BUFF_MASS_DISTORTION].uExpireTime) - pMiscTimer->uTotalGameTimeElapsed; |
0 | 762 if ( (signed int)v3 <= 64 ) |
763 { | |
764 if ( (v3 & 0x80000000u) != 0 ) | |
765 { | |
1954
730166317ed0
pActorBuffs[10] to pActorBuffs[ACTOR_BUFF_MASS_DISTORTION]
Grumpy7
parents:
1705
diff
changeset
|
766 pActor->pActorBuffs[ACTOR_BUFF_MASS_DISTORTION].uExpireTime = 0i64; |
0 | 767 v4 = 1.0; |
768 } | |
769 else | |
770 { | |
771 v2 = v3 * v3; | |
772 v4 = 1.0 - (double)(signed int)(v3 * v3) * 0.0001953125; | |
773 } | |
774 } | |
775 else | |
776 { | |
777 v2 = (v3 - 64) * (v3 - 64); | |
778 v4 = (double)v2 * 0.0001953125 + 0.2; | |
779 } | |
780 v5 = v4; | |
1029 | 781 return fixpoint_from_float(v5); |
0 | 782 } |
783 | |
784 //----- (004A80DC) -------------------------------------------------------- | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
502
diff
changeset
|
785 void stru6::_4A80DC_some_stuff_sw(SpriteObject *a2) |
0 | 786 { |
787 signed int v3; // ebx@1 | |
619 | 788 Particle_sw local_0; // [sp+Ch] [bp-68h]@1 |
0 | 789 |
790 memset(&local_0, 0, 0x68u); | |
619 | 791 local_0.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_1; |
792 local_0.uDiffuse = 0x7E7E7E; | |
0 | 793 local_0.timeToLive = (rand() & 0x7F) + 128; |
1390 | 794 local_0.uTextureID = uTextureID_effpar1; |
0 | 795 v3 = 8; |
796 local_0.flt_28 = 1.0; | |
797 do | |
798 { | |
799 local_0.x = pRnd->GetRandom() * 40.0 + (double)a2->vPosition.x - 20.0; | |
800 local_0.y = pRnd->GetRandom() * 40.0 + (double)a2->vPosition.y - 20.0; | |
801 local_0.z = (double)a2->vPosition.z; | |
1390 | 802 local_0.r = pRnd->GetRandom() * 800.0 - 400.0; |
803 local_0.g = pRnd->GetRandom() * 800.0 - 400.0; | |
804 local_0.b = pRnd->GetRandom() * 350.0 + 50.0; | |
0 | 805 pGame->pParticleEngine->AddParticle(&local_0); |
806 --v3; | |
807 } | |
808 while ( v3 ); | |
809 } | |
810 | |
811 //----- (004A81CA) -------------------------------------------------------- | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
502
diff
changeset
|
812 bool stru6::_4A81CA(SpriteObject *a2) |
0 | 813 { |
564 | 814 //stru6 *v2; // ebx@1 |
0 | 815 int result; // eax@1 |
816 int v4; // eax@27 | |
564 | 817 //unsigned int diffuse; // esi@41 |
818 //int v6; // ecx@49 | |
0 | 819 int v7; // eax@54 |
820 int v8; // eax@55 | |
821 char v9; // zf@56 | |
822 int v10; // eax@59 | |
823 int v11; // eax@61 | |
824 int v12; // eax@85 | |
825 int v13; // eax@86 | |
826 int v14; // eax@96 | |
827 int v15; // eax@111 | |
828 int v16; // eax@118 | |
829 int v17; // eax@139 | |
830 int v18; // eax@140 | |
831 int v19; // eax@141 | |
832 int v20; // eax@151 | |
564 | 833 //unsigned int v21; // [sp-8h] [bp-20h]@66 |
834 //SpriteObject *v22; // [sp-8h] [bp-20h]@81 | |
835 //unsigned int v23; // [sp-4h] [bp-1Ch]@4 | |
836 //unsigned int v24; // [sp-4h] [bp-1Ch]@5 | |
0 | 837 unsigned int v25; // [sp-4h] [bp-1Ch]@30 |
564 | 838 //unsigned int v26; // [sp-4h] [bp-1Ch]@57 |
839 //unsigned int v27; // [sp-4h] [bp-1Ch]@66 | |
840 //int v28; // [sp-4h] [bp-1Ch]@81 | |
841 //unsigned int v29; // [sp+0h] [bp-18h]@4 | |
842 //unsigned int v30; // [sp+0h] [bp-18h]@5 | |
843 //int v31; // [sp+0h] [bp-18h]@30 | |
844 //unsigned int v32; // [sp+0h] [bp-18h]@45 | |
845 //float v33; // [sp+0h] [bp-18h]@57 | |
846 //float v34; // [sp+0h] [bp-18h]@66 | |
847 //signed int v35; // [sp+0h] [bp-18h]@81 | |
0 | 848 char pContainer[7]; // [sp+10h] [bp-8h]@81 |
849 | |
564 | 850 //__debugbreak(); // need to refactor carefully & collect data |
851 //v2 = this; | |
515
cb0ad52d6a26
LayingItem -> SpriteObject (long-waited rename, old name was inaccurate and confused people)
Nomad
parents:
502
diff
changeset
|
852 result = a2->uType; |
564 | 853 |
854 switch (a2->uType) | |
855 { | |
796
14beae4f1723
Last observable issues with walking in dragon cave fixed.
Nomad
parents:
733
diff
changeset
|
856 case 500: // blue rat bolt for example |
14beae4f1723
Last observable issues with walking in dragon cave fixed.
Nomad
parents:
733
diff
changeset
|
857 case 530: |
14beae4f1723
Last observable issues with walking in dragon cave fixed.
Nomad
parents:
733
diff
changeset
|
858 _4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc(a2, 0x00AAAFF, uTextureID_effpar1); |
14beae4f1723
Last observable issues with walking in dragon cave fixed.
Nomad
parents:
733
diff
changeset
|
859 return false; |
14beae4f1723
Last observable issues with walking in dragon cave fixed.
Nomad
parents:
733
diff
changeset
|
860 |
14beae4f1723
Last observable issues with walking in dragon cave fixed.
Nomad
parents:
733
diff
changeset
|
861 case 510: // dragon fire for example |
14beae4f1723
Last observable issues with walking in dragon cave fixed.
Nomad
parents:
733
diff
changeset
|
862 _4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc(a2, 0xFF3C1E, uTextureID_effpar1); |
14beae4f1723
Last observable issues with walking in dragon cave fixed.
Nomad
parents:
733
diff
changeset
|
863 return false; |
14beae4f1723
Last observable issues with walking in dragon cave fixed.
Nomad
parents:
733
diff
changeset
|
864 |
567 | 865 case 545: |
564 | 866 case 550: |
867 case 555: return true; | |
868 | |
869 case 556: | |
870 AddMobileLight(a2, 0xFF0000, 256); | |
871 return false; | |
872 | |
873 case 600: | |
874 AddMobileLight(a2, 0xFF3C1E, 256); | |
875 return true; | |
876 | |
877 case 1010: // Fire Bolt | |
878 { | |
879 _4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc(a2, 0xFF3C1E, uTextureID_effpar1); | |
880 AddMobileLight(a2, 0xFF3C1E, 256); | |
881 } | |
882 return false; | |
883 | |
884 case 1011: // Fire Bolt impact | |
885 { | |
886 _4A75CC_single_spell_collision_particle(a2, 0xFF3C1E, uTextureID_effpar1); | |
887 AddMobileLight(a2, 0xFF3C1E, 256); | |
888 } | |
889 return false; | |
890 | |
891 case 1050: // Fireball | |
892 { | |
893 _4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc(a2, 0xFF3C1E, uTextureID_effpar1); | |
894 AddMobileLight(a2, 0xFF3C1E, 256); | |
895 } | |
896 return false; | |
897 | |
898 case 1051: // Fireball hit | |
899 { | |
900 AddMobileLight(a2, 0xFF3C1E, 256); | |
901 if (pRenderer->pRenderD3D) | |
902 { | |
848 | 903 result = PID_TYPE(a2->spell_caster_pid); |
828
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
822
diff
changeset
|
904 if (PID_TYPE(a2->spell_caster_pid) != OBJECT_Actor && |
0f56abdcce94
Massive refactors of spells + PID (packed id) macros introduced.
Nomad
parents:
822
diff
changeset
|
905 PID_TYPE(a2->spell_caster_pid) != OBJECT_Item) |
564 | 906 { |
907 if (field_204 != 4) | |
908 { | |
909 field_204++; | |
910 _4A7688_fireball_collision_particle(a2); | |
911 } | |
912 return false; | |
913 } | |
914 } | |
915 } | |
916 return true; | |
917 | |
918 case 1081: | |
919 { | |
920 _4A7A66_miltiple_spell_collision_partifles___like_after_sparks_or_lightning(a2, 0xFF3C1E, uTextureID_effpar1, 300.0); | |
921 _4A7A66_miltiple_spell_collision_partifles___like_after_sparks_or_lightning(a2, 0xFF3C1E, uTextureID_effpar1, 250.0); | |
922 _4A7A66_miltiple_spell_collision_partifles___like_after_sparks_or_lightning(a2, 0xFF3C1E, uTextureID_effpar1, 200.0); | |
923 AddMobileLight(a2, 0xFF3C1E, 256); | |
924 } | |
925 return false; | |
926 | |
927 case 2101: | |
928 { | |
929 _4A7A66_miltiple_spell_collision_partifles___like_after_sparks_or_lightning(a2, 0xC8C814, uTextureID_effpar1, 200.0); | |
930 AddMobileLight(a2, 0xC8C814, 256); | |
931 } | |
932 return false; | |
933 | |
934 case 3060: // Acid Burst | |
935 _4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc(a2, 0x0AB450, uTextureID_effpar1); | |
936 AddMobileLight(a2, 0x0AB450, 256); | |
937 return false; | |
938 | |
939 case 9000: return true; | |
940 } | |
941 | |
567 | 942 if ( result < 545 ) |
0 | 943 { |
1705 | 944 //__debugbreak(); // find out what kind of spells are these |
1102 | 945 // when summoned light elemental attacks |
1424 | 946 //cast spell from trees in Avlee |
0 | 947 result -= 500; |
948 switch ( result ) | |
949 { | |
950 case 1: | |
951 case 31: | |
564 | 952 _4A75CC_single_spell_collision_particle(a2, 0xAAAFF, uTextureID_effpar1); |
953 return true; | |
0 | 954 case 5: |
564 | 955 _4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc(a2, 0x5C310E, uTextureID_effpar1); |
956 return false; | |
0 | 957 case 15: |
564 | 958 _4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc(a2, 0x0062D0, uTextureID_effpar1); |
959 return false; | |
0 | 960 case 16: |
564 | 961 _4A75CC_single_spell_collision_particle(a2, 0x0062D0, uTextureID_effpar1); |
962 return false; | |
0 | 963 case 20: |
564 | 964 _4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc(a2, 0x0AB450, uTextureID_effpar1); |
965 return false; | |
0 | 966 case 21: |
564 | 967 _4A75CC_single_spell_collision_particle(a2, 0x0AB450, uTextureID_effpar1); |
968 return false; | |
0 | 969 case 25: |
564 | 970 _4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc(a2, 0xC8C805, uTextureID_effpar1); |
971 return false; | |
0 | 972 case 26: |
564 | 973 _4A75CC_single_spell_collision_particle(a2, 0xC8C805, uTextureID_effpar1); |
974 return false; | |
0 | 975 case 35: |
564 | 976 _4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc(a2, 0xFFFFFF, uTextureID_effpar1); |
977 return false; | |
0 | 978 case 36: |
564 | 979 _4A75CC_single_spell_collision_particle(a2, 0xFFFFFF, uTextureID_effpar1); |
980 return false; | |
981 | |
0 | 982 case 40: |
564 | 983 _4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc(a2, 0x7E7E7E, uTextureID_effpar1); |
984 return false; | |
985 | |
0 | 986 case 11: |
564 | 987 _4A75CC_single_spell_collision_particle(a2, 0xFF3C1E, uTextureID_effpar1); |
988 return false; | |
0 | 989 case 6: |
564 | 990 _4A75CC_single_spell_collision_particle(a2, 0x5C310E, uTextureID_effpar1); |
991 return false; | |
992 | |
0 | 993 case 41: |
564 | 994 _4A75CC_single_spell_collision_particle(a2, 0x7E7E7E, uTextureID_effpar1); |
995 return false; | |
0 | 996 default: |
564 | 997 return false; |
0 | 998 } |
564 | 999 return false; |
0 | 1000 } |
564 | 1001 |
0 | 1002 if ( result <= 4051 ) |
1003 { | |
1004 if ( result != 4051 ) | |
1005 { | |
1006 if ( result <= 2031 ) | |
1007 { | |
1008 if ( result != 2031 ) | |
1009 { | |
564 | 1010 if ( result < 1051 ) |
0 | 1011 { |
564 | 1012 if ( result < 600 ) |
0 | 1013 { |
564 | 1014 _4A75CC_single_spell_collision_particle(a2, 0xFF3C1E, uTextureID_effpar1); |
1015 return false; | |
0 | 1016 } |
1017 if ( result < 811 ) | |
564 | 1018 return false; |
0 | 1019 if ( result <= 814 ) |
564 | 1020 return true; |
1021 return false; | |
1022 | |
0 | 1023 } |
1024 if ( result <= 1081 ) | |
1025 { | |
564 | 1026 if (result != 1081) |
0 | 1027 { |
1028 result -= 1060; | |
1029 if ( !result ) | |
564 | 1030 return true; |
0 | 1031 v7 = result - 1; |
1032 if ( v7 ) | |
1033 { | |
1034 v8 = v7 - 9; | |
1035 if ( !v8 ) | |
1036 { | |
564 | 1037 _4A75CC_single_spell_collision_particle(a2, 0xFF3C1E, uTextureID_effpar1); |
1038 return false; | |
0 | 1039 } |
1040 result = v8 - 10; | |
1041 v9 = result == 0; | |
564 | 1042 //LABEL_129: |
0 | 1043 if ( v9 ) |
564 | 1044 return true; |
1045 return false; | |
0 | 1046 } |
564 | 1047 _4A7A66_miltiple_spell_collision_partifles___like_after_sparks_or_lightning(a2, 0xFF3C1E, uTextureID_effpar1, 250.0); |
1048 AddMobileLight(a2, 0xFF3C1E, 256); | |
1049 return false; | |
0 | 1050 } |
564 | 1051 //LABEL_84: |
1052 // _4A7A66_miltiple_spell_collision_partifles___like_after_sparks_or_lightning(a2, diffuse, v26, v33); | |
1053 //goto LABEL_43; | |
1054 return false; | |
0 | 1055 } |
1056 v10 = result - 1090; | |
1057 if ( v10 ) | |
1058 { | |
1059 result = v10 - 10; | |
1060 if ( !result ) | |
564 | 1061 return true; |
0 | 1062 v11 = result - 1; |
1063 if ( !v11 ) | |
1064 { | |
564 | 1065 //diffuse = 0xFF3C1E; |
1066 _4A75CC_single_spell_collision_particle(a2, 0xFF3C1E, uTextureID_effpar1); | |
1067 //v32 = v2->uTextureID_effpar1; | |
1068 _4A75CC_single_spell_collision_particle(a2, 0xFF3C1E, uTextureID_effpar1); | |
1069 //goto LABEL_43; | |
1070 AddMobileLight(a2, 0xFF3C1E, 256); | |
1071 return false; | |
0 | 1072 } |
1073 result = v11 - 929; | |
1074 if ( result ) | |
564 | 1075 return false; |
1076 //LABEL_63: | |
0 | 1077 if ( !pRenderer->pRenderD3D ) |
564 | 1078 return true; |
0 | 1079 _4A78AE_sparks_spell(a2); |
564 | 1080 AddMobileLight(a2, 0x64640F, 128); |
1081 return false; | |
0 | 1082 } |
564 | 1083 |
1084 _4A7A66_miltiple_spell_collision_partifles___like_after_sparks_or_lightning(a2, 0xFF3C1Eu, uTextureID_effpar1, 250.0); | |
1085 return false; | |
0 | 1086 } |
564 | 1087 //goto LABEL_67; |
0 | 1088 } |
564 | 1089 if ( result < 3060 ) |
0 | 1090 { |
564 | 1091 if ( result < 2101 ) |
0 | 1092 { |
1093 if ( result != 2060 ) | |
1094 { | |
1095 if ( result != 2061 ) | |
1096 { | |
1097 if ( result <= 2079 ) | |
564 | 1098 return false; |
0 | 1099 if ( result <= 2081 ) |
1100 { | |
1101 if ( pRenderer->pRenderD3D ) | |
1390 | 1102 _4A77FD_implosion_particle(a2); |
0 | 1103 else |
1104 _4A80DC_some_stuff_sw(a2); | |
564 | 1105 return false; |
0 | 1106 } |
1107 v9 = result == 2100; | |
564 | 1108 if ( v9 ) |
1109 return true; | |
1110 return false; | |
0 | 1111 } |
564 | 1112 _4A7A66_miltiple_spell_collision_partifles___like_after_sparks_or_lightning(a2, 0xC8C814, uTextureID_effpar2, 200.0); |
1113 AddMobileLight(a2, 0xC8C814, 256); | |
1114 return false; | |
0 | 1115 } |
1116 if ( !pRenderer->pRenderD3D ) | |
564 | 1117 return true; |
0 | 1118 memcpy(pContainer, "sp18h1", 7); |
1119 pRnd->SetRange(1, 6); | |
1120 pContainer[5] = pRnd->GetInRange() + '0'; | |
564 | 1121 AddProjectile(a2, 100, pBitmaps_LOD->LoadTexture(pContainer)); |
1122 return false; | |
0 | 1123 } |
1124 v12 = result - 3010; | |
1125 if ( !v12 ) | |
1126 { | |
564 | 1127 _4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc(a2, 0xAB450, uTextureID_effpar1); |
1128 AddMobileLight(a2, 0xAB450, 256); | |
1129 return false; | |
0 | 1130 } |
1131 v13 = v12 - 1; | |
1132 if ( !v13 ) | |
1133 { | |
564 | 1134 _4A75CC_single_spell_collision_particle(a2, 0xAB450, uTextureID_effpar1); |
1135 AddMobileLight(a2, 0xAB450, 256); | |
1136 return false; | |
0 | 1137 } |
1138 result = v13 - 19; | |
1139 if ( !result ) | |
564 | 1140 return true; |
0 | 1141 --result; |
1142 if ( result ) | |
564 | 1143 return false; |
1144 | |
1145 _4A75CC_single_spell_collision_particle(a2, 0x9EB9F1, uTextureID_effpar1); | |
1146 AddMobileLight(a2, 0x9EB9F1, 256); | |
1147 return false; | |
0 | 1148 } |
1149 if ( result > 4000 ) | |
1150 { | |
1151 result -= 4030; | |
1152 if ( !result || (--result, !result) ) | |
564 | 1153 return true; |
0 | 1154 result -= 19; |
1155 v9 = result == 0; | |
564 | 1156 if ( v9 ) |
1157 return true; | |
1158 return false; | |
0 | 1159 } |
1160 if ( result == 4000 ) | |
1161 { | |
1162 if ( !pRenderer->pRenderD3D ) | |
564 | 1163 return true; |
0 | 1164 _4A7C07(a2); |
564 | 1165 return false; |
0 | 1166 } |
1167 result -= 3061; | |
1168 if ( !result || (result -= 29) == 0 ) | |
564 | 1169 return true; |
0 | 1170 v14 = result - 1; |
1171 if ( !v14 ) | |
564 | 1172 { |
1173 _4A75CC_single_spell_collision_particle(a2, 0x9EB9F1, uTextureID_effpar1); | |
1174 AddMobileLight(a2, 0x9EB9F1, 256); | |
1175 return false; | |
1176 } | |
0 | 1177 result = v14 - 1; |
1178 if ( result ) | |
564 | 1179 return false; |
1180 _4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc(a2, 0x9EB9F1, uTextureID_effpar1); | |
1181 return false; | |
0 | 1182 } |
564 | 1183 _4A7948_mind_blast_after_effect(a2); |
1184 return false; | |
0 | 1185 } |
1186 if ( result <= 7090 ) | |
1187 { | |
1188 if ( result == 7090 ) | |
564 | 1189 return true; |
0 | 1190 if ( result > 6030 ) |
1191 { | |
1192 if ( result > 6091 ) | |
1193 { | |
1194 result -= 6100; | |
1195 if ( !result ) | |
564 | 1196 return true; |
0 | 1197 result -= 930; |
1198 if ( result ) | |
1199 { | |
1200 --result; | |
564 | 1201 if (!result) |
1202 _4A75CC_single_spell_collision_particle(a2, 0xF00000, uTextureID_effpar1); | |
1203 return false; | |
0 | 1204 } |
564 | 1205 if ( !pRenderer->pRenderD3D ) |
1206 return true; | |
1207 _4A78AE_sparks_spell(a2); | |
1208 AddMobileLight(a2, 0x64640F, 128); | |
1209 return false; | |
0 | 1210 } |
1211 if ( result != 6091 ) | |
1212 { | |
1213 result -= 6040; | |
1214 if ( !result || (result -= 20) == 0 || (result -= 10) == 0 ) | |
564 | 1215 return true; |
0 | 1216 result -= 20; |
1217 v9 = result == 0; | |
564 | 1218 if ( v9 ) |
1219 return true; | |
1220 return false; | |
0 | 1221 } |
1222 } | |
1223 else | |
1224 { | |
1225 if ( result == 6030 ) | |
564 | 1226 return true; |
0 | 1227 if ( result <= 4091 ) |
1228 { | |
1229 if ( result != 4091 ) | |
1230 { | |
1231 result -= 4070; | |
1232 if ( !result ) | |
564 | 1233 return true; |
0 | 1234 v15 = result - 1; |
1235 if ( v15 ) | |
1236 { | |
1237 result = v15 - 9; | |
1238 if ( !result ) | |
564 | 1239 return true; |
0 | 1240 result -= 10; |
1241 if ( !result ) | |
1242 { | |
564 | 1243 _4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc(a2, 0x7E7E7E, uTextureID_effpar1); |
1244 return true; | |
0 | 1245 } |
564 | 1246 return false; |
0 | 1247 } |
564 | 1248 _4A75CC_single_spell_collision_particle(a2, 0x5C310E, uTextureID_effpar1); |
1249 return false; | |
0 | 1250 } |
564 | 1251 _4A7A66_miltiple_spell_collision_partifles___like_after_sparks_or_lightning(a2, 0x7E7E7E, uTextureID_effpar1, 200.0); |
1252 return false; | |
0 | 1253 } |
1254 v16 = result - 4092; | |
1255 if ( !v16 ) | |
1256 { | |
564 | 1257 _4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc(a2, 0x7E7E7E, uTextureID_effpar1); |
1258 return false; | |
0 | 1259 } |
1260 result = v16 - 8; | |
1261 if ( !result ) | |
564 | 1262 return false; |
0 | 1263 result -= 1910; |
1264 if ( !result ) | |
564 | 1265 return true; |
0 | 1266 --result; |
1267 if ( result ) | |
564 | 1268 return false; |
0 | 1269 } |
564 | 1270 //LABEL_122: |
0 | 1271 _4A7948_mind_blast_after_effect(a2); |
564 | 1272 return false; |
0 | 1273 } |
1274 if ( result <= 9000 ) | |
1275 { | |
1276 if ( result <= 8030 ) | |
1277 { | |
1278 if ( result == 8030 ) | |
564 | 1279 return true; |
0 | 1280 v17 = result - 7091; |
1281 if ( v17 ) | |
1282 { | |
1283 v18 = v17 - 909; | |
1284 if ( !v18 ) | |
1285 { | |
564 | 1286 _4A73AA_hanging_trace_particles___like_fire_strike_ice_blast_etc(a2, 0xFFFFFF, uTextureID_effpar3); |
1287 AddMobileLight(a2, 0xFFFFFF, 128); | |
1288 return false; | |
0 | 1289 } |
1290 v19 = v18 - 1; | |
1291 if ( v19 ) | |
1292 { | |
1293 result = v19 - 9; | |
1294 if ( !result ) | |
1295 { | |
564 | 1296 AddMobileLight(a2, 0xFFFFFF, 64); |
1297 return false; | |
0 | 1298 } |
564 | 1299 return false; |
0 | 1300 } |
564 | 1301 _4A75CC_single_spell_collision_particle(a2, 0xFFFFFF, uTextureID_effpar2); |
1302 AddMobileLight(a2, 0xFFFFFF, 256); | |
1303 return false; | |
0 | 1304 } |
1305 else | |
1306 { | |
564 | 1307 _4A75CC_single_spell_collision_particle(a2, 0xF00000, uTextureID_effpar1); |
1308 AddMobileLight(a2, 0xF00000, 256); | |
1309 return false; | |
0 | 1310 } |
1311 } | |
1312 result -= 8040; | |
1313 if ( !result || (result -= 20) == 0 ) | |
564 | 1314 return true; |
0 | 1315 v20 = result - 30; |
1316 if ( v20 ) | |
1317 { | |
1318 result = v20 - 1; | |
1319 if ( result ) | |
564 | 1320 return false; |
1321 | |
1322 _4A75CC_single_spell_collision_particle(a2, 0xFFFFFF, uTextureID_effpar3); | |
1323 return false; | |
0 | 1324 } |
564 | 1325 AddMobileLight(a2, 0xFFFFFFu, 128); |
0 | 1326 if ( !pRenderer->pRenderD3D ) |
564 | 1327 return true; |
1328 AddProjectile(a2, 100, -1); | |
1329 return false; | |
0 | 1330 } |
1331 if ( result > 9050 ) | |
1332 { | |
1333 result -= 9070; | |
1334 if ( !result || (result -= 10) == 0 || (--result, !result) ) | |
564 | 1335 return true; |
1336 return false; | |
0 | 1337 } |
1338 if ( result == 9050 || (result -= 9010) == 0 || (result -= 20) == 0 || (result -= 10) == 0 ) | |
564 | 1339 return true; |
0 | 1340 --result; |
1341 if ( !result ) | |
1342 { | |
564 | 1343 //LABEL_164: |
1344 _4A75CC_single_spell_collision_particle(a2, 0x7E7E7E, uTextureID_effpar1); | |
1345 return false; | |
0 | 1346 } |
564 | 1347 //LABEL_168: |
1348 return false; | |
0 | 1349 } |
1350 | |
1351 //----- (004A89BD) -------------------------------------------------------- | |
486 | 1352 void stru6::SetPlayerBuffAnim(unsigned __int16 uSpellID, unsigned __int16 uPlayerID) |
0 | 1353 { |
486 | 1354 //stru6 *v3; // edi@1 |
0 | 1355 PlayerBuffAnim *v4; // esi@1 |
1356 const char *v6; // [sp-4h] [bp-10h]@2 | |
1357 | |
486 | 1358 v4 = &pPlayerBuffs[uPlayerID]; |
491 | 1359 v4->uSpellAnimTimeElapsed = 0; |
486 | 1360 v4->bRender = uSpellID != 0; |
1361 | |
1362 switch (uSpellID) | |
0 | 1363 { |
920 | 1364 case SPELL_DISEASE: |
0 | 1365 v6 = "zapp"; |
486 | 1366 break; |
1367 | |
495 | 1368 case BECOME_MAGIC_GUILD_MEMBER: |
0 | 1369 case SPELL_AIR_FEATHER_FALL: |
1370 case SPELL_SPIRIT_DETECT_LIFE: | |
486 | 1371 case SPELL_SPIRIT_FATE: |
0 | 1372 v6 = "spboost1"; |
486 | 1373 break; |
1374 | |
501 | 1375 case SPELL_QUEST_COMPLETED: |
486 | 1376 case SPELL_AIR_INVISIBILITY: |
0 | 1377 case SPELL_WATER_WATER_WALK: |
486 | 1378 case SPELL_SPIRIT_PRESERVATION: |
0 | 1379 v6 = "spboost2"; |
486 | 1380 break; |
1381 | |
488 | 1382 case SPELL_152: |
486 | 1383 __debugbreak(); // spell id == 152 wtf |
1384 case SPELL_LIGHT_HOUR_OF_POWER: | |
1385 case SPELL_LIGHT_DAY_OF_THE_GODS: | |
1386 case SPELL_LIGHT_DAY_OF_PROTECTION: | |
1387 case SPELL_LIGHT_DIVINE_INTERVENTION: | |
0 | 1388 v6 = "spboost3"; |
486 | 1389 break; |
1390 | |
1391 case SPELL_SPIRIT_REMOVE_CURSE: | |
0 | 1392 case SPELL_MIND_REMOVE_FEAR: |
1393 case SPELL_BODY_CURE_WEAKNESS: | |
1394 v6 = "spheal1"; | |
486 | 1395 break; |
1396 | |
1397 case SPELL_SPIRIT_SHARED_LIFE: | |
0 | 1398 case SPELL_MIND_CURE_PARALYSIS: |
486 | 1399 case SPELL_MIND_CURE_INSANITY: |
0 | 1400 case SPELL_BODY_FIRST_AID: |
1401 case SPELL_BODY_CURE_POISON: | |
1402 case SPELL_BODY_CURE_DISEASE: | |
486 | 1403 case SPELL_DARK_SACRIFICE: |
0 | 1404 v6 = "spheal2"; |
486 | 1405 break; |
1406 | |
1407 case SPELL_BODY_POWER_CURE: | |
1408 case SPELL_DARK_SOULDRINKER: | |
0 | 1409 v6 = "spheal3"; |
486 | 1410 break; |
1411 | |
0 | 1412 case SPELL_FIRE_PROTECTION_FROM_FIRE: |
486 | 1413 case SPELL_FIRE_IMMOLATION: |
0 | 1414 v6 = "spell03"; |
486 | 1415 break; |
1416 | |
1417 case SPELL_FIRE_HASTE: v6 = "spell05"; break; | |
1418 case SPELL_AIR_PROTECTION_FROM_AIR: v6 = "spell14"; break; | |
1419 case SPELL_AIR_SHIELD: v6 = "spell17"; break; | |
1420 case SPELL_WATER_PROTECTION_FROM_WATER: v6 = "spell25"; break; | |
1421 case SPELL_EARTH_PROTECTION_FROM_EARTH: v6 = "spell36"; break; | |
1422 case SPELL_EARTH_STONESKIN: v6 = "spell38"; break; | |
1423 case SPELL_SPIRIT_BLESS: v6 = "spell46"; break; | |
1424 case SPELL_SPIRIT_HEROISM: v6 = "spell51"; break; | |
1425 case SPELL_SPIRIT_RESSURECTION: v6 = "spell55"; break; | |
1426 case SPELL_MIND_PROTECTION_FROM_MIND: v6 = "spell58"; break; | |
1427 case SPELL_BODY_PROTECTION_FROM_BODY: v6 = "spell69"; break; | |
1428 case SPELL_BODY_REGENERATION: v6 = "spell71"; break; | |
1429 case SPELL_BODY_HAMMERHANDS: v6 = "spell73"; break; | |
1430 case SPELL_BODY_PROTECTION_FROM_MAGIC: v6 = "spell75"; break; | |
1431 | |
0 | 1432 default: |
486 | 1433 v4->bRender = false; |
1434 return; | |
0 | 1435 } |
486 | 1436 |
1437 v4->uSpellIconID = pIconsFrameTable->FindIcon(v6); | |
1438 if (v4->bRender) | |
1439 v4->uSpellAnimTime = 8 * pIconsFrameTable->pIcons[v4->uSpellIconID].uAnimLength; | |
0 | 1440 } |
1441 | |
1442 //----- (004A8BDF) -------------------------------------------------------- | |
1443 void stru6::FadeScreen__like_Turn_Undead_and_mb_Armageddon(unsigned int uDiffuseColor, unsigned int uFadeTime) | |
1444 { | |
1445 this->uFadeTime = uFadeTime; | |
1446 this->uFadeTime2 = uFadeTime; | |
1447 this->uFadeColor = uDiffuseColor; | |
1448 } | |
1449 | |
1450 //----- (004A8BFC) -------------------------------------------------------- | |
1451 int stru6::_4A8BFC() | |
1452 { | |
1390 | 1453 uAnimLength = 8 * pSpriteFrameTable->pSpriteSFrames[pSpriteFrameTable->FastFindSprite("spell84")].uAnimLength; |
1454 return uAnimLength; | |
0 | 1455 } |
1456 | |
1457 //----- (004A8C27) -------------------------------------------------------- | |
1458 void stru6::RenderSpecialEffects() | |
1459 { | |
1460 double v4; // st7@4 | |
1461 double v5; // st6@4 | |
1462 double v6; // st7@4 | |
1463 float v7; // ST14_4@6 | |
1464 unsigned int v8; // ST14_4@8 | |
1465 unsigned int v9; // eax@8 | |
1466 SpriteFrame *v10; // eax@8 | |
1467 int v11; // edi@8 | |
1468 double v12; // st7@9 | |
1469 double v13; // st7@9 | |
1470 double v14; // st7@9 | |
1471 double v15; // st6@9 | |
1472 HRESULT v16; // eax@9 | |
1473 HRESULT v17; // eax@9 | |
1474 signed __int64 v18; // qtt@10 | |
1475 const char *v19; // [sp+4h] [bp-E8h]@0 | |
1476 int v20; // [sp+8h] [bp-E4h]@0 | |
1477 unsigned int v21; // [sp+Ch] [bp-E0h]@0 | |
1478 RenderBillboardTransform_local0 vsr; // [sp+10h] [bp-DCh]@10 | |
1479 RenderVertexD3D3 vd3d[4]; // [sp+60h] [bp-8Ch]@9 | |
1480 int v24; // [sp+E0h] [bp-Ch]@10 | |
1481 SpriteFrame *v70; // [sp+E4h] [bp-8h]@8 | |
1482 unsigned int v26; // [sp+E8h] [bp-4h]@3 | |
1483 | |
1484 if (uNumProjectiles) | |
1485 { | |
1486 DrawProjectiles(); | |
1487 uNumProjectiles = 0; | |
1488 } | |
1489 | |
1490 field_204 = 0; | |
1491 v26 = uFadeTime; | |
1492 if ( v26 > 0 ) | |
1493 { | |
1494 v4 = (double)(signed int)v26 / (double)uFadeTime2; | |
1495 v5 = 1.0 - v4 * v4; | |
1496 v6 = v5; | |
1497 if ( v5 > 0.9 ) | |
1498 v6 = 1.0 - (v5 - 0.9) * 10.0; | |
1499 v7 = v6; | |
1500 pRenderer->_4A52F1(uFadeColor, v7); | |
1501 uFadeTime -= pEventTimer->uTimeElapsed; | |
1502 } | |
1503 | |
1504 if (uAnimLength > 0) | |
1505 { | |
1506 v8 = 8 | |
1507 * pSpriteFrameTable->pSpriteSFrames[pSpriteFrameTable->FastFindSprite("spell84")].uAnimLength | |
1508 - uAnimLength; | |
1509 v9 = pSpriteFrameTable->FastFindSprite("spell84"); | |
1510 v10 = pSpriteFrameTable->GetFrame(v9, v8); | |
1511 v11 = v10->pHwSpriteIDs[0]; | |
1512 v70 = v10; | |
1513 uAnimLength -= pEventTimer->uTimeElapsed; | |
1514 if ( pRenderer->pRenderD3D ) | |
1515 { | |
693 | 1516 v12 = (double)(signed int)pViewport->uViewportTL_X; |
0 | 1517 vd3d[0].pos.x = v12; |
1518 vd3d[1].pos.x = v12; | |
693 | 1519 v13 = (double)(signed int)pViewport->uViewportBR_X; |
1520 v26 = pViewport->uViewportBR_Y + 1; | |
0 | 1521 vd3d[0].diffuse = 0x7F7F7Fu; |
1522 vd3d[1].diffuse = 0x7F7F7Fu; | |
1523 vd3d[2].pos.x = v13; | |
1524 vd3d[3].pos.x = v13; | |
693 | 1525 v14 = (double)(signed int)pViewport->uViewportTL_Y; |
0 | 1526 vd3d[2].diffuse = 0x7F7F7Fu; |
1527 vd3d[3].diffuse = 0x7F7F7Fu; | |
1528 vd3d[0].specular = 0; | |
1529 vd3d[1].specular = 0; | |
1530 vd3d[0].pos.y = v14; | |
693 | 1531 v15 = (double)(pViewport->uViewportBR_Y + 1); |
0 | 1532 vd3d[2].specular = 0; |
1533 vd3d[3].specular = 0; | |
1534 vd3d[1].pos.y = v15; | |
1535 vd3d[2].pos.y = v15; | |
1536 vd3d[3].pos.y = v14; | |
1537 vd3d[0].pos.z = 0.0; | |
1538 vd3d[1].pos.z = 0.0; | |
1539 vd3d[2].pos.z = 0.0; | |
1540 vd3d[3].pos.z = 0.0; | |
1541 vd3d[0].rhw = 1.0; | |
1542 vd3d[1].rhw = 1.0; | |
1543 vd3d[2].rhw = 1.0; | |
1544 vd3d[3].rhw = 1.0; | |
1545 vd3d[0].texcoord.x = 0.0; | |
1546 vd3d[1].texcoord.x = 0.0; | |
1547 vd3d[2].texcoord.x = 1.0; | |
1548 vd3d[3].texcoord.x = 1.0; | |
1549 vd3d[0].texcoord.y = 0.0; | |
1550 vd3d[1].texcoord.y = 1.0; | |
1551 vd3d[2].texcoord.y = 1.0; | |
1552 vd3d[3].texcoord.y = 0.0; | |
1553 pRenderer->pRenderD3D->pDevice->SetTexture( | |
1554 0, | |
1555 pSprites_LOD->pHardwareSprites[v11].pTexture); | |
186 | 1556 pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_FOGENABLE, FALSE); |
1557 pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, TRUE); | |
1558 pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, FALSE); | |
1559 pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE); | |
1560 pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ONE); | |
1561 pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, FALSE); | |
1562 pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZFUNC, D3DCMP_ALWAYS); | |
719 | 1563 pRenderer->pRenderD3D->pDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, |
1564 D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1, vd3d, 4, 28); | |
186 | 1565 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND, D3DBLEND_ONE)); |
1566 ErrD3D(pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND, D3DBLEND_ZERO)); | |
1567 pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE, FALSE); | |
1568 pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZWRITEENABLE, TRUE); | |
1569 pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_DITHERENABLE, TRUE); | |
1570 pRenderer->pRenderD3D->pDevice->SetRenderState(D3DRENDERSTATE_ZFUNC, D3DCMP_LESS); | |
0 | 1571 } |
1572 else | |
1573 { | |
1574 vsr.pTarget = pRenderer->pTargetSurface; | |
2002 | 1575 vsr.sParentBillboardID = -1; |
0 | 1576 vsr.pTargetZ = pRenderer->pActiveZBuffer; |
693 | 1577 vsr.uScreenSpaceX = (signed int)(pViewport->uViewportBR_X - pViewport->uViewportTL_X) / 2; |
1578 vsr.uScreenSpaceY = pViewport->uViewportBR_Y; | |
0 | 1579 v24 = 16777216; |
1580 LODWORD(v18) = 0; | |
693 | 1581 HIDWORD(v18) = (signed __int16)(LOWORD(pViewport->uViewportBR_X) - LOWORD(pViewport->uViewportTL_X)); |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
142
diff
changeset
|
1582 vsr._screenspace_x_scaler_packedfloat = v18 / 0x1000000; |
0 | 1583 LODWORD(v18) = 0; |
693 | 1584 HIDWORD(v18) = (signed __int16)(LOWORD(pViewport->uViewportBR_Y) - LOWORD(pViewport->uViewportTL_Y)); |
0 | 1585 v26 = v18 / 16777216; |
144
8ab4484c22e0
Billboard drawing's up (actors, decorations, misc sprites)
Nomad
parents:
142
diff
changeset
|
1586 vsr._screenspace_y_scaler_packedfloat = v18 / 0x1000000; |
0 | 1587 vsr.pPalette = PaletteManager::Get_Dark_or_Red_LUT(v70->uPaletteIndex, 0, 1); |
1588 vsr.uTargetPitch = pRenderer->uTargetSurfacePitch; | |
2002 | 1589 vsr.sParentBillboardID = -1; |
693 | 1590 vsr.uViewportX = pViewport->uViewportTL_X; |
1591 vsr.uViewportZ = pViewport->uViewportBR_X; | |
1592 vsr.uViewportY = pViewport->uViewportTL_Y; | |
0 | 1593 vsr.sZValue = 0; |
693 | 1594 vsr.uViewportW = pViewport->uViewportBR_Y; |
0 | 1595 vsr.uFlags = 0; |
1596 if ( v11 >= 0 ) | |
733 | 1597 pSprites_LOD->pSpriteHeaders[v11].DrawSprite_sw(&vsr, 1); |
0 | 1598 } |
1599 } | |
1600 } | |
1601 | |
1602 //----- (004A902A) -------------------------------------------------------- | |
1603 void stru6::DrawPlayerBuffAnims() | |
1604 { | |
491 | 1605 for (uint i = 0; i < 4; ++i) |
1606 { | |
1980 | 1607 PlayerBuffAnim* buff = &pPlayerBuffs[i]; |
491 | 1608 if (!buff->bRender) |
1609 continue; | |
0 | 1610 |
491 | 1611 buff->uSpellAnimTimeElapsed += pEventTimer->uTimeElapsed; |
1612 if (buff->uSpellAnimTimeElapsed >= buff->uSpellAnimTime) | |
0 | 1613 { |
491 | 1614 buff->bRender = false; |
1615 continue; | |
0 | 1616 } |
491 | 1617 |
1980 | 1618 IconFrame* icon = pIconsFrameTable->GetFrame(buff->uSpellIconID, buff->uSpellAnimTimeElapsed); |
491 | 1619 pRenderer->DrawTextureTransparent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[i], 385, pIcons_LOD->GetTexture(icon->uTextureID)); |
1620 | |
1621 pOtherOverlayList->bRedraw = true; | |
0 | 1622 } |
1623 } | |
1624 | |
1625 //----- (004A90A0) -------------------------------------------------------- | |
1626 void stru6::LoadAnimations() | |
1627 { | |
1628 uTextureID_effpar1 = pBitmaps_LOD->LoadTexture("effpar01", TEXTURE_DEFAULT); | |
1629 uTextureID_effpar2 = pBitmaps_LOD->LoadTexture("effpar02", TEXTURE_DEFAULT); | |
1630 uTextureID_effpar3 = pBitmaps_LOD->LoadTexture("effpar03", TEXTURE_DEFAULT); | |
1631 uSpriteID_sp57c = pSprites_LOD->LoadSprite("sp57c", 6); | |
1390 | 1632 |
1633 pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("zapp")); | |
1634 pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spheal1")); | |
1635 pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spheal2")); | |
1636 pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spheal3")); | |
1637 pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spboost1")); | |
1638 pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spboost2")); | |
1639 pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spboost3")); | |
1640 pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell03")); | |
1641 pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell05")); | |
1642 pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell14")); | |
1643 pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell17")); | |
1644 pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell21")); | |
1645 pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell25")); | |
1646 pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell27")); | |
1647 pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell36")); | |
1648 pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell38")); | |
1649 pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell46")); | |
1650 pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell51")); | |
1651 pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell55")); | |
1652 pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell58")); | |
1653 pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell69")); | |
1654 pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell71")); | |
1655 pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell73")); | |
1656 pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell75")); | |
1657 pIconsFrameTable->InitializeAnimation(pIconsFrameTable->FindIcon("spell96")); | |
0 | 1658 |
1390 | 1659 pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell01")); |
1660 pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell02")); | |
1661 pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell03")); | |
1662 pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell09")); | |
1663 pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell11")); | |
1664 pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell18")); | |
1665 pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell22")); | |
1666 pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell26")); | |
1667 pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell29")); | |
1668 pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell39")); | |
1669 pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell39c")); | |
1670 pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell41")); | |
1671 pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell57c")); | |
1672 pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell62")); | |
1673 pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell65")); | |
1674 pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell66")); | |
1675 pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell70")); | |
1676 pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell76")); | |
1677 pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell84")); | |
1678 pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell90")); | |
1679 pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell92")); | |
1680 pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell93")); | |
1681 pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell97")); | |
1682 pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell97c")); | |
1683 pSpriteFrameTable->InitializeSprite(pSpriteFrameTable->FastFindSprite("spell97c")); | |
0 | 1684 } |