Skip to content

Commit 2e4d97c

Browse files
authored
Properly initialize max_life when no lifetime is available (#7131)
1 parent 88c3cea commit 2e4d97c

1 file changed

Lines changed: 10 additions & 12 deletions

File tree

code/particle/ParticleEffect.cpp

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -340,18 +340,16 @@ auto ParticleEffect::processSourceInternal(float interp, const ParticleSource& s
340340
Assertion(bm_is_valid(info.bitmap), "Invalid bitmap handle passed to particle create.");
341341
bm_get_info(info.bitmap, nullptr, nullptr, nullptr, &info.nframes, &fps);
342342

343-
if (m_hasLifetime) {
344-
if (m_keep_anim_length_if_available && info.nframes > 1) {
345-
// Recalculate max life for ani's
346-
info.max_life = i2fl(info.nframes) / i2fl(fps);
347-
}
348-
else {
349-
if (m_parentLifetime)
350-
// if we were spawned by a particle, parentLifetime is the parent's remaining lifetime and m_lifetime is a factor of that
351-
info.max_life = parentLifetime * m_lifetime.next() * lifetimeMultiplier;
352-
else
353-
info.max_life = m_lifetime.next() * lifetimeMultiplier;
354-
}
343+
if (!m_hasLifetime || (m_keep_anim_length_if_available && info.nframes > 1)) {
344+
// Recalculate max life for ani's
345+
info.max_life = i2fl(info.nframes) / i2fl(fps);
346+
}
347+
else {
348+
if (m_parentLifetime)
349+
// if we were spawned by a particle, parentLifetime is the parent's remaining lifetime and m_lifetime is a factor of that
350+
info.max_life = parentLifetime * m_lifetime.next() * lifetimeMultiplier;
351+
else
352+
info.max_life = m_lifetime.next() * lifetimeMultiplier;
355353
}
356354

357355
info.age = interp * f2fl(Frametime);

0 commit comments

Comments
 (0)