From cfee7b61bb349da215c3572509e32481d42a5e78 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Wed, 17 Feb 2016 01:08:38 -0800 Subject: [PATCH] Implement CRSC Factory --- Runtime/Particle/CCollisionResponseData.cpp | 40 +++++++++++++++++++++ Runtime/Particle/CCollisionResponseData.hpp | 4 +-- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/Runtime/Particle/CCollisionResponseData.cpp b/Runtime/Particle/CCollisionResponseData.cpp index 2915d57fd..ac55d0427 100644 --- a/Runtime/Particle/CCollisionResponseData.cpp +++ b/Runtime/Particle/CCollisionResponseData.cpp @@ -74,8 +74,39 @@ static const std::vector DecalTypes = using CPF = CParticleDataFactory; +void CCollisionResponseData::AddParticleSystemToResponse(EWeaponCollisionResponseTypes type, CInputStream &in, CSimplePool *resPool) +{ + int i = int(type); + std::vector tracker; + tracker.resize(8); + x0[i].first = std::move(CPF::GetChildGeneratorDesc(in, resPool, tracker).m_token); + if (x0[i].first) + x0[i].second = true; +} + bool CCollisionResponseData::CheckAndAddDecalToResponse(FourCC clsId, CInputStream& in, CSimplePool* resPool) { + int i = 0; + for (const FourCC& type : DecalTypes) + { + if (type == clsId) + { + FourCC cls = CPF::GetClassID(in); + if (cls == SBIG('NONE')) + return true; + + TResId id = CPF::GetInt(in); + if (!id) + return true; + + x20[i].first = std::move(resPool->GetObj({FOURCC('DPSC'), id})); + if (x0[i].first) + x0[i].second = true; + + return true; + } + i++; + } return false; } @@ -101,6 +132,15 @@ bool CCollisionResponseData::CheckAndAddSoundFXToResponse(FourCC clsId, CInputSt bool CCollisionResponseData::CheckAndAddParticleSystemToResponse(FourCC clsId, CInputStream& in, CSimplePool* resPool) { + int i = 0; + for (const FourCC& type : GeneratorTypes) + { + if (type == clsId) + { + AddParticleSystemToResponse(EWeaponCollisionResponseTypes(i), in, resPool); + return true; + } + } return false; } diff --git a/Runtime/Particle/CCollisionResponseData.hpp b/Runtime/Particle/CCollisionResponseData.hpp index e2042d59c..c3c035bc4 100644 --- a/Runtime/Particle/CCollisionResponseData.hpp +++ b/Runtime/Particle/CCollisionResponseData.hpp @@ -38,9 +38,9 @@ enum class EWeaponCollisionResponseTypes class CCollisionResponseData { - std::vector> x0; + std::vector, bool>> x0; std::vector x10; - std::vector> x20; + std::vector, bool>> x20; float x30_RNGE; float x34_FOFF;