All MP1 element decls in

This commit is contained in:
Jack Andersen 2016-02-04 22:34:14 -10:00
parent e060746b14
commit 8b02f897e6
12 changed files with 824 additions and 8 deletions

View File

@ -1,11 +1,51 @@
#ifndef __RETRO_CCOLORELEMENT_HPP__
#define __RETRO_CCOLORELEMENT_HPP__
#include "IElement.hpp"
namespace Retro
{
class CColorElement
class CCEKeyframeEmitter : public CColorElement
{
public:
bool GetValue(int frame, Zeus::CColor& colorOut) const;
};
class CCEConstant : public CColorElement
{
public:
bool GetValue(int frame, Zeus::CColor& colorOut) const;
};
class CCEFastConstant : public CColorElement
{
public:
bool GetValue(int frame, Zeus::CColor& colorOut) const;
};
class CCETimeChain : public CColorElement
{
public:
bool GetValue(int frame, Zeus::CColor& colorOut) const;
};
class CCEFadeEnd : public CColorElement
{
public:
bool GetValue(int frame, Zeus::CColor& colorOut) const;
};
class CCEFade : public CColorElement
{
public:
bool GetValue(int frame, Zeus::CColor& colorOut) const;
};
class CCEPulse : public CColorElement
{
public:
bool GetValue(int frame, Zeus::CColor& colorOut) const;
};
}

View File

@ -1,13 +1,28 @@
#ifndef __RETRO_CEMITTERELEMENT_HPP__
#define __RETRO_CEMITTERELEMENT_HPP__
#include "IElement.hpp"
namespace Retro
{
class CEmitterElement
class CEmitterElement : public IElement
{
};
class CEESimpleEmitter : public CEmitterElement
{
};
class CVESphere : public CEmitterElement
{
};
class CVEAngularSphere : public CEmitterElement
{
};
}
#endif // __RETRO_CEMITTERELEMENT_HPP__

View File

@ -1,11 +1,111 @@
#ifndef __RETRO_CINTELEMENT_HPP__
#define __RETRO_CINTELEMENT_HPP__
#include "IElement.hpp"
namespace Retro
{
class CIntElement
class CIEKeyframeEmitter : public CIntElement
{
public:
bool GetValue(int frame, int& valOut) const;
};
class CIEDeath : public CIntElement
{
public:
bool GetValue(int frame, int& valOut) const;
};
class CIEClamp : public CIntElement
{
public:
bool GetValue(int frame, int& valOut) const;
};
class CIETimeChain : public CIntElement
{
public:
bool GetValue(int frame, int& valOut) const;
};
class CIEAdd : public CIntElement
{
public:
bool GetValue(int frame, int& valOut) const;
};
class CIEConstant : public CIntElement
{
public:
bool GetValue(int frame, int& valOut) const;
};
class CIEImpulse : public CIntElement
{
public:
bool GetValue(int frame, int& valOut) const;
};
class CIELifetimePercent : public CIntElement
{
public:
bool GetValue(int frame, int& valOut) const;
};
class CIEInitialRandom : public CIntElement
{
public:
bool GetValue(int frame, int& valOut) const;
};
class CIEPulse : public CIntElement
{
public:
bool GetValue(int frame, int& valOut) const;
};
class CIEMultiply : public CIntElement
{
public:
bool GetValue(int frame, int& valOut) const;
};
class CIESampleAndHold : public CIntElement
{
public:
bool GetValue(int frame, int& valOut) const;
};
class CIERandom : public CIntElement
{
public:
bool GetValue(int frame, int& valOut) const;
};
class CIETimeScale : public CIntElement
{
public:
bool GetValue(int frame, int& valOut) const;
};
class CIEGTCP : public CIntElement
{
public:
bool GetValue(int frame, int& valOut) const;
};
class CIEModulo : public CIntElement
{
public:
bool GetValue(int frame, int& valOut) const;
};
class CIESubtract : public CIntElement
{
public:
bool GetValue(int frame, int& valOut) const;
};
}

View File

@ -1,4 +1,5 @@
add_library(RuntimeCommonParticle
IElement.hpp
CGenDescription.hpp CGenDescription.cpp
CRealElement.hpp CRealElement.cpp
CIntElement.hpp CIntElement.cpp
@ -19,4 +20,5 @@ add_library(RuntimeCommonParticle
CParticleElectric.hpp CParticleElectric.cpp
CDecalManager.hpp CDecalManager.cpp
CSpawnSystemKeyframeData.hpp CSpawnSystemKeyframeData.cpp
CWarp.hpp CWarp.cpp)
CWarp.hpp CWarp.cpp
CParticleGlobals.hpp CParticleGlobals.cpp)

