This commit is contained in:
Jack Andersen 2016-02-14 18:00:51 -10:00
commit 0260ebcd64
9 changed files with 85 additions and 45 deletions

View File

@ -150,9 +150,9 @@ bool CCEPulse::GetValue(int frame, Zeus::CColor& valOut) const
return false; return false;
} }
bool CCEParticleColor::GetValue(int frame, Zeus::CColor& colorOut) const bool CCEParticleColor::GetValue(int /*frame*/, Zeus::CColor& colorOut) const
{ {
/* TODO: Do */ colorOut = CParticleGlobals::g_particleMetrics->x34_pcol;
return false; return false;
} }

View File

@ -295,10 +295,10 @@ CElementGen::CElementGen(const TToken<CGenDescription>& gen,
x248_finishPartChildren.reserve(ndsyVal + x248_finishPartChildren.size()); x248_finishPartChildren.reserve(ndsyVal + x248_finishPartChildren.size());
for (int i=0 ; i<ndsyVal ; ++i) 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) if (x226_enableOPTS && chDesc->x45_31_OPTS)
break; 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, EModelOrientationType::Normal,
x226_enableOPTS ? EOptionalSystemFlags::Two : EOptionalSystemFlags::One)); x226_enableOPTS ? EOptionalSystemFlags::Two : EOptionalSystemFlags::One));
} }
@ -853,13 +853,13 @@ void CElementGen::UpdateChildParticleSystems(double dt)
if (ncsy) if (ncsy)
ncsy->GetValue(x50_curFrame, ncsyVal); ncsy->GetValue(x50_curFrame, ncsyVal);
CGenDescription* ictsDesc = icts.m_gen.GetObj(); CGenDescription* ictsDesc = icts.m_token.GetObj();
if (!(x226_enableOPTS && ictsDesc->x45_31_OPTS)) if (!(x226_enableOPTS && ictsDesc->x45_31_OPTS))
{ {
x234_activePartChildren.reserve(ncsyVal + x234_activePartChildren.size()); x234_activePartChildren.reserve(ncsyVal + x234_activePartChildren.size());
for (int i=0 ; i<ncsyVal ; ++i) for (int i=0 ; i<ncsyVal ; ++i)
{ {
CElementGen* chGen = ConstructChildParticleSystem(icts.m_gen); CElementGen* chGen = ConstructChildParticleSystem(icts.m_token);
x234_activePartChildren.emplace_back(chGen); x234_activePartChildren.emplace_back(chGen);
} }
} }
@ -870,10 +870,10 @@ void CElementGen::UpdateChildParticleSystems(double dt)
x68_particleEmission == 1 && x50_curFrame >= x258_SISY && x68_particleEmission == 1 && x50_curFrame >= x258_SISY &&
((x50_curFrame - x258_SISY) % x25c_PISY) == 0) ((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)) if (!(x226_enableOPTS && iitsDesc->x45_31_OPTS))
{ {
CElementGen* chGen = ConstructChildParticleSystem(iits.m_gen); CElementGen* chGen = ConstructChildParticleSystem(iits.m_token);
x234_activePartChildren.emplace_back(chGen); x234_activePartChildren.emplace_back(chGen);
} }
} }
@ -898,7 +898,7 @@ void CElementGen::UpdateChildParticleSystems(double dt)
SSwooshGeneratorDesc& sswh = desc->xd4_SSWH; SSwooshGeneratorDesc& sswh = desc->xd4_SSWH;
if (sswh.m_found && x64_prevFrame != x50_curFrame && x50_curFrame == x270_SSSD) 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->SetGlobalTranslation(x88_globalTranslation);
sswhGen->SetGlobalScale(xa0_globalScale); sswhGen->SetGlobalScale(xa0_globalScale);
sswhGen->SetTranslation(x7c_translation); sswhGen->SetTranslation(x7c_translation);
@ -910,7 +910,7 @@ void CElementGen::UpdateChildParticleSystems(double dt)
SElectricGeneratorDesc& selc = desc->xec_SELC; SElectricGeneratorDesc& selc = desc->xec_SELC;
if (selc.m_found && x64_prevFrame != x50_curFrame && x50_curFrame == x290_SESD) 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->SetGlobalTranslation(x88_globalTranslation);
selcGen->SetGlobalScale(xa0_globalScale); selcGen->SetGlobalScale(xa0_globalScale);
selcGen->SetTranslation(x7c_translation); selcGen->SetTranslation(x7c_translation);
@ -1336,7 +1336,7 @@ void CElementGen::RenderModels()
} }
else else
{ {
CModel* model = desc->x5c_PMDL.m_model.GetObj(); CModel* model = desc->x5c_PMDL.m_token.GetObj();
if (desc->x44_31_PMAB) if (desc->x44_31_PMAB)
{ {
model->Draw({3, 0, 1, col}); model->Draw({3, 0, 1, col});

View File

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

View File

@ -129,7 +129,7 @@ bool CMVEBounce::GetValue(int frame, Zeus::CVector3f& pVel, Zeus::CVector3f& pPo
float dot = x18_g.dot(pPos); float dot = x18_g.dot(pPos);
if ((dot - x24_j) <= 0.0f) if ((dot - x24_j) <= 0.0f)
{ {
if (!x15_f) if (x15_f)
return true; return true;
} }
else else
@ -139,11 +139,22 @@ bool CMVEBounce::GetValue(int frame, Zeus::CVector3f& pVel, Zeus::CVector3f& pPo
return false; return false;
Zeus::CVector3f delta = pPos - pVel; Zeus::CVector3f delta = pPos - pVel;
pPos += Zeus::CVector3f{(-((((delta.z * ((delta.x * (delta.y * x18_g.y))
+ ((pVel.x * (x18_g.y * pVel.y)) + x18_g.x))) + x18_g.z) - x24_j)) /
((pVel.z * ((pVel.x * (x18_g.y * pVel.y)) + x18_g.x)) + x18_g.z)) - (
(x18_g.z * ((x18_g.x * (x18_g.y * pVel.y)) + pVel.x)) + pVel.z)} * pVel;
float d = 0.0f;
x10_d->GetValue(frame, d);
pVel -= d * pVel;
float c = 0.0f;
xc_c->GetValue(frame, c);
pVel -= Zeus::CVector3f{(1.0f + c) * ((x18_g.z * (x18_g.x * (x18_g.y * pVel.y)) + pVel.x) + pVel.x)} * x18_g;
return false; 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); x4_x->GetValue(frame, pVel.x);
x8_y->GetValue(frame, pVel.y); x8_y->GetValue(frame, pVel.y);

View File

@ -1008,9 +1008,6 @@ bool CParticleDataFactory::CreateGPSM(CGenDescription* fillDesc, CInputStream& i
case SBIG('PSWT'): case SBIG('PSWT'):
fillDesc->x10_PSWT.reset(GetIntElement(in)); fillDesc->x10_PSWT.reset(GetIntElement(in));
break; break;
case SBIG('PMLC'):
fillDesc->xec_PMLC = GetChildGeneratorDesc(in, resPool, tracker);
break;
case SBIG('SEED'): case SBIG('SEED'):
fillDesc->x1c_SEED.reset(GetIntElement(in)); fillDesc->x1c_SEED.reset(GetIntElement(in));
break; break;
@ -1118,6 +1115,20 @@ bool CParticleDataFactory::CreateGPSM(CGenDescription* fillDesc, CInputStream& i
void CParticleDataFactory::LoadGPSMTokens(CGenDescription* desc) 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) std::unique_ptr<IObj> FParticleFactory(const SObjectTag& tag, CInputStream& in, const CVParamTransfer& vparms)

View File

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

View File

@ -15,5 +15,5 @@ float CParticleGlobals::g_ParticleLifetimePercentageRemainder = 0.0;
float* CParticleGlobals::g_papValues = nullptr; float* CParticleGlobals::g_papValues = nullptr;
CParticleGlobals::SParticleMetrics* CParticleGlobals::g_particleMetrics = nullptr; CParticleGlobals::SParticleMetrics* CParticleGlobals::g_particleMetrics = nullptr;
CParticleGlobals::SParticleSystem* CParticleGlobals::g_currentParticleSystem = nullptr;
} }

View File

@ -2,10 +2,12 @@
#define __PSHAG_CPARTICLEGLOBALS_HPP__ #define __PSHAG_CPARTICLEGLOBALS_HPP__
#include "CVector3f.hpp" #include "CVector3f.hpp"
#include "CColor.hpp"
#include "RetroTypes.hpp"
namespace pshag namespace pshag
{ {
class CParticleGen;
class CParticleGlobals class CParticleGlobals
{ {
public: public:
@ -45,8 +47,17 @@ public:
Zeus::CVector3f x1c_pvel; Zeus::CVector3f x1c_pvel;
float x2c_psll; float x2c_psll;
float x30_prlw; float x30_prlw;
Zeus::CColor x34_pcol;
}; };
struct SParticleSystem
{
FourCC x0_type;
CParticleGen* x4_system;
};
static SParticleMetrics* g_particleMetrics; static SParticleMetrics* g_particleMetrics;
static SParticleSystem* g_currentParticleSystem;
}; };
} }

View File

@ -1,6 +1,7 @@
#include "CVectorElement.hpp" #include "CVectorElement.hpp"
#include "CParticleGlobals.hpp" #include "CParticleGlobals.hpp"
#include "CRandom16.hpp" #include "CRandom16.hpp"
#include "CParticleGen.hpp"
#include <math.h> #include <math.h>
namespace pshag namespace pshag
@ -261,51 +262,54 @@ bool CVEPulse::GetValue(int frame, Zeus::CVector3f& valOut) const
return false; return false;
} }
bool CVEParticleVelocity::GetValue(int frame, Zeus::CVector3f& valOut) const bool CVEParticleVelocity::GetValue(int /*frame*/, Zeus::CVector3f& valOut) const
{ {
/* TODO: Do */ valOut = CParticleGlobals::g_particleMetrics->x1c_pvel;
return false; return false;
} }
bool CVESPOS::GetValue(int frame, Zeus::CVector3f& valOut) const bool CVEPLCO::GetValue(int /*frame*/, Zeus::CVector3f& valOut) const
{ {
/* TODO: Do */ valOut = CParticleGlobals::g_particleMetrics->x10_plco;
return false; return false;
} }
bool CVEPLCO::GetValue(int frame, Zeus::CVector3f& valOut) const bool CVEPLOC::GetValue(int /*frame*/, Zeus::CVector3f& valOut) const
{ {
/* TODO: Do */ valOut = CParticleGlobals::g_particleMetrics->x0_ploc;
return false; return false;
} }
bool CVEPLOC::GetValue(int frame, Zeus::CVector3f& valOut) const bool CVEPSOF::GetValue(int /*frame*/, Zeus::CVector3f& valOut) const
{ {
/* TODO: Do */ Zeus::CTransform trans= CParticleGlobals::g_currentParticleSystem->x4_system->GetOrientation();
valOut.x = trans.m_basis[0][0];
valOut.y = trans.m_basis[1][1];
valOut.z = trans.m_basis[2][2];
return false; return false;
} }
bool CVEPSOF::GetValue(int frame, Zeus::CVector3f& valOut) const bool CVEPSOU::GetValue(int /*frame*/, Zeus::CVector3f& valOut) const
{ {
/* TODO: Do */ Zeus::CTransform trans= CParticleGlobals::g_currentParticleSystem->x4_system->GetOrientation();
valOut.x = trans.m_basis[0][0];
valOut.y = trans.m_basis[1][1];
valOut.z = trans.m_basis[2][2];
return false; return false;
} }
bool CVEPSOU::GetValue(int frame, Zeus::CVector3f& valOut) const bool CVEPSOR::GetValue(int /*frame*/, Zeus::CVector3f& valOut) const
{ {
/* TODO: Do */ Zeus::CTransform trans= CParticleGlobals::g_currentParticleSystem->x4_system->GetOrientation();
valOut.x = trans.m_basis[0][0];
valOut.y = trans.m_basis[1][1];
valOut.z = trans.m_basis[2][2];
return false; return false;
} }
bool CVEPSOR::GetValue(int frame, Zeus::CVector3f& valOut) const bool CVEPSTR::GetValue(int /*frame*/, Zeus::CVector3f& valOut) const
{ {
/* TODO: Do */ valOut = CParticleGlobals::g_currentParticleSystem->x4_system->GetTranslation();
return false;
}
bool CVEPSTR::GetValue(int frame, Zeus::CVector3f& valOut) const
{
/* TODO: Do */
return false; return false;
} }