diff --git a/Runtime/Particle/CIntElement.cpp b/Runtime/Particle/CIntElement.cpp index 654f874e2..591bf4d93 100644 --- a/Runtime/Particle/CIntElement.cpp +++ b/Runtime/Particle/CIntElement.cpp @@ -189,12 +189,12 @@ bool CIESampleAndHold::GetValue(int frame, int& valOut) const { int b, c; xc_waitFramesMin->GetValue(frame, b); x10_waitFramesMax->GetValue(frame, c); - /* const-correctness, who needs it? */ - const_cast(this)->x8_nextSampleFrame = CRandom16::GetRandomNumber()->Range(b, c) + frame; + x8_nextSampleFrame = CRandom16::GetRandomNumber()->Range(b, c) + frame; x4_sampleSource->GetValue(frame, valOut); - const_cast(this)->x14_holdVal = valOut; - } else + x14_holdVal = valOut; + } else { valOut = x14_holdVal; + } return false; } diff --git a/Runtime/Particle/CIntElement.hpp b/Runtime/Particle/CIntElement.hpp index 78602b998..671c506ef 100644 --- a/Runtime/Particle/CIntElement.hpp +++ b/Runtime/Particle/CIntElement.hpp @@ -134,10 +134,10 @@ public: class CIESampleAndHold : public CIntElement { std::unique_ptr x4_sampleSource; - int x8_nextSampleFrame = 0; + mutable int x8_nextSampleFrame = 0; std::unique_ptr xc_waitFramesMin; std::unique_ptr x10_waitFramesMax; - int x14_holdVal; + mutable int x14_holdVal; public: CIESampleAndHold(std::unique_ptr&& a, std::unique_ptr&& b, std::unique_ptr&& c)