View File

@ -1,11 +1,87 @@
#ifndef __RETRO_CMODVECTORELEMENT_HPP__
#define __RETRO_CMODVECTORELEMENT_HPP__
#include "IElement.hpp"
namespace Retro
{
class CModVectorElement
class CMVEImplosion : public CModVectorElement
{
public:
bool GetValue(int frame, Zeus::CVector3f& vec1Out, Zeus::CVector3f& vec2Out) const=0;
};
class CMVEExponentialImplosion : public CModVectorElement
{
public:
bool GetValue(int frame, Zeus::CVector3f& vec1Out, Zeus::CVector3f& vec2Out) const=0;
};
class CMVETimeChain : public CModVectorElement
{
public:
bool GetValue(int frame, Zeus::CVector3f& vec1Out, Zeus::CVector3f& vec2Out) const=0;
};
class CMVEBounce : public CModVectorElement
{
public:
bool GetValue(int frame, Zeus::CVector3f& vec1Out, Zeus::CVector3f& vec2Out) const=0;
};
class CMVEConstant : public CModVectorElement
{
public:
bool GetValue(int frame, Zeus::CVector3f& vec1Out, Zeus::CVector3f& vec2Out) const=0;
};
class CMVEFastConstant : public CModVectorElement
{
public:
bool GetValue(int frame, Zeus::CVector3f& vec1Out, Zeus::CVector3f& vec2Out) const=0;
};
class CMVEGravity : public CModVectorElement
{
public:
bool GetValue(int frame, Zeus::CVector3f& vec1Out, Zeus::CVector3f& vec2Out) const=0;
};
class CMVEExplode : public CModVectorElement
{
public:
bool GetValue(int frame, Zeus::CVector3f& vec1Out, Zeus::CVector3f& vec2Out) const=0;
};
class CMVESetPosition : public CModVectorElement
{
public:
bool GetValue(int frame, Zeus::CVector3f& vec1Out, Zeus::CVector3f& vec2Out) const=0;
};
class CMVELinearImplosion : public CModVectorElement
{
public:
bool GetValue(int frame, Zeus::CVector3f& vec1Out, Zeus::CVector3f& vec2Out) const=0;
};
class CMVEPulse : public CModVectorElement
{
public:
bool GetValue(int frame, Zeus::CVector3f& vec1Out, Zeus::CVector3f& vec2Out) const=0;
};
class CMVEWind : public CModVectorElement
{
public:
bool GetValue(int frame, Zeus::CVector3f& vec1Out, Zeus::CVector3f& vec2Out) const=0;
};
class CMVESwirl : public CModVectorElement
{
public:
bool GetValue(int frame, Zeus::CVector3f& vec1Out, Zeus::CVector3f& vec2Out) const=0;
};
}

View File

@ -0,0 +1,16 @@
#include "CParticleGlobals.hpp"
namespace Retro
{
int CParticleGlobals::g_emitterTimeInt = 0;
float CParticleGlobals::g_emitterTimeFloat = 0.0;
int CParticleGlobals::g_particleLifetimeInt = 0;
float CParticleGlobals::g_particleLifetimeFloat = 0.0;
int CParticleGlobals::g_particleLifetimePercentTweenInt = 0;
float CParticleGlobals::g_particleLifetimePercentTweenFloat = 0.0;
float CParticleGlobals::g_particleLifetimePercentTweenIntFloatRem = 0.0;
}

View File

@ -0,0 +1,40 @@
#ifndef __RETRO_CPARTICLEGLOBALS_HPP__
#define __RETRO_CPARTICLEGLOBALS_HPP__
namespace Retro
{
class CParticleGlobals
{
public:
static int g_emitterTimeInt;
static float g_emitterTimeFloat;
static void SetEmitterTime(int frame)
{
g_emitterTimeInt = frame;
g_emitterTimeFloat = frame;
}
static int g_particleLifetimeInt;
static float g_particleLifetimeFloat;
static void SetParticleLifetime(int frame)
{
g_particleLifetimeInt = frame;
g_particleLifetimeFloat = frame;
}
static int g_particleLifetimePercentTweenInt;
static float g_particleLifetimePercentTweenFloat;
static float g_particleLifetimePercentTweenIntFloatRem;
static void UpdateParticleLifetimeTweenValues(int frame)
{
float lt = g_particleLifetimeInt != 0.0f ? g_particleLifetimeInt : 1.0f;
g_particleLifetimePercentTweenFloat = 100.0f * frame / lt;
g_particleLifetimePercentTweenInt = g_particleLifetimePercentTweenFloat;
g_particleLifetimePercentTweenIntFloatRem = g_particleLifetimePercentTweenFloat - g_particleLifetimePercentTweenInt;
}
};
}
#endif // __RETRO_CPARTICLEGLOBALS_HPP__

