Closer CVEKeyframeEmitter

This commit is contained in:
2025-11-25 12:30:32 -08:00
parent 845c55c80c
commit caaa30f41a
2 changed files with 16 additions and 16 deletions

View File

@@ -251,7 +251,7 @@ bool CREKeyframeEmitter::GetValue(int frame, float& valOut) const {
if (xc_loop) {
if (emitterTime >= x10_loopEnd) {
emitterTime -= x14_loopStart;
emitterTime = emitterTime % (x10_loopEnd - x14_loopStart);
emitterTime %= x10_loopEnd - x14_loopStart;
emitterTime += x14_loopStart;
}
valOut = x18_keys[emitterTime];

View File

@@ -286,27 +286,27 @@ CVEKeyframeEmitter::~CVEKeyframeEmitter() {}
bool CVEKeyframeEmitter::GetValue(int frame, CVector3f& valOut) const {
if (!mPercent) {
int emitterTime = CParticleGlobals::GetEmitterTime();
int calcKey = emitterTime;
if (mLoop) {
if (emitterTime >= mLoopEnd) {
calcKey = ((emitterTime - mLoopStart) % (mLoopEnd - mLoopStart)) + mLoopStart;
emitterTime -= mLoopStart;
emitterTime %= mLoopEnd - mLoopStart;
emitterTime += mLoopStart;
}
valOut = mKeys[calcKey];
valOut = mKeys[emitterTime];
} else {
if ((mLoopEnd - 1) < emitterTime) {
calcKey = (mLoopEnd - 1);
emitterTime = rstl::min_val(emitterTime, mLoopEnd - 1);
valOut = mKeys[emitterTime];
}
valOut = mKeys[calcKey];
return false;
}
} else {
if (CParticleGlobals::GetParticleLifetimePercentage() == 100) {
valOut = mKeys[100];
valOut = mKeys[CParticleGlobals::GetParticleLifetimePercentage()];
} else {
CVector3f tmp1 = mKeys[CParticleGlobals::GetParticleLifetimePercentage()];
CVector3f tmp2 = mKeys[CParticleGlobals::GetParticleLifetimePercentage() + 1];
valOut = (1.f - CParticleGlobals::GetParticleLifetimePercentageRemainder()) * tmp1 +
CParticleGlobals::GetParticleLifetimePercentageRemainder() * tmp2;
}
valOut = (1.f - CParticleGlobals::GetParticleLifetimePercentageRemainder()) *
mKeys[CParticleGlobals::GetParticleLifetimePercentage()] +
CParticleGlobals::GetParticleLifetimePercentageRemainder() *
mKeys[CParticleGlobals::GetParticleLifetimePercentage() + 1];
}
return false;