diff --git a/Runtime/Particle/CColorElement.cpp b/Runtime/Particle/CColorElement.cpp index 05489c698..0a8c7722d 100644 --- a/Runtime/Particle/CColorElement.cpp +++ b/Runtime/Particle/CColorElement.cpp @@ -123,17 +123,16 @@ bool CCEPulse::GetValue(int frame, zeus::CColor& valOut) const { int a, b; x4_aDuration->GetValue(frame, a); x8_bDuration->GetValue(frame, b); - int cv = zeus::max(1, a + b + 1); + int cv = a + b + 1; + if (cv < 0) { + cv = 1; + } - if (b >= 1) { - int cv2 = frame % cv; - if (cv2 >= a) - x10_bVal->GetValue(frame, valOut); - else - xc_aVal->GetValue(frame, valOut); - } else + if (b < 1 || frame % cv <= a) { xc_aVal->GetValue(frame, valOut); - + } else { + x10_bVal->GetValue(frame, valOut); + } return false; } diff --git a/Runtime/Particle/CIntElement.cpp b/Runtime/Particle/CIntElement.cpp index 591bf4d93..44b69b65d 100644 --- a/Runtime/Particle/CIntElement.cpp +++ b/Runtime/Particle/CIntElement.cpp @@ -158,17 +158,16 @@ bool CIEPulse::GetValue(int frame, int& valOut) const { int a, b; x4_aDuration->GetValue(frame, a); x8_bDuration->GetValue(frame, b); - int cv = std::max(1, a + b + 1); + int cv = a + b + 1; + if (cv < 0) { + cv = 1; + } - if (b >= 1) { - int cv2 = frame % cv; - if (cv2 >= a) - x10_bVal->GetValue(frame, valOut); - else - xc_aVal->GetValue(frame, valOut); - } else + if (b < 1 || frame % cv <= a) { xc_aVal->GetValue(frame, valOut); - + } else { + x10_bVal->GetValue(frame, valOut); + } return false; } diff --git a/Runtime/Particle/CModVectorElement.cpp b/Runtime/Particle/CModVectorElement.cpp index 95cf05124..6b5ec2d29 100644 --- a/Runtime/Particle/CModVectorElement.cpp +++ b/Runtime/Particle/CModVectorElement.cpp @@ -202,17 +202,16 @@ bool CMVEPulse::GetValue(int frame, zeus::CVector3f& pVel, zeus::CVector3f& pPos int a, b; x4_aDuration->GetValue(frame, a); x8_bDuration->GetValue(frame, b); - int cv = std::max(1, a + b + 1); + int cv = a + b + 1; + if (cv < 0) { + cv = 1; + } - if (b >= 1) { - int cv2 = frame % cv; - if (cv2 >= a) - x10_bVal->GetValue(frame, pVel, pPos); - else - xc_aVal->GetValue(frame, pVel, pPos); - } else + if (b < 1 || frame % cv <= a) { xc_aVal->GetValue(frame, pVel, pPos); - + } else { + x10_bVal->GetValue(frame, pVel, pPos); + } return false; } diff --git a/Runtime/Particle/CRealElement.cpp b/Runtime/Particle/CRealElement.cpp index 313aace09..707a372f4 100644 --- a/Runtime/Particle/CRealElement.cpp +++ b/Runtime/Particle/CRealElement.cpp @@ -137,17 +137,18 @@ bool CREPulse::GetValue(int frame, float& valOut) const { int a, b; x4_aDuration->GetValue(frame, a); x8_bDuration->GetValue(frame, b); - int cv = std::max(1, a + b + 1); + int cv = a + b + 1; + if (cv < 0) { + cv = 1; + } - if (b >= 1) { - int cv2 = frame % cv; - if (cv2 >= a) - x10_valB->GetValue(frame, valOut); - else - xc_valA->GetValue(frame, valOut); - } else + // CREPulse is an outlier here, the other + // IElement classes use <= instead of <. + if (b < 1 || frame % cv < a) { xc_valA->GetValue(frame, valOut); - + } else { + x10_valB->GetValue(frame, valOut); + } return false; } diff --git a/Runtime/Particle/CVectorElement.cpp b/Runtime/Particle/CVectorElement.cpp index 27fd0531d..0b395b68b 100644 --- a/Runtime/Particle/CVectorElement.cpp +++ b/Runtime/Particle/CVectorElement.cpp @@ -227,17 +227,16 @@ bool CVEPulse::GetValue(int frame, zeus::CVector3f& valOut) const { int a, b; x4_aDuration->GetValue(frame, a); x8_bDuration->GetValue(frame, b); - int cv = std::max(1, a + b + 1); + int cv = a + b + 1; + if (cv < 0) { + cv = 1; + } - if (b >= 1) { - int cv2 = frame % cv; - if (cv2 >= a) - x10_bVal->GetValue(frame, valOut); - else - xc_aVal->GetValue(frame, valOut); - } else + if (b < 1 || frame % cv <= a) { xc_aVal->GetValue(frame, valOut); - + } else { + x10_bVal->GetValue(frame, valOut); + } return false; }