View File

@ -0,0 +1,109 @@
#include "CRealElement.hpp"
#include "CParticleGlobals.hpp"
namespace Retro
{
CREKeyframeEmitter::CREKeyframeEmitter(CInputStream& in)
{
x4_percent = in.readUint32Big();
x8_a = in.readUint32Big();
xc_b = in.readBool();
xd_c = in.readBool();
x10_d = in.readUint32Big();
x14_e = in.readUint32Big();
u32 count = in.readUint32Big();
x18_keys.reserve(count);
for (u32 i=0 ; i<count ; ++i)
x18_keys.push_back(in.readFloatBig());
}
bool CREKeyframeEmitter::GetValue(int frame, float& valOut) const
{
if (!x4_percent)
{
int emitterTime = CParticleGlobals::g_emitterTimeInt;
int calcKey = emitterTime;
if (xc_b)
{
if (emitterTime >= x10_d)
{
int v1 = emitterTime - x14_e;
int v2 = x10_d - x14_e;
calcKey = v1 / v2;
calcKey *= v2;
calcKey = v1 - calcKey;
calcKey += x14_e;
}
valOut = x18_keys[calcKey];
}
else
{
int x10_d_m1 = x10_d - 1;
if (x10_d_m1 < calcKey)
calcKey = x10_d_m1;
valOut = x18_keys[calcKey];
}
}
else
{
int ltPerc = CParticleGlobals::g_particleLifetimePercentTweenInt;
float ltPercRem = CParticleGlobals::g_particleLifetimePercentTweenIntFloatRem;
if (ltPerc == 100)
valOut = x18_keys[100];
else
valOut = x18_keys[ltPerc+1] * ltPercRem + (1.0f - ltPercRem) * x18_keys[ltPerc];
}
return false;
}
bool CRELifetimeTween::GetValue(int frame, float& valOut) const
{
float ltFac = frame / CParticleGlobals::g_particleLifetimeFloat;
float a, b;
x4_a->GetValue(frame, a);
x8_b->GetValue(frame, b);
valOut = b * ltFac + (1.0f - ltFac) * a;
return false;
}
bool CREConstant::GetValue(int frame, float& valOut) const
{
valOut = x4_val;
return false;
}
bool CRETimeChain::GetValue(int frame, float& valOut) const
{
int v;
xc_c->GetValue(frame, v);
if (frame >= v)
return x8_b->GetValue(frame, valOut);
else
return x4_a->GetValue(frame, valOut);
}
bool CREAdd::GetValue(int frame, float& valOut) const
{
float a, b;
x4_a->GetValue(frame, a);
x8_b->GetValue(frame, b);
valOut = a + b;
return false;
}
bool CREClamp::GetValue(int frame, float &valOut) const
{
float a, b;
x4_a->GetValue(frame, a);
x8_b->GetValue(frame, b);
xc_c->GetValue(frame, valOut);
if (valOut > b)
valOut = b;
if (valOut < a)
valOut = a;
return false;
}
}

View File

