mirror of https://github.com/AxioDL/metaforce.git
Runtime/Particle: Replace bitfield unions with constructor initializers
This commit is contained in:
parent
f483f5c1e6
commit
c7ca8dc3a7
|
@ -9,7 +9,7 @@ CRandom16 CDecal::sDecalRandom;
|
||||||
bool CDecal::sMoveRedToAlphaBuffer = false;
|
bool CDecal::sMoveRedToAlphaBuffer = false;
|
||||||
|
|
||||||
CDecal::CDecal(const TToken<CDecalDescription>& desc, const zeus::CTransform& xf)
|
CDecal::CDecal(const TToken<CDecalDescription>& desc, const zeus::CTransform& xf)
|
||||||
: x0_description(desc), xc_transform(xf) {
|
: x0_description(desc), xc_transform(xf), x5c_29_modelInvalid(false) {
|
||||||
CGlobalRandom gr(sDecalRandom);
|
CGlobalRandom gr(sDecalRandom);
|
||||||
|
|
||||||
CDecalDescription& desco = *x0_description;
|
CDecalDescription& desco = *x0_description;
|
||||||
|
|
|
@ -13,17 +13,12 @@
|
||||||
namespace urde {
|
namespace urde {
|
||||||
struct SQuadDescr;
|
struct SQuadDescr;
|
||||||
struct CQuadDecal {
|
struct CQuadDecal {
|
||||||
union {
|
bool x0_24_invalid : 1;
|
||||||
struct {
|
|
||||||
bool x0_24_invalid : 1;
|
|
||||||
};
|
|
||||||
u32 _dummy = 0;
|
|
||||||
};
|
|
||||||
s32 x4_lifetime = 0;
|
s32 x4_lifetime = 0;
|
||||||
float x8_rotation = 0.f;
|
float x8_rotation = 0.f;
|
||||||
const SQuadDescr* m_desc = nullptr;
|
const SQuadDescr* m_desc = nullptr;
|
||||||
CQuadDecal() = default;
|
CQuadDecal() : x0_24_invalid(true) {}
|
||||||
CQuadDecal(s32 i, float f) : x4_lifetime(i), x8_rotation(f) { x0_24_invalid = true; }
|
CQuadDecal(s32 i, float f) : x0_24_invalid(true), x4_lifetime(i), x8_rotation(f) {}
|
||||||
|
|
||||||
boo::ObjToken<boo::IGraphicsBufferD> m_instBuf;
|
boo::ObjToken<boo::IGraphicsBufferD> m_instBuf;
|
||||||
boo::ObjToken<boo::IGraphicsBufferD> m_uniformBuf;
|
boo::ObjToken<boo::IGraphicsBufferD> m_uniformBuf;
|
||||||
|
@ -41,14 +36,9 @@ class CDecal {
|
||||||
std::array<CQuadDecal, 2> x3c_decalQuads;
|
std::array<CQuadDecal, 2> x3c_decalQuads;
|
||||||
s32 x54_modelLifetime = 0;
|
s32 x54_modelLifetime = 0;
|
||||||
s32 x58_frameIdx = 0;
|
s32 x58_frameIdx = 0;
|
||||||
union {
|
bool x5c_31_quad1Invalid : 1;
|
||||||
struct {
|
bool x5c_30_quad2Invalid : 1;
|
||||||
bool x5c_31_quad1Invalid : 1;
|
bool x5c_29_modelInvalid : 1;
|
||||||
bool x5c_30_quad2Invalid : 1;
|
|
||||||
bool x5c_29_modelInvalid : 1;
|
|
||||||
};
|
|
||||||
u32 x5c_dummy = 0;
|
|
||||||
};
|
|
||||||
zeus::CVector3f x60_rotation;
|
zeus::CVector3f x60_rotation;
|
||||||
bool InitQuad(CQuadDecal& quad, const SQuadDescr& desc);
|
bool InitQuad(CQuadDecal& quad, const SQuadDescr& desc);
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,8 @@ struct SQuadDescr {
|
||||||
|
|
||||||
class CDecalDescription {
|
class CDecalDescription {
|
||||||
public:
|
public:
|
||||||
|
CDecalDescription() : x5c_24_DMAB(false), x5c_25_DMOO(false) {}
|
||||||
|
|
||||||
SQuadDescr x0_Quads[2];
|
SQuadDescr x0_Quads[2];
|
||||||
SParticleModel x38_DMDL;
|
SParticleModel x38_DMDL;
|
||||||
std::unique_ptr<CIntElement> x48_DLFT;
|
std::unique_ptr<CIntElement> x48_DLFT;
|
||||||
|
@ -30,13 +32,8 @@ public:
|
||||||
std::unique_ptr<CVectorElement> x50_DMRT;
|
std::unique_ptr<CVectorElement> x50_DMRT;
|
||||||
std::unique_ptr<CVectorElement> x54_DMSC;
|
std::unique_ptr<CVectorElement> x54_DMSC;
|
||||||
std::unique_ptr<CColorElement> x58_DMCL;
|
std::unique_ptr<CColorElement> x58_DMCL;
|
||||||
union {
|
bool x5c_24_DMAB : 1;
|
||||||
struct {
|
bool x5c_25_DMOO : 1;
|
||||||
bool x5c_24_DMAB : 1;
|
|
||||||
bool x5c_25_DMOO : 1;
|
|
||||||
};
|
|
||||||
u32 dummy = 0;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace urde
|
} // namespace urde
|
||||||
|
|
|
@ -54,12 +54,25 @@ void CElementGen::Initialize() {
|
||||||
void CElementGen::Shutdown() { CElementGenShaders::Shutdown(); }
|
void CElementGen::Shutdown() { CElementGenShaders::Shutdown(); }
|
||||||
|
|
||||||
CElementGen::CElementGen(TToken<CGenDescription> gen, EModelOrientationType orientType, EOptionalSystemFlags flags)
|
CElementGen::CElementGen(TToken<CGenDescription> gen, EModelOrientationType orientType, EOptionalSystemFlags flags)
|
||||||
: x1c_genDesc(std::move(gen)), x2c_orientType(orientType), x27c_randState(x94_randomSeed) {
|
: x1c_genDesc(std::move(gen))
|
||||||
|
, x2c_orientType(orientType)
|
||||||
|
, x26c_24_translationDirty(false)
|
||||||
|
, x26c_25_LIT_(false)
|
||||||
|
, x26c_26_AAPH(false)
|
||||||
|
, x26c_27_ZBUF(false)
|
||||||
|
, x26c_28_zTest(false)
|
||||||
|
, x26c_29_ORNT(false)
|
||||||
|
, x26c_30_MBLR(false)
|
||||||
|
, x26c_31_LINE(false)
|
||||||
|
, x26d_24_FXLL(false)
|
||||||
|
, x26d_25_warmedUp(false)
|
||||||
|
, x26d_26_modelsUseLights(false)
|
||||||
|
, x26d_27_enableOPTS(True(flags & EOptionalSystemFlags::Two))
|
||||||
|
, x26d_28_enableADV(false)
|
||||||
|
, x27c_randState(x94_randomSeed) {
|
||||||
CGenDescription* desc = x1c_genDesc.GetObj();
|
CGenDescription* desc = x1c_genDesc.GetObj();
|
||||||
x28_loadedGenDesc = desc;
|
x28_loadedGenDesc = desc;
|
||||||
|
|
||||||
x26d_27_enableOPTS = True(flags & EOptionalSystemFlags::Two);
|
|
||||||
|
|
||||||
if (desc->x54_x40_TEXR)
|
if (desc->x54_x40_TEXR)
|
||||||
desc->x54_x40_TEXR->GetValueTexture(0).GetObj();
|
desc->x54_x40_TEXR->GetValueTexture(0).GetObj();
|
||||||
if (desc->x58_x44_TIND)
|
if (desc->x58_x44_TIND)
|
||||||
|
|
|
@ -87,26 +87,19 @@ private:
|
||||||
u32 x260_cumulativeParticles = 0;
|
u32 x260_cumulativeParticles = 0;
|
||||||
u32 x264_recursiveParticleCount = 0;
|
u32 x264_recursiveParticleCount = 0;
|
||||||
int x268_PSLT;
|
int x268_PSLT;
|
||||||
|
bool x26c_24_translationDirty : 1;
|
||||||
union {
|
bool x26c_25_LIT_ : 1;
|
||||||
struct {
|
bool x26c_26_AAPH : 1;
|
||||||
bool x26c_24_translationDirty : 1;
|
bool x26c_27_ZBUF : 1;
|
||||||
bool x26c_25_LIT_ : 1;
|
bool x26c_28_zTest : 1;
|
||||||
bool x26c_26_AAPH : 1;
|
bool x26c_29_ORNT : 1;
|
||||||
bool x26c_27_ZBUF : 1;
|
bool x26c_30_MBLR : 1;
|
||||||
bool x26c_28_zTest : 1;
|
bool x26c_31_LINE : 1;
|
||||||
bool x26c_29_ORNT : 1;
|
bool x26d_24_FXLL : 1;
|
||||||
bool x26c_30_MBLR : 1;
|
bool x26d_25_warmedUp : 1;
|
||||||
bool x26c_31_LINE : 1;
|
bool x26d_26_modelsUseLights : 1;
|
||||||
bool x26d_24_FXLL : 1;
|
bool x26d_27_enableOPTS : 1;
|
||||||
bool x26d_25_warmedUp : 1;
|
bool x26d_28_enableADV : 1;
|
||||||
bool x26d_26_modelsUseLights : 1;
|
|
||||||
bool x26d_27_enableOPTS : 1;
|
|
||||||
bool x26d_28_enableADV : 1;
|
|
||||||
};
|
|
||||||
u32 _dummy = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
int x270_MBSP = 0;
|
int x270_MBSP = 0;
|
||||||
int m_maxMBSP = 0;
|
int m_maxMBSP = 0;
|
||||||
ERglLightBits x274_backupLightActive = ERglLightBits::None;
|
ERglLightBits x274_backupLightActive = ERglLightBits::None;
|
||||||
|
|
|
@ -39,30 +39,25 @@ public:
|
||||||
// std::unique_ptr<CVectorElement> x38_ILOC;
|
// std::unique_ptr<CVectorElement> x38_ILOC;
|
||||||
// std::unique_ptr<CVectorElement> x3c_IVEC;
|
// std::unique_ptr<CVectorElement> x3c_IVEC;
|
||||||
std::unique_ptr<CEmitterElement> x40_x2c_EMTR;
|
std::unique_ptr<CEmitterElement> x40_x2c_EMTR;
|
||||||
union {
|
bool x44_28_x30_28_SORT : 1;
|
||||||
struct {
|
bool x44_30_x31_24_MBLR : 1;
|
||||||
bool x44_28_x30_28_SORT : 1;
|
bool x44_24_x30_24_LINE : 1;
|
||||||
bool x44_30_x31_24_MBLR : 1;
|
bool x44_29_x30_29_LIT_ : 1;
|
||||||
bool x44_24_x30_24_LINE : 1;
|
bool x44_26_x30_26_AAPH : 1;
|
||||||
bool x44_29_x30_29_LIT_ : 1;
|
bool x44_27_x30_27_ZBUF : 1;
|
||||||
bool x44_26_x30_26_AAPH : 1;
|
bool x44_25_x30_25_FXLL : 1;
|
||||||
bool x44_27_x30_27_ZBUF : 1;
|
bool x44_31_x31_25_PMAB : 1;
|
||||||
bool x44_25_x30_25_FXLL : 1;
|
bool x45_29_x31_31_VMD4 : 1;
|
||||||
bool x44_31_x31_25_PMAB : 1;
|
bool x45_28_x31_30_VMD3 : 1;
|
||||||
bool x45_29_x31_31_VMD4 : 1;
|
bool x45_27_x31_29_VMD2 : 1;
|
||||||
bool x45_28_x31_30_VMD3 : 1;
|
bool x45_26_x31_28_VMD1 : 1;
|
||||||
bool x45_27_x31_29_VMD2 : 1;
|
bool x45_31_x32_25_OPTS : 1;
|
||||||
bool x45_26_x31_28_VMD1 : 1;
|
bool x45_24_x31_26_PMUS : 1;
|
||||||
bool x45_31_x32_25_OPTS : 1;
|
bool x45_25_x31_27_PMOO : 1;
|
||||||
bool x45_24_x31_26_PMUS : 1;
|
bool x45_30_x32_24_CIND : 1;
|
||||||
bool x45_25_x31_27_PMOO : 1;
|
/* 0-00 additions */
|
||||||
bool x45_30_x32_24_CIND : 1;
|
bool x30_30_ORNT : 1;
|
||||||
/* 0-00 additions */
|
bool x30_31_RSOP : 1;
|
||||||
bool x30_30_ORNT : 1;
|
|
||||||
bool x30_31_RSOP : 1;
|
|
||||||
};
|
|
||||||
u32 dummy1 = 0;
|
|
||||||
};
|
|
||||||
std::unique_ptr<CIntElement> x48_x34_MBSP;
|
std::unique_ptr<CIntElement> x48_x34_MBSP;
|
||||||
std::unique_ptr<CRealElement> x4c_x38_SIZE;
|
std::unique_ptr<CRealElement> x4c_x38_SIZE;
|
||||||
std::unique_ptr<CRealElement> x50_x3c_ROTA;
|
std::unique_ptr<CRealElement> x50_x3c_ROTA;
|
||||||
|
@ -112,7 +107,25 @@ public:
|
||||||
/* Custom additions */
|
/* Custom additions */
|
||||||
std::unique_ptr<CColorElement> m_bevelGradient; /* FourCC BGCL */
|
std::unique_ptr<CColorElement> m_bevelGradient; /* FourCC BGCL */
|
||||||
|
|
||||||
CGenDescription() { x45_25_x31_27_PMOO = true; }
|
CGenDescription()
|
||||||
|
: x44_28_x30_28_SORT(false)
|
||||||
|
, x44_30_x31_24_MBLR(false)
|
||||||
|
, x44_24_x30_24_LINE(false)
|
||||||
|
, x44_29_x30_29_LIT_(false)
|
||||||
|
, x44_26_x30_26_AAPH(false)
|
||||||
|
, x44_27_x30_27_ZBUF(false)
|
||||||
|
, x44_25_x30_25_FXLL(false)
|
||||||
|
, x44_31_x31_25_PMAB(false)
|
||||||
|
, x45_29_x31_31_VMD4(false)
|
||||||
|
, x45_28_x31_30_VMD3(false)
|
||||||
|
, x45_27_x31_29_VMD2(false)
|
||||||
|
, x45_26_x31_28_VMD1(false)
|
||||||
|
, x45_31_x32_25_OPTS(false)
|
||||||
|
, x45_24_x31_26_PMUS(false)
|
||||||
|
, x45_25_x31_27_PMOO(true)
|
||||||
|
, x45_30_x32_24_CIND(false)
|
||||||
|
, x30_30_ORNT(false)
|
||||||
|
, x30_31_RSOP(false) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace urde
|
} // namespace urde
|
||||||
|
|
|
@ -19,11 +19,16 @@ namespace urde {
|
||||||
u16 CParticleElectric::g_GlobalSeed = 99;
|
u16 CParticleElectric::g_GlobalSeed = 99;
|
||||||
|
|
||||||
CParticleElectric::CParticleElectric(const TToken<CElectricDescription>& token)
|
CParticleElectric::CParticleElectric(const TToken<CElectricDescription>& token)
|
||||||
: x1c_elecDesc(token), x14c_randState(g_GlobalSeed++) {
|
: x1c_elecDesc(token)
|
||||||
|
, x14c_randState(g_GlobalSeed++)
|
||||||
|
, x450_24_emitting(true)
|
||||||
|
, x450_25_haveGPSM(false)
|
||||||
|
, x450_26_haveEPSM(false)
|
||||||
|
, x450_27_haveSSWH(false)
|
||||||
|
, x450_28_haveLWD(false)
|
||||||
|
, x450_29_transformDirty(true) {
|
||||||
x1bc_allocated.resize(32);
|
x1bc_allocated.resize(32);
|
||||||
|
|
||||||
x450_24_emitting = true;
|
|
||||||
x450_29_transformDirty = true;
|
|
||||||
CElectricDescription* desc = x1c_elecDesc.GetObj();
|
CElectricDescription* desc = x1c_elecDesc.GetObj();
|
||||||
|
|
||||||
if (CIntElement* sseg = desc->x10_SSEG.get())
|
if (CIntElement* sseg = desc->x10_SSEG.get())
|
||||||
|
|
|
@ -85,22 +85,16 @@ private:
|
||||||
std::vector<zeus::CVector3f> x420_calculatedVerts;
|
std::vector<zeus::CVector3f> x420_calculatedVerts;
|
||||||
std::vector<float> x430_fractalMags;
|
std::vector<float> x430_fractalMags;
|
||||||
std::vector<zeus::CVector3f> x440_fractalOffsets;
|
std::vector<zeus::CVector3f> x440_fractalOffsets;
|
||||||
|
bool x450_24_emitting : 1;
|
||||||
|
bool x450_25_haveGPSM : 1;
|
||||||
|
bool x450_26_haveEPSM : 1;
|
||||||
|
bool x450_27_haveSSWH : 1;
|
||||||
|
bool x450_28_haveLWD : 1;
|
||||||
|
bool x450_29_transformDirty : 1;
|
||||||
|
|
||||||
size_t m_nextLineRenderer = 0;
|
size_t m_nextLineRenderer = 0;
|
||||||
std::vector<std::unique_ptr<CLineRenderer>> m_lineRenderers;
|
std::vector<std::unique_ptr<CLineRenderer>> m_lineRenderers;
|
||||||
|
|
||||||
union {
|
|
||||||
struct {
|
|
||||||
bool x450_24_emitting : 1;
|
|
||||||
bool x450_25_haveGPSM : 1;
|
|
||||||
bool x450_26_haveEPSM : 1;
|
|
||||||
bool x450_27_haveSSWH : 1;
|
|
||||||
bool x450_28_haveLWD : 1;
|
|
||||||
bool x450_29_transformDirty : 1;
|
|
||||||
};
|
|
||||||
u32 dummy = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
void SetupLineGXMaterial();
|
void SetupLineGXMaterial();
|
||||||
void DrawLineStrip(const std::vector<zeus::CVector3f>& verts, float width, const zeus::CColor& color);
|
void DrawLineStrip(const std::vector<zeus::CVector3f>& verts, float width, const zeus::CColor& color);
|
||||||
void RenderLines();
|
void RenderLines();
|
||||||
|
|
|
@ -16,8 +16,16 @@ CParticleSwoosh::CParticleSwoosh(const TToken<CSwooshDescription>& desc, int len
|
||||||
, x1c0_rand(x1c_desc->x45_26_CRND ? std::chrono::duration_cast<std::chrono::microseconds>(
|
, x1c0_rand(x1c_desc->x45_26_CRND ? std::chrono::duration_cast<std::chrono::microseconds>(
|
||||||
std::chrono::steady_clock::now().time_since_epoch())
|
std::chrono::steady_clock::now().time_since_epoch())
|
||||||
.count()
|
.count()
|
||||||
: 99) {
|
: 99)
|
||||||
x1d0_24_emitting = true;
|
, x1d0_24_emitting(true)
|
||||||
|
, x1d0_25_AALP(false)
|
||||||
|
, x1d0_26_forceOneUpdate(false)
|
||||||
|
, x1d0_27_renderGaps(false)
|
||||||
|
, x1d0_28_LLRD(false)
|
||||||
|
, x1d0_29_VLS1(false)
|
||||||
|
, x1d0_30_VLS2(false)
|
||||||
|
, x1d0_31_constantTex(false)
|
||||||
|
, x1d1_24_constantUv(false) {
|
||||||
++g_ParticleSystemAliveCount;
|
++g_ParticleSystemAliveCount;
|
||||||
|
|
||||||
if (leng > 0)
|
if (leng > 0)
|
||||||
|
|
|
@ -83,21 +83,15 @@ class CParticleSwoosh : public CParticleGen {
|
||||||
float x1c4_ = 0.f;
|
float x1c4_ = 0.f;
|
||||||
float x1c8_ = 0.f;
|
float x1c8_ = 0.f;
|
||||||
float x1cc_TSPN;
|
float x1cc_TSPN;
|
||||||
|
bool x1d0_24_emitting : 1;
|
||||||
union {
|
bool x1d0_25_AALP : 1;
|
||||||
struct {
|
bool x1d0_26_forceOneUpdate : 1;
|
||||||
bool x1d0_24_emitting : 1;
|
bool x1d0_27_renderGaps : 1;
|
||||||
bool x1d0_25_AALP : 1;
|
bool x1d0_28_LLRD : 1;
|
||||||
bool x1d0_26_forceOneUpdate : 1;
|
bool x1d0_29_VLS1 : 1;
|
||||||
bool x1d0_27_renderGaps : 1;
|
bool x1d0_30_VLS2 : 1;
|
||||||
bool x1d0_28_LLRD : 1;
|
bool x1d0_31_constantTex : 1;
|
||||||
bool x1d0_29_VLS1 : 1;
|
bool x1d1_24_constantUv : 1;
|
||||||
bool x1d0_30_VLS2 : 1;
|
|
||||||
bool x1d0_31_constantTex : 1;
|
|
||||||
bool x1d1_24_constantUv : 1;
|
|
||||||
};
|
|
||||||
u32 _dummy = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
SUVElementSet x1d4_uvs = {};
|
SUVElementSet x1d4_uvs = {};
|
||||||
CTexture* x1e4_tex = nullptr;
|
CTexture* x1e4_tex = nullptr;
|
||||||
|
|
|
@ -31,23 +31,29 @@ public:
|
||||||
std::unique_ptr<CIntElement> x38_SPLN;
|
std::unique_ptr<CIntElement> x38_SPLN;
|
||||||
std::unique_ptr<CUVElement> x3c_TEXR;
|
std::unique_ptr<CUVElement> x3c_TEXR;
|
||||||
std::unique_ptr<CIntElement> x40_TSPN;
|
std::unique_ptr<CIntElement> x40_TSPN;
|
||||||
union {
|
bool x44_24_LLRD : 1;
|
||||||
struct {
|
bool x44_25_CROS : 1;
|
||||||
bool x44_24_LLRD : 1;
|
bool x44_26_VLS1 : 1;
|
||||||
bool x44_25_CROS : 1;
|
bool x44_27_VLS2 : 1;
|
||||||
bool x44_26_VLS1 : 1;
|
bool x44_28_SROT : 1;
|
||||||
bool x44_27_VLS2 : 1;
|
bool x44_29_WIRE : 1;
|
||||||
bool x44_28_SROT : 1;
|
bool x44_30_TEXW : 1;
|
||||||
bool x44_29_WIRE : 1;
|
bool x44_31_AALP : 1;
|
||||||
bool x44_30_TEXW : 1;
|
bool x45_24_ZBUF : 1;
|
||||||
bool x44_31_AALP : 1;
|
bool x45_25_ORNT : 1;
|
||||||
bool x45_24_ZBUF : 1;
|
bool x45_26_CRND : 1;
|
||||||
bool x45_25_ORNT : 1;
|
|
||||||
bool x45_26_CRND : 1;
|
|
||||||
};
|
|
||||||
u32 dummy = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
CSwooshDescription() { x44_25_CROS = true; }
|
CSwooshDescription()
|
||||||
|
: x44_24_LLRD(false)
|
||||||
|
, x44_25_CROS(true)
|
||||||
|
, x44_26_VLS1(false)
|
||||||
|
, x44_27_VLS2(false)
|
||||||
|
, x44_28_SROT(false)
|
||||||
|
, x44_29_WIRE(false)
|
||||||
|
, x44_30_TEXW(false)
|
||||||
|
, x44_31_AALP(false)
|
||||||
|
, x45_24_ZBUF(false)
|
||||||
|
, x45_25_ORNT(false)
|
||||||
|
, x45_26_CRND(false) {}
|
||||||
};
|
};
|
||||||
} // namespace urde
|
} // namespace urde
|
||||||
|
|
Loading…
Reference in New Issue