From b2cbb4e298a1457b9736a738591ac4eabb398ab1 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Sun, 14 Feb 2016 18:31:46 -0800 Subject: [PATCH] Implement LoadGPSM Remove corrupted SELC duplicate (PMLC) --- Runtime/Particle/CElementGen.cpp | 18 +++++++++--------- Runtime/Particle/CGenDescription.hpp | 1 - Runtime/Particle/CModVectorElement.cpp | 2 +- Runtime/Particle/CParticleDataFactory.cpp | 17 ++++++++++++++--- Runtime/Particle/CParticleDataFactory.hpp | 16 ++++++++++------ 5 files changed, 34 insertions(+), 20 deletions(-) diff --git a/Runtime/Particle/CElementGen.cpp b/Runtime/Particle/CElementGen.cpp index a0ca598fc..f62807b4b 100644 --- a/Runtime/Particle/CElementGen.cpp +++ b/Runtime/Particle/CElementGen.cpp @@ -89,10 +89,10 @@ CElementGen::CElementGen(const TToken& gen, x248_finishPartChildren.reserve(ndsyVal + x248_finishPartChildren.size()); for (int i=0 ; ixa4_IDTS.m_gen.GetObj(); + CGenDescription* chDesc = desc->xa4_IDTS.m_token.GetObj(); if (x226_enableOPTS && chDesc->x45_31_OPTS) break; - x248_finishPartChildren.emplace_back(new CElementGen(desc->xa4_IDTS.m_gen, + x248_finishPartChildren.emplace_back(new CElementGen(desc->xa4_IDTS.m_token, EModelOrientationType::Normal, x226_enableOPTS ? EOptionalSystemFlags::Two : EOptionalSystemFlags::One)); } @@ -633,13 +633,13 @@ void CElementGen::UpdateChildParticleSystems(double dt) if (ncsy) ncsy->GetValue(x50_curFrame, ncsyVal); - CGenDescription* ictsDesc = icts.m_gen.GetObj(); + CGenDescription* ictsDesc = icts.m_token.GetObj(); if (!(x226_enableOPTS && ictsDesc->x45_31_OPTS)) { x234_activePartChildren.reserve(ncsyVal + x234_activePartChildren.size()); for (int i=0 ; i= x258_SISY && ((x50_curFrame - x258_SISY) % x25c_PISY) == 0) { - CGenDescription* iitsDesc = iits.m_gen.GetObj(); + CGenDescription* iitsDesc = iits.m_token.GetObj(); if (!(x226_enableOPTS && iitsDesc->x45_31_OPTS)) { - CElementGen* chGen = ConstructChildParticleSystem(iits.m_gen); + CElementGen* chGen = ConstructChildParticleSystem(iits.m_token); x234_activePartChildren.emplace_back(chGen); } } @@ -678,7 +678,7 @@ void CElementGen::UpdateChildParticleSystems(double dt) SSwooshGeneratorDesc& sswh = desc->xd4_SSWH; if (sswh.m_found && x64_prevFrame != x50_curFrame && x50_curFrame == x270_SSSD) { - CParticleSwoosh* sswhGen = new CParticleSwoosh(sswh.m_swoosh, 0); + CParticleSwoosh* sswhGen = new CParticleSwoosh(sswh.m_token, 0); sswhGen->SetGlobalTranslation(x88_globalTranslation); sswhGen->SetGlobalScale(xa0_globalScale); sswhGen->SetTranslation(x7c_translation); @@ -690,7 +690,7 @@ void CElementGen::UpdateChildParticleSystems(double dt) SElectricGeneratorDesc& selc = desc->xec_SELC; if (selc.m_found && x64_prevFrame != x50_curFrame && x50_curFrame == x290_SESD) { - CParticleElectric* selcGen = new CParticleElectric(selc.m_electric); + CParticleElectric* selcGen = new CParticleElectric(selc.m_token); selcGen->SetGlobalTranslation(x88_globalTranslation); selcGen->SetGlobalScale(xa0_globalScale); selcGen->SetTranslation(x7c_translation); @@ -1116,7 +1116,7 @@ void CElementGen::RenderModels() } else { - CModel* model = desc->x5c_PMDL.m_model.GetObj(); + CModel* model = desc->x5c_PMDL.m_token.GetObj(); if (desc->x44_31_PMAB) { model->Draw({3, 0, 1, col}); diff --git a/Runtime/Particle/CGenDescription.hpp b/Runtime/Particle/CGenDescription.hpp index dc66f41a8..a9d9eab4c 100644 --- a/Runtime/Particle/CGenDescription.hpp +++ b/Runtime/Particle/CGenDescription.hpp @@ -75,7 +75,6 @@ public: SElectricGeneratorDesc xec_SELC; std::unique_ptr xf8_SESD; std::unique_ptr xfc_SEPO; - SChildGeneratorDesc xec_PMLC; std::unique_ptr x100_LTYP; std::unique_ptr x104_LCLR; std::unique_ptr x108_LINT; diff --git a/Runtime/Particle/CModVectorElement.cpp b/Runtime/Particle/CModVectorElement.cpp index 784802353..453f54f8a 100644 --- a/Runtime/Particle/CModVectorElement.cpp +++ b/Runtime/Particle/CModVectorElement.cpp @@ -154,7 +154,7 @@ bool CMVEBounce::GetValue(int frame, Zeus::CVector3f& pVel, Zeus::CVector3f& pPo return false; } -bool CMVEConstant::GetValue(int frame, Zeus::CVector3f& pVel, Zeus::CVector3f& pPos) const +bool CMVEConstant::GetValue(int frame, Zeus::CVector3f& pVel, Zeus::CVector3f& /*pPos*/) const { x4_x->GetValue(frame, pVel.x); x8_y->GetValue(frame, pVel.y); diff --git a/Runtime/Particle/CParticleDataFactory.cpp b/Runtime/Particle/CParticleDataFactory.cpp index e81df539c..0af29f7b1 100644 --- a/Runtime/Particle/CParticleDataFactory.cpp +++ b/Runtime/Particle/CParticleDataFactory.cpp @@ -1008,9 +1008,6 @@ bool CParticleDataFactory::CreateGPSM(CGenDescription* fillDesc, CInputStream& i case SBIG('PSWT'): fillDesc->x10_PSWT.reset(GetIntElement(in)); break; - case SBIG('PMLC'): - fillDesc->xec_PMLC = GetChildGeneratorDesc(in, resPool, tracker); - break; case SBIG('SEED'): fillDesc->x1c_SEED.reset(GetIntElement(in)); break; @@ -1118,6 +1115,20 @@ bool CParticleDataFactory::CreateGPSM(CGenDescription* fillDesc, CInputStream& i void CParticleDataFactory::LoadGPSMTokens(CGenDescription* desc) { + if (desc->x5c_PMDL.m_found) + desc->x5c_PMDL.m_model = desc->x5c_PMDL.m_token.GetObj(); + + if (desc->x8c_ICTS.m_found) + desc->x8c_ICTS.m_gen = desc->x8c_ICTS.m_token.GetObj(); + + if (desc->xa4_IDTS.m_found) + desc->xa4_IDTS.m_gen = desc->xa4_IDTS.m_token.GetObj(); + + if (desc->xb8_IITS.m_found) + desc->xb8_IITS.m_gen = desc->xb8_IITS.m_token.GetObj(); + + if (desc->xd4_SSWH.m_found) + desc->xd4_SSWH.m_swoosh = desc->xd4_SSWH.m_token.GetObj(); } std::unique_ptr FParticleFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& vparms) diff --git a/Runtime/Particle/CParticleDataFactory.hpp b/Runtime/Particle/CParticleDataFactory.hpp index 429675fd2..7ba589ad4 100644 --- a/Runtime/Particle/CParticleDataFactory.hpp +++ b/Runtime/Particle/CParticleDataFactory.hpp @@ -24,26 +24,30 @@ class CIntElement; struct SParticleModel { - TLockedToken m_model; + TLockedToken m_token; bool m_found = false; + CModel* m_model = nullptr; }; struct SChildGeneratorDesc { - TLockedToken m_gen; + TLockedToken m_token; bool m_found = false; + CGenDescription* m_gen = nullptr; }; struct SSwooshGeneratorDesc { - TLockedToken m_swoosh; + TLockedToken m_token; bool m_found = false; + CSwooshDescription* m_swoosh = nullptr; }; struct SElectricGeneratorDesc { - TLockedToken m_electric; + TLockedToken m_token; bool m_found = false; + CElectricDescription* m_electric = nullptr; }; class CParticleDataFactory @@ -70,13 +74,13 @@ class CParticleDataFactory static int32_t GetInt(CInputStream& in); static bool GetBool(CInputStream& in); static FourCC GetClassID(CInputStream& in); -public: - static CGenDescription* GetGeneratorDesc(CInputStream& in, CSimplePool* resPool); static CGenDescription* CreateGeneratorDescription(CInputStream& in, std::vector& tracker, TResId resId, CSimplePool* resPool); static bool CreateGPSM(CGenDescription* fillDesc, CInputStream& in, std::vector& tracker, CSimplePool* resPool); static void LoadGPSMTokens(CGenDescription* desc); +public: + static CGenDescription* GetGeneratorDesc(CInputStream& in, CSimplePool* resPool); }; std::unique_ptr FParticleFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& vparms);