@ -1,11 +1,243 @@
#ifndef __RETRO_CREALELEMENT_HPP__
#define __RETRO_CREALELEMENT_HPP__
#include "IElement.hpp"
namespace Retro
{
class CRealElement
class CRELifetimeTween : public CRealElement
{
std::unique_ptr<CRealElement> x4_a;
std::unique_ptr<CRealElement> x8_b;
public:
CRELifetimeTween(CRealElement* a, CRealElement* b)
: x4_a(a), x8_b(b) {}
bool GetValue(int frame, float& valOut) const;
};
class CREConstant : public CRealElement
{
float x4_val;
public:
CREConstant(float val) : x4_val(val) {}
bool GetValue(int frame, float& valOut) const;
bool IsConstant() const {return true;}
};
class CRETimeChain : public CRealElement
{
std::unique_ptr<CRealElement> x4_a;
std::unique_ptr<CRealElement> x8_b;
std::unique_ptr<CIntElement> xc_c;
public:
CRETimeChain(CRealElement* a, CRealElement* b, CIntElement* c)
: x4_a(a), x8_b(b), xc_c(c) {}
bool GetValue(int frame, float& valOut) const;
};
class CREAdd : public CRealElement
{
std::unique_ptr<CRealElement> x4_a;
std::unique_ptr<CRealElement> x8_b;
public:
CREAdd(CRealElement* a, CRealElement* b)
: x4_a(a), x8_b(b) {}
bool GetValue(int frame, float& valOut) const;
};
class CREClamp : public CRealElement
{
std::unique_ptr<CRealElement> x4_a;
std::unique_ptr<CRealElement> x8_b;
std::unique_ptr<CRealElement> xc_c;
public:
CREClamp(CRealElement* a, CRealElement* b, CRealElement* c)
: x4_a(a), x8_b(b), xc_c(c) {}
bool GetValue(int frame, float& valOut) const;
};
class CREKeyframeEmitter : public CRealElement
{
u32 x4_percent;
u32 x8_a;
bool xc_b;
bool xd_c;
u32 x10_d;
u32 x14_e;
std::vector<float> x18_keys;
public:
CREKeyframeEmitter(CInputStream& in);
bool GetValue(int frame, float& valOut) const;
};
class CREInitialRandom : public CRealElement
{
public:
bool GetValue(int frame, float& valOut) const;
bool IsConstant() const {return true;}
};
class CRERandom : public CRealElement
{
public:
bool GetValue(int frame, float& valOut) const;
};
class CREMultiply : public CRealElement
{
public:
bool GetValue(int frame, float& valOut) const;
};
class CREPulse : public CRealElement
{
public:
bool GetValue(int frame, float& valOut) const;
};
class CRETimeScale : public CRealElement
{
public:
bool GetValue(int frame, float& valOut) const;
};
class CRELifetimePercent : public CRealElement
{
public:
bool GetValue(int frame, float& valOut) const;
};
class CRESineWave : public CRealElement
{
public:
bool GetValue(int frame, float& valOut) const;
};
class CREISWT : public CRealElement
{
public:
bool GetValue(int frame, float& valOut) const;
};
class CRECompareLessThan : public CRealElement
{
public:
bool GetValue(int frame, float& valOut) const;
};
class CRECompareEquals : public CRealElement
{
public:
bool GetValue(int frame, float& valOut) const;
};
class CREParticleAccessParam1 : public CRealElement
{
public:
bool GetValue(int frame, float& valOut) const;
};
class CREParticleAccessParam2 : public CRealElement
{
public:
bool GetValue(int frame, float& valOut) const;
};
class CREParticleAccessParam3 : public CRealElement
{
public:
bool GetValue(int frame, float& valOut) const;
};
class CREParticleAccessParam4 : public CRealElement
{
public:
bool GetValue(int frame, float& valOut) const;
};
class CREParticleAccessParam5 : public CRealElement
{
public:
bool GetValue(int frame, float& valOut) const;
};
class CREParticleAccessParam6 : public CRealElement
{
public:
bool GetValue(int frame, float& valOut) const;
};
class CREParticleAccessParam7 : public CRealElement
{
public:
bool GetValue(int frame, float& valOut) const;
};
class CREParticleAccessParam8 : public CRealElement
{
public:
bool GetValue(int frame, float& valOut) const;
};
class CREPSLL : public CRealElement
{
public:
bool GetValue(int frame, float& valOut) const;
};
class CREPRLW : public CRealElement
{
public:
bool GetValue(int frame, float& valOut) const;
};
class CREPSOF : public CRealElement
{
public:
bool GetValue(int frame, float& valOut) const;
};
class CRESubtract : public CRealElement
{
public:
bool GetValue(int frame, float& valOut) const;
};
class CREVectorMagnitude : public CRealElement
{
public:
bool GetValue(int frame, float& valOut) const;
};
class CREVectorXToReal : public CRealElement
{
public:
bool GetValue(int frame, float& valOut) const;
};
class CREVectorYToReal : public CRealElement
{
public:
bool GetValue(int frame, float& valOut) const;
};
class CREVectorZToReal : public CRealElement
{
public:
bool GetValue(int frame, float& valOut) const;
};
class CRECEXT : public CRealElement
{
public:
bool GetValue(int frame, float& valOut) const;
};
class CREITRL : public CRealElement
{
public:
bool GetValue(int frame, float& valOut) const;
};
}

View File

