diff --git a/Runtime/CToken.hpp b/Runtime/CToken.hpp index ad1e51da2..721000206 100644 --- a/Runtime/CToken.hpp +++ b/Runtime/CToken.hpp @@ -202,7 +202,7 @@ public: } }; -template +template class TToken : public CToken { public: @@ -212,17 +212,21 @@ public: } TToken() = default; TToken(const CToken& other) : CToken(other) {} + TToken(CToken&& other) : CToken(std::move(other)) {} TToken(T* obj) : CToken(GetIObjObjectFor(std::unique_ptr(obj))) {} TToken& operator=(T* obj) {*this = CToken(GetIObjObjectFor(obj)); return this;} T* GetObj() {return static_cast*>(CToken::GetObj())->GetObj();} }; -template +template class TLockedToken : public TToken { + T* m_obj; public: - TLockedToken(const CToken& other) : TToken(other) {CToken::Lock();} + TLockedToken(const CToken& other) : TToken(other) {m_obj = TToken::GetObj();} + TLockedToken(CToken&& other) : TToken(std::move(other)) {m_obj = TToken::GetObj();} + T* GetObj() {return m_obj;} }; } diff --git a/Runtime/Particle/CElementGen.cpp b/Runtime/Particle/CElementGen.cpp index e69de29bb..3f3229468 100644 --- a/Runtime/Particle/CElementGen.cpp +++ b/Runtime/Particle/CElementGen.cpp @@ -0,0 +1,15 @@ +#include "CElementGen.hpp" +#include "CGenDescription.hpp" + +namespace Retro +{ + +CElementGen::CElementGen(const TToken& gen, + EModelOrientationType orientType, + EOptionalSystemFlags flags) +: x1c_genDesc(gen), x28_orientType(orientType) +{ + +} + +} diff --git a/Runtime/Particle/CElementGen.hpp b/Runtime/Particle/CElementGen.hpp index 2c7e427e7..9acc9e2b4 100644 --- a/Runtime/Particle/CElementGen.hpp +++ b/Runtime/Particle/CElementGen.hpp @@ -5,24 +5,62 @@ #include "CTransform.hpp" #include "CColor.hpp" #include "CAABox.hpp" +#include "CToken.hpp" namespace Retro { class CWarp; class CLight; -class CGenDescription -{ -}; +class CGenDescription; class CElementGen { - bool x68_particleEmission; - float x78_generatorRate; +public: + enum class EModelOrientationType + { + }; + enum class EOptionalSystemFlags + { + }; +private: + TLockedToken x1c_genDesc; + EModelOrientationType x28_orientType; + u32 x30 = 0; + u32 x34 = 0; + u32 x38 = 0; + u32 x40 = 0; + u32 x44 = 0; + u32 x48 = 0; + u32 x4c = 0; + u32 x50 = 0; + float x58 = 0.f; + u32 x64 = -1; + bool x68_particleEmission = true; + float x6c = 0.f; + u32 x70 = 0; + u16 x74 = 99; + float x78_generatorRate = 1.f; + float x7c = 0.f; + float x80 = 0.f; + float x84 = 0.f; + float x88 = 0.f; + float x8c = 0.f; + float x90 = 0.f; + float x94 = 0.f; + float x98 = 0.f; + float x9c = 0.f; + float xa0 = 1.f; + float xa4 = 1.f; + float xa8 = 1.f; + Zeus::CTransform xac = Zeus::CTransform::Identity(); Zeus::CVector3f x88_globalTranslation; Zeus::CTransform x1d8_globalOrientation; std::vector x240_children; std::vector x254_children; public: + CElementGen(const TToken& gen, EModelOrientationType orientType, EOptionalSystemFlags flags); + virtual ~CElementGen() = default; + virtual const Zeus::CVector3f& GetGlobalTranslation() const { return x88_globalTranslation; } virtual const Zeus::CTransform& GetGlobalOrientation() const @@ -49,7 +87,6 @@ public: } void BuildParticleSystemBounds(); - virtual ~CElementGen() {} virtual void Update(double); virtual void Render(); virtual void SetOrientation(const Zeus::CTransform&); diff --git a/Runtime/Particle/CUVElement.cpp b/Runtime/Particle/CUVElement.cpp index 343496f65..accc194ee 100644 --- a/Runtime/Particle/CUVElement.cpp +++ b/Runtime/Particle/CUVElement.cpp @@ -5,7 +5,7 @@ namespace Retro CUVEAnimTexture::CUVEAnimTexture(TToken&& tex, CIntElement* a, CIntElement* b, CIntElement* c, CIntElement* d, CIntElement* e, bool f) -: x4_tex(std::move(tex)), xc_directTex(x4_tex.GetObj()), x24_loop(f), x28_cycleFrameRate(e) +: x4_tex(std::move(tex)), x24_loop(f), x28_cycleFrameRate(e) { a->GetValue(0, x10_tileW); delete a; @@ -16,8 +16,8 @@ CUVEAnimTexture::CUVEAnimTexture(TToken&& tex, CIntElement* a, CIntEle d->GetValue(0, x1c_strideH); delete d; - int width = xc_directTex->GetWidth(); - int height = xc_directTex->GetHeight(); + int width = x4_tex.GetObj()->GetWidth(); + int height = x4_tex.GetObj()->GetHeight(); float widthF = width; float heightF = height; int xTiles = std::max(1, width / x18_strideW); diff --git a/Runtime/Particle/CUVElement.hpp b/Runtime/Particle/CUVElement.hpp index e62569b33..097721f82 100644 --- a/Runtime/Particle/CUVElement.hpp +++ b/Runtime/Particle/CUVElement.hpp @@ -9,14 +9,6 @@ namespace Retro { class CToken; -struct SUVElementTexture -{ - TToken m_tex; - CTexture* m_directTex; - SUVElementTexture(TToken&& tex, CTexture* directTex) - : m_tex(std::move(tex)), m_directTex(directTex) {} -}; - struct SUVElementSet { float xMin, yMin, xMax, yMax; @@ -25,7 +17,7 @@ struct SUVElementSet class CUVElement : public IElement { public: - virtual SUVElementTexture GetValueTexture(int frame) const=0; + virtual TLockedToken GetValueTexture(int frame) const=0; virtual void GetValueUV(int frame, SUVElementSet& valOut) const=0; virtual bool HasConstantTexture() const=0; virtual bool HasConstantUV() const=0; @@ -33,14 +25,13 @@ public: struct CUVEConstant : public CUVElement { - TToken x4_tex; - CTexture* xc_directTex; + TLockedToken x4_tex; public: CUVEConstant(TToken&& tex) - : x4_tex(std::move(tex)), xc_directTex(x4_tex.GetObj()) {} - SUVElementTexture GetValueTexture(int frame) const + : x4_tex(std::move(tex)) {} + TLockedToken GetValueTexture(int frame) const { - return SUVElementTexture(TLockedToken(x4_tex), xc_directTex); + return TLockedToken(x4_tex); } void GetValueUV(int frame, SUVElementSet& valOut) const { @@ -52,8 +43,7 @@ public: struct CUVEAnimTexture : public CUVElement { - TToken x4_tex; - CTexture* xc_directTex; + TLockedToken x4_tex; int x10_tileW, x14_tileH, x18_strideW, x1c_strideH; int x20_tiles; bool x24_loop; @@ -62,9 +52,9 @@ struct CUVEAnimTexture : public CUVElement public: CUVEAnimTexture(TToken&& tex, CIntElement* a, CIntElement* b, CIntElement* c, CIntElement* d, CIntElement* e, bool f); - SUVElementTexture GetValueTexture(int frame) const + TLockedToken GetValueTexture(int frame) const { - return SUVElementTexture(TLockedToken(x4_tex), xc_directTex); + return TLockedToken(x4_tex); } void GetValueUV(int frame, SUVElementSet& valOut) const; bool HasConstantTexture() const {return true;} diff --git a/libSpecter b/libSpecter index 56dfa0a19..16b7449c0 160000 --- a/libSpecter +++ b/libSpecter @@ -1 +1 @@ -Subproject commit 56dfa0a19591b46e4735c77e6a28fdbff5aa84ed +Subproject commit 16b7449c0a2ea2e2824bf0cbd3936ecd59e04cba