Implement LoadGPSM

Remove corrupted SELC duplicate (PMLC)
This commit is contained in:
Phillip Stephens 2016-02-14 18:31:46 -08:00
parent 33f50789e4
commit b2cbb4e298
5 changed files with 34 additions and 20 deletions

View File

@ -89,10 +89,10 @@ CElementGen::CElementGen(const TToken<CGenDescription>& gen,
x248_finishPartChildren.reserve(ndsyVal + x248_finishPartChildren.size());
for (int i=0 ; i<ndsyVal ; ++i)
{
CGenDescription* chDesc = desc->xa4_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<ncsyVal ; ++i)
{
CElementGen* chGen = ConstructChildParticleSystem(icts.m_gen);
CElementGen* chGen = ConstructChildParticleSystem(icts.m_token);
x234_activePartChildren.emplace_back(chGen);
}
}
@ -650,10 +650,10 @@ void CElementGen::UpdateChildParticleSystems(double dt)
x68_particleEmission == 1 && x50_curFrame >= 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});

View File

@ -75,7 +75,6 @@ public:
SElectricGeneratorDesc xec_SELC;
std::unique_ptr<CIntElement> xf8_SESD;
std::unique_ptr<CVectorElement> xfc_SEPO;
SChildGeneratorDesc xec_PMLC;
std::unique_ptr<CIntElement> x100_LTYP;
std::unique_ptr<CColorElement> x104_LCLR;
std::unique_ptr<CRealElement> x108_LINT;

View File

@ -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);

View File

@ -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<IObj> FParticleFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& vparms)

View File

@ -24,26 +24,30 @@ class CIntElement;
struct SParticleModel
{
TLockedToken<CModel> m_model;
TLockedToken<CModel> m_token;
bool m_found = false;
CModel* m_model = nullptr;
};
struct SChildGeneratorDesc
{
TLockedToken<CGenDescription> m_gen;
TLockedToken<CGenDescription> m_token;
bool m_found = false;
CGenDescription* m_gen = nullptr;
};
struct SSwooshGeneratorDesc
{
TLockedToken<CSwooshDescription> m_swoosh;
TLockedToken<CSwooshDescription> m_token;
bool m_found = false;
CSwooshDescription* m_swoosh = nullptr;
};
struct SElectricGeneratorDesc
{
TLockedToken<CElectricDescription> m_electric;
TLockedToken<CElectricDescription> 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<TResId>& tracker,
TResId resId, CSimplePool* resPool);
static bool CreateGPSM(CGenDescription* fillDesc, CInputStream& in,
std::vector<TResId>& tracker, CSimplePool* resPool);
static void LoadGPSMTokens(CGenDescription* desc);
public:
static CGenDescription* GetGeneratorDesc(CInputStream& in, CSimplePool* resPool);
};
std::unique_ptr<IObj> FParticleFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& vparms);