@ -1,11 +1,36 @@
#ifndef __RETRO_CUVELEMENT_HPP__
#define __RETRO_CUVELEMENT_HPP__
#include "IElement.hpp"
namespace Retro
{
class CToken;
class CUVElement
struct SUVElementSet
{
float xMin, yMin, xMax, yMax;
};
class CUVElement : public IElement
{
public:
virtual CToken GetValueTexture(int frame) const=0;
virtual void GetValueUV(int frame, SUVElementSet& valOut) const=0;
};
struct CUVEConstant : public CUVElement
{
public:
CToken GetValueTexture(int frame) const;
void GetValueUV(int frame, SUVElementSet& valOut) const;
};
struct CUVEAnimTexture : public CUVElement
{
public:
CToken GetValueTexture(int frame) const;
void GetValueUV(int frame, SUVElementSet& valOut) const;
};
}

View File

@ -1,11 +1,119 @@
#ifndef __RETRO_CVECTORELEMENT_HPP__
#define __RETRO_CVECTORELEMENT_HPP__
#include "IElement.hpp"
#include "CVector3f.hpp"
namespace Retro
{
class CVectorElement
class CVECone : public CVectorElement
{
public:
bool GetValue(int frame, Zeus::CVector3f& valOut) const;
};
class CVETimeChain : public CVectorElement
{
public:
bool GetValue(int frame, Zeus::CVector3f& valOut) const;
};
class CVEAngleCone : public CVectorElement
{
public:
bool GetValue(int frame, Zeus::CVector3f& valOut) const;
};
class CVEAdd : public CVectorElement
{
public:
bool GetValue(int frame, Zeus::CVector3f& valOut) const;
};
class CVECircleCluster : public CVectorElement
{
public:
bool GetValue(int frame, Zeus::CVector3f& valOut) const;
};
class CVEConstant : public CVectorElement
{
public:
bool GetValue(int frame, Zeus::CVector3f& valOut) const;
};
class CVEFastConstant : public CVectorElement
{
public:
bool GetValue(int frame, Zeus::CVector3f& valOut) const;
bool IsFastConstant() const {return true;}
};
class CVECircle : public CVectorElement
{
public:
bool GetValue(int frame, Zeus::CVector3f& valOut) const;
};
class CVEKeyframeEmitter : public CVectorElement
{
public:
bool GetValue(int frame, Zeus::CVector3f& valOut) const;
};
class CVEMultiply : public CVectorElement
{
public:
bool GetValue(int frame, Zeus::CVector3f& valOut) const;
};
class CVERealToVector : public CVectorElement
{
public:
bool GetValue(int frame, Zeus::CVector3f& valOut) const;
};
class CVEPulse : public CVectorElement
{
public:
bool GetValue(int frame, Zeus::CVector3f& valOut) const;
};
class CVEParticleVelocity : public CVectorElement
{
public:
bool GetValue(int frame, Zeus::CVector3f& valOut) const;
};
class CVESPOS : public CVectorElement
{
public:
bool GetValue(int frame, Zeus::CVector3f& valOut) const;
};
class CVEPLCO : public CVectorElement
{
public:
bool GetValue(int frame, Zeus::CVector3f& valOut) const;
};
class CVEPLOC : public CVectorElement
{
public:
bool GetValue(int frame, Zeus::CVector3f& valOut) const;
};
class CVEPSOR : public CVectorElement
{
public:
bool GetValue(int frame, Zeus::CVector3f& valOut) const;
};
class CVEPSOF : public CVectorElement
{
public:
bool GetValue(int frame, Zeus::CVector3f& valOut) const;
};
}

View File

@ -0,0 +1,53 @@
#ifndef __RETRO_IELEMENT_HPP__
#define __RETRO_IELEMENT_HPP__
#include <memory>
#include "GCNTypes.hpp"
#include "CVector3f.hpp"
#include "CColor.hpp"
#include "IOStreams.hpp"
namespace Retro
{
class IElement
{
public:
virtual ~IElement() = default;
};
class CRealElement : public IElement
{
public:
virtual bool GetValue(int frame, float& valOut) const=0;
virtual bool IsConstant() const {return false;}
};
class CIntElement : public IElement
{
public:
virtual bool GetValue(int frame, int& valOut) const=0;
};
class CVectorElement : public IElement
{
public:
virtual bool GetValue(int frame, Zeus::CVector3f& valOut) const=0;
virtual bool IsFastConstant() const {return false;}
};
class CModVectorElement : public IElement
{
public:
virtual bool GetValue(int frame, Zeus::CVector3f& vec1Out, Zeus::CVector3f& vec2Out) const=0;
};
class CColorElement : public IElement
{
public:
virtual bool GetValue(int frame, Zeus::CColor& colorOut) const=0;
};
}
#endif // __RETRO_IELEMENT_HPP__