MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / UpdateSparks

Function UpdateSparks

TombEngine/Game/effects/effects.cpp:283–593  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

281}
282
283void UpdateSparks()
284{
285 GetLaraDeadlyBounds();
286
287 for (int i = 0; i < MAX_PARTICLES; i++)
288 {
289 auto& spark = Particles[i];
290
291 if (spark.on)
292 {
293 spark.StoreInterpolationData();
294
295 spark.life--;
296
297 if (!spark.life)
298 {
299 if (spark.dynamic != -1)
300 ParticleDynamics[spark.dynamic].On = false;
301
302 spark.on = false;
303 continue;
304 }
305
306 if (HandleWaterfallParticle(spark))
307 continue;
308
309 int life = spark.sLife - spark.life;
310 if (life < spark.colFadeSpeed)
311 {
312 int dl = (life << 16) / spark.colFadeSpeed;
313 spark.r = spark.sR + (dl * (spark.dR - spark.sR) >> 16);
314 spark.g = spark.sG + (dl * (spark.dG - spark.sG) >> 16);
315 spark.b = spark.sB + (dl * (spark.dB - spark.sB) >> 16);
316 }
317 else if (spark.life >= spark.fadeToBlack)
318 {
319 spark.r = spark.dR;
320 spark.g = spark.dG;
321 spark.b = spark.dB;
322 }
323 else
324 {
325 spark.r = (spark.dR * (((spark.life - spark.fadeToBlack) << 16) / spark.fadeToBlack + 0x10000)) >> 16;
326 spark.g = (spark.dG * (((spark.life - spark.fadeToBlack) << 16) / spark.fadeToBlack + 0x10000)) >> 16;
327 spark.b = (spark.dB * (((spark.life - spark.fadeToBlack) << 16) / spark.fadeToBlack + 0x10000)) >> 16;
328
329 if (spark.r < 8 && spark.g < 8 && spark.b < 8)
330 {
331 spark.on = 0;
332 continue;
333 }
334 }
335
336 if (spark.life == spark.colFadeSpeed)
337 {
338 if (spark.flags & SP_UNDERWEXP)
339 spark.dSize /= 4;
340 }

Callers 1

GamePhaseFunction · 0.85

Calls 15

GetLaraDeadlyBoundsFunction · 0.85
HandleWaterfallParticleFunction · 0.85
TriggerExplosionSparksFunction · 0.85
TriggerExplosionBubbleFunction · 0.85
SetSpriteSequenceFunction · 0.85
SoundEffectFunction · 0.85
GetRandomControlFunction · 0.85
SpawnDynamicPointLightFunction · 0.85
GetHashFunction · 0.85
ItemCustomBurnFunction · 0.85
ItemBurnFunction · 0.85

Tested by

no test coverage detected