diff --git a/Runtime/Particle/CFlameWarp.cpp b/Runtime/Particle/CFlameWarp.cpp index 9cf18a04e..23ea08edf 100644 --- a/Runtime/Particle/CFlameWarp.cpp +++ b/Runtime/Particle/CFlameWarp.cpp @@ -1,5 +1,7 @@ #include "Runtime/Particle/CFlameWarp.hpp" +#include + #include "Runtime/CStateManager.hpp" namespace urde { @@ -65,14 +67,15 @@ void CFlameWarp::ModifyParticles(std::vector& particles) { std::sort(vec.begin(), vec.end(), [](auto& a, auto& b) { return a.first < b.first; }); - int pitch = particles.size() / 9; - for (int i = 0; i < 9; ++i) { - CParticle& part = particles[vec[i * pitch].second]; + const size_t pitch = particles.size() / 9; + for (size_t i = 0; i < x4_collisionPoints.size(); ++i) { + const CParticle& part = particles[vec[i * pitch].second]; x4_collisionPoints[i] = part.x4_pos; if (i > 0) { - zeus::CVector3f delta = x4_collisionPoints[i] - x4_collisionPoints[i - 1]; - if (delta.magnitude() < 0.0011920929f) + const zeus::CVector3f delta = x4_collisionPoints[i] - x4_collisionPoints[i - 1]; + if (delta.magnitude() < 0.0011920929f) { x4_collisionPoints[i] += delta.normalized() * 0.0011920929f; + } } } @@ -81,6 +84,11 @@ void CFlameWarp::ModifyParticles(std::vector& particles) { xa0_26_processed = true; } +void CFlameWarp::ResetPosition(const zeus::CVector3f& pos) { + std::fill(x4_collisionPoints.begin(), x4_collisionPoints.end(), pos); + xa0_26_processed = false; +} + zeus::CAABox CFlameWarp::CalculateBounds() const { zeus::CAABox ret; for (const auto& v : x4_collisionPoints) diff --git a/Runtime/Particle/CFlameWarp.hpp b/Runtime/Particle/CFlameWarp.hpp index 48faca6fb..74828d6ac 100644 --- a/Runtime/Particle/CFlameWarp.hpp +++ b/Runtime/Particle/CFlameWarp.hpp @@ -47,12 +47,7 @@ public: bool IsActivated() override { return xa0_24_activated; } bool IsProcessed() const { return xa0_26_processed; } FourCC Get4CharID() override { return FOURCC('FWRP'); } - void ResetPosition(const zeus::CVector3f& pos) { - for (auto& vec : x4_collisionPoints) { - vec = pos; - } - xa0_26_processed = false; - } + void ResetPosition(const zeus::CVector3f& pos); zeus::CAABox CalculateBounds() const; }; } // namespace urde