This commit is contained in:
Phillip Stephens 2016-02-11 11:18:47 -08:00
commit 5b0dfde1d8
4 changed files with 117 additions and 0 deletions

View File

@ -600,8 +600,52 @@ void CElementGen::UpdatePSTranslationAndOrientation()
sspo->GetValue(x50_curFrame, x294_SEPO); sspo->GetValue(x50_curFrame, x294_SEPO);
} }
CElementGen* CElementGen::ConstructChildParticleSystem(const TToken<CGenDescription>& desc)
{
}
void CElementGen::UpdateChildParticleSystems(double dt) void CElementGen::UpdateChildParticleSystems(double dt)
{ {
CGlobalRandom gr(x230_randState);
SChildGeneratorDesc& icts = x1c_genDesc.GetObj()->x8c_ICTS;
if (icts.m_found && x64 != x50_curFrame && x244_CSSD == x50_curFrame)
{
int ncsyVal = 1;
CIntElement* ncsy = x1c_genDesc.GetObj()->x9c_NCSY.get();
if (ncsy)
ncsy->GetValue(x50_curFrame, ncsyVal);
CGenDescription* ictsDesc = icts.m_gen.GetObj();
if (!(x226 && ictsDesc->x45_31_OPTS))
{
x234_children.reserve(ncsyVal + x234_children.size());
for (int i=0 ; i<ncsyVal ; ++i)
{
CElementGen* chGen = ConstructChildParticleSystem(icts.m_gen);
x234_children.emplace_back(chGen);
}
}
}
SChildGeneratorDesc& iits = x1c_genDesc.GetObj()->xb8_IITS;
if (iits.m_found && x64 != x50_curFrame && x50_curFrame < x214_PSLT &&
x68_particleEmission == 1 && x50_curFrame >= x258_SISY &&
((x50_curFrame - x258_SISY) % x25c_PISY) == 0)
{
CGenDescription* iitsDesc = iits.m_gen.GetObj();
if (!(x226 && iitsDesc->x45_31_OPTS))
{
CElementGen* chGen = ConstructChildParticleSystem(iits.m_gen);
x234_children.emplace_back(chGen);
}
}
CSpawnSystemKeyframeData* kssm = x1c_genDesc.GetObj()->xd0_KSSM.get();
if (kssm && x64 != x50_curFrame && x50_curFrame < x214_PSLT)
{
}
} }
void CElementGen::UpdateLightParameters() void CElementGen::UpdateLightParameters()

View File

@ -184,6 +184,7 @@ public:
void CreateNewParticles(int); void CreateNewParticles(int);
void UpdatePSTranslationAndOrientation(); void UpdatePSTranslationAndOrientation();
void UpdateChildParticleSystems(double); void UpdateChildParticleSystems(double);
CElementGen* ConstructChildParticleSystem(const TToken<CGenDescription>&);
void UpdateLightParameters(); void UpdateLightParameters();
void BuildParticleSystemBounds(); void BuildParticleSystemBounds();
u32 GetSystemCount(); u32 GetSystemCount();

View File

@ -0,0 +1,50 @@
#include "CSpawnSystemKeyframeData.hpp"
#include "CSimplePool.hpp"
namespace Retro
{
CSpawnSystemKeyframeData::CSpawnSystemKeyframeData(CInputStream& in)
{
x0 = in.readUint32Big();
x4 = in.readUint32Big();
x8 = in.readUint32Big();
xc = in.readUint32Big();
u32 count = in.readUint32Big();
x10_spawns.reserve(count);
for (u32 i=0 ; i<count ; ++i)
{
u32 v1 = in.readUint32Big();
x10_spawns.emplace_back(v1, std::vector<CSpawnSystemKeyframeInfo>());
std::vector<CSpawnSystemKeyframeInfo>& v2 = x10_spawns.back().second;
u32 v2c = in.readUint32Big();
v2.reserve(v2c);
for (u32 j=0 ; j<v2c ; ++j)
v2.emplace_back(in);
}
}
CSpawnSystemKeyframeData::CSpawnSystemKeyframeInfo::CSpawnSystemKeyframeInfo(CInputStream& in)
{
x0_id = in.readUint32Big();
x4 = in.readUint32Big();
x8 = in.readUint32Big();
xc = in.readUint32Big();
}
void CSpawnSystemKeyframeData::LoadAllSpawnedSystemTokens(CSimplePool* pool)
{
for (auto& spawn : x10_spawns)
for (CSpawnSystemKeyframeInfo& elem : spawn.second)
elem.LoadToken(pool);
}
void CSpawnSystemKeyframeData::CSpawnSystemKeyframeInfo::LoadToken(CSimplePool* pool)
{
x10_token = std::move(pool->GetObj({FOURCC('PART'), x0_id}));
x10_token.Lock();
x18_found = true;
}
}

View File

@ -2,13 +2,35 @@
#define __RETRO_CSPAWNSYSTEMKEYFRAMEDATA_HPP__ #define __RETRO_CSPAWNSYSTEMKEYFRAMEDATA_HPP__
#include "IOStreams.hpp" #include "IOStreams.hpp"
#include "CToken.hpp"
namespace Retro namespace Retro
{ {
class CSimplePool; class CSimplePool;
class CGenDescription;
class CSpawnSystemKeyframeData class CSpawnSystemKeyframeData
{ {
public:
class CSpawnSystemKeyframeInfo
{
friend class CSpawnSystemKeyframeData;
u32 x0_id;
u32 x4;
u32 x8;
u32 xc;
TToken<CGenDescription> x10_token;
bool x18_found = false;
void LoadToken(CSimplePool* pool);
public:
CSpawnSystemKeyframeInfo(CInputStream& in);
};
private:
u32 x0;
u32 x4;
u32 x8;
u32 xc;
std::vector<std::pair<u32, std::vector<CSpawnSystemKeyframeInfo>>> x10_spawns;
public: public:
CSpawnSystemKeyframeData(CInputStream& in); CSpawnSystemKeyframeData(CInputStream& in);
void LoadAllSpawnedSystemTokens(CSimplePool* pool); void LoadAllSpawnedSystemTokens(CSimplePool* pool);