Nearly match CGenDescription

This commit is contained in:
Phillip Stephens 2024-12-24 00:29:59 -08:00
parent a1098ff31e
commit 83267c7a4b
6 changed files with 272 additions and 83 deletions

View File

@ -13989,8 +13989,8 @@ GetInt__20CParticleDataFactoryFR12CInputStream = .text:0x80328408; // type:funct
GetBool__20CParticleDataFactoryFR12CInputStream = .text:0x80328428; // type:function size:0x34 scope:global
GetClassID__20CParticleDataFactoryFR12CInputStream = .text:0x8032845C; // type:function size:0x20 scope:global
CreateGPSM__20CParticleDataFactoryFP15CGenDescriptionR12CInputStreamRQ24rstl37vector<Ui,Q24rstl17rmemory_allocator>P11CSimplePool = .text:0x8032847C; // type:function size:0x15C8 scope:global
__dt__24CSpawnSystemKeyframeDataFv = .text:0x80329A44; // type:function size:0x48 scope:global
fn_80329A8C = .text:0x80329A8C; // type:function size:0x58
fn_80329A44 = .text:0x80329A44; // type:function size:0x48 scope:global
__dt__24CSpawnSystemKeyframeDataFv = .text:0x80329A8C; // type:function size:0x58
fn_80329AE4 = .text:0x80329AE4; // type:function size:0x8C
fn_80329B70 = .text:0x80329B70; // type:function size:0x50
fn_80329BC0 = .text:0x80329BC0; // type:function size:0x24
@ -15190,7 +15190,7 @@ __ct__18CSwooshDescriptionFv = .text:0x80366D64; // type:function size:0xD4 scop
__dt__15CGenDescriptionFv = .text:0x80366E38; // type:function size:0x1DC scope:global
__dt__Q24rstl38single_ptr<24CSpawnSystemKeyframeData>Fv = .text:0x80367014; // type:function size:0x58 scope:global
__ct__15CGenDescriptionFv = .text:0x8036706C; // type:function size:0x1C8 scope:global
element_from_desc__FP15CGenDescriptioni = .text:0x80367234; // type:function size:0x8 scope:global
element_from_desc__FP15CGenDescriptioni = .text:0x80367234; // type:function size:0x8 scope:local
EnsureWorldPakReady__8CPakFileFv = .text:0x8036723C; // type:function size:0x1F0 scope:global
fn_8036742C = .text:0x8036742C; // type:function size:0xF8
fn_80367524 = .text:0x80367524; // type:function size:0x104
@ -17890,7 +17890,7 @@ lbl_803D83F8 = .rodata:0x803D83F8; // type:object size:0x8
lbl_803D8400 = .rodata:0x803D8400; // type:object size:0x8
@stringBase0 = .rodata:0x803D8408; // type:object size:0x7 scope:local data:string_table
lbl_803D8410 = .rodata:0x803D8410; // type:object size:0x8
lbl_803D8418 = .rodata:0x803D8418; // type:object size:0xC8 data:4byte
skGenOffsets = .rodata:0x803D8418; // type:object size:0xC8 scope:local data:4byte
lbl_803D84E0 = .rodata:0x803D84E0; // type:object size:0x58
lbl_803D8538 = .rodata:0x803D8538; // type:object size:0x8
lbl_803D8540 = .rodata:0x803D8540; // type:object size:0x8

View File

@ -13989,8 +13989,8 @@ GetInt__20CParticleDataFactoryFR12CInputStream = .text:0x803284E8; // type:funct
GetBool__20CParticleDataFactoryFR12CInputStream = .text:0x80328508; // type:function size:0x34 scope:global
GetClassID__20CParticleDataFactoryFR12CInputStream = .text:0x8032853C; // type:function size:0x20 scope:global
CreateGPSM__20CParticleDataFactoryFP15CGenDescriptionR12CInputStreamRQ24rstl37vector<Ui,Q24rstl17rmemory_allocator>P11CSimplePool = .text:0x8032855C; // type:function size:0x15C8 scope:global
__dt__24CSpawnSystemKeyframeDataFv = .text:0x80329B24; // type:function size:0x48 scope:global
fn_80329A8C = .text:0x80329B6C; // type:function size:0x58 scope:global
fn_80329A44 = .text:0x80329B24; // type:function size:0x48 scope:global
__dt__24CSpawnSystemKeyframeDataFv = .text:0x80329B6C; // type:function size:0x58 scope:global
fn_80329AE4 = .text:0x80329BC4; // type:function size:0x8C scope:global
fn_80329B70 = .text:0x80329C50; // type:function size:0x50 scope:global
fn_80329BC0 = .text:0x80329CA0; // type:function size:0x24 scope:global
@ -15190,7 +15190,7 @@ __ct__18CSwooshDescriptionFv = .text:0x80366F40; // type:function size:0xD4 scop
__dt__15CGenDescriptionFv = .text:0x80367014; // type:function size:0x1DC scope:global
__dt__Q24rstl38single_ptr<24CSpawnSystemKeyframeData>Fv = .text:0x803671F0; // type:function size:0x58 scope:global
__ct__15CGenDescriptionFv = .text:0x80367248; // type:function size:0x1C8 scope:global
element_from_desc__FP15CGenDescriptioni = .text:0x80367410; // type:function size:0x8 scope:global
element_from_desc__FP15CGenDescriptioni = .text:0x80367410; // type:function size:0x8 scope:local
EnsureWorldPakReady__8CPakFileFv = .text:0x80367418; // type:function size:0x1F0 scope:global
fn_8036742C = .text:0x80367608; // type:function size:0xF8 scope:global
fn_80367524 = .text:0x80367700; // type:function size:0x104 scope:global

View File

@ -1,8 +1,10 @@
#ifndef _CGENDESCRIPTION
#define _CGENDESCRIPTION
#include "Kyoto/CToken.hpp"
#include "types.h"
#include "Kyoto/Particles/CSpawnSystemKeyframeData.hpp"
#include "Kyoto/Particles/IElement.hpp"
#include "Kyoto/TToken.hpp"
@ -12,94 +14,87 @@
class CModel;
class CElectricDescription;
class CSwooshDescription;
class CSpawnSystemKeyframeData;
class CGenDescription {
public:
typedef rstl::optional_object< TLockedToken< CModel > > TParticleModel;
typedef rstl::optional_object< TLockedToken< CGenDescription > > TChildGeneratorDesc;
typedef rstl::optional_object< TLockedToken< CSwooshDescription > > TSwooshGeneratorDesc;
typedef TLockedToken< CElectricDescription > TElectricGeneratorDesc;
CGenDescription();
~CGenDescription();
private:
rstl::single_ptr< CIntElement > x0_PSLT;
rstl::single_ptr< CIntElement > x4_PSWT;
rstl::single_ptr< CRealElement > x8_PSTS;
rstl::single_ptr< CVectorElement > xc_POFS;
rstl::single_ptr< CIntElement > x10_SEED;
rstl::single_ptr< CRealElement > x14_LENG;
rstl::single_ptr< CRealElement > x18_WIDT;
rstl::single_ptr< CIntElement > x1c_MAXP;
rstl::single_ptr< CRealElement > x20_GRTE;
rstl::single_ptr< CColorElement > x24_COLR;
rstl::single_ptr< CIntElement > x28_LTME;
rstl::single_ptr< CEmitterElement > x2c_EMTR;
bool x30_28_SORT : 1;
bool x31_24_MBLR : 1;
IElement* x0_PSLT;
IElement* x4_PSWT;
IElement* x8_PSTS;
IElement* xc_POFS;
IElement* x10_SEED;
IElement* x14_LENG;
IElement* x18_WIDT;
IElement* x1c_MAXP;
IElement* x20_GRTE;
IElement* x24_COLR;
IElement* x28_LTME;
IElement* x2c_EMTR;
bool x30_24_LINE : 1;
bool x30_29_LIT_ : 1;
bool x30_25_FXLL : 1;
bool x30_26_AAPH : 1;
bool x30_27_ZBUF : 1;
bool x30_25_FXLL : 1;
bool x31_25_PMAB : 1;
bool x31_31_VMD4 : 1;
bool x31_30_VMD3 : 1;
bool x31_29_VMD2 : 1;
bool x31_28_VMD1 : 1;
bool x32_25_OPTS : 1;
bool x31_26_PMUS : 1;
bool x31_27_PMOO : 1;
bool x32_24_CIND : 1;
bool x30_28_SORT : 1;
bool x30_29_LIT_ : 1;
bool x30_30_ORNT : 1;
bool x30_31_RSOP : 1;
rstl::single_ptr< CIntElement > x34_MBSP;
rstl::single_ptr< CRealElement > x38_SIZE;
rstl::single_ptr< CRealElement > x3c_ROTA;
rstl::single_ptr< CUVElement > x40_TEXR;
rstl::single_ptr< CUVElement > x44_TIND;
TParticleModel x48_PMDL;
rstl::single_ptr< CVectorElement > x58_PMOP;
rstl::single_ptr< CVectorElement > x5c_PMRT;
rstl::single_ptr< CVectorElement > x60_PMSC;
rstl::single_ptr< CColorElement > x64_PMCL;
rstl::single_ptr< CModVectorElement > x68_VEL1;
rstl::single_ptr< CModVectorElement > x6c_VEL2;
rstl::single_ptr< CModVectorElement > x70_VEL3;
rstl::single_ptr< CModVectorElement > x74_VEL4;
TChildGeneratorDesc x78_ICTS;
rstl::single_ptr< CIntElement > x88_NCSY;
rstl::single_ptr< CIntElement > x8c_CSSD;
TChildGeneratorDesc x90_IDTS;
rstl::single_ptr< CIntElement > xa0_NDSY;
TChildGeneratorDesc xa4_IITS;
rstl::single_ptr< CIntElement > xb4_PISY;
rstl::single_ptr< CIntElement > xb8_SISY;
bool x31_24_MBLR : 1;
bool x31_25_PMAB : 1;
bool x31_26_PMUS : 1;
bool x31_27_PMOO : 1;
bool x31_28_VMD1 : 1;
bool x31_29_VMD2 : 1;
bool x31_30_VMD3 : 1;
bool x31_31_VMD4 : 1;
bool x32_25_OPTS : 1;
bool x32_24_CIND : 1;
IElement* x34_MBSP;
IElement* x38_SIZE;
IElement* x3c_ROTA;
IElement* x40_TEXR;
IElement* x44_TIND;
rstl::optional_object< TCachedToken< CModel > > x48_PMDL;
IElement* x58_PMOP;
IElement* x5c_PMRT;
IElement* x60_PMSC;
IElement* x64_PMCL;
IElement* x68_VEL1;
IElement* x6c_VEL2;
IElement* x70_VEL3;
IElement* x74_VEL4;
rstl::optional_object< TCachedToken< CGenDescription > > x78_ICTS;
IElement* x88_NCSY;
IElement* x8c_CSSD;
rstl::optional_object< TCachedToken< CGenDescription > > x90_IDTS;
IElement* xa0_NDSY;
rstl::optional_object< TCachedToken< CGenDescription > > xa4_IITS;
IElement* xb4_PISY;
IElement* xb8_SISY;
rstl::single_ptr< CSpawnSystemKeyframeData > xbc_KSSM;
TSwooshGeneratorDesc xc0_SSWH;
rstl::single_ptr< CIntElement > xd0_SSSD;
rstl::single_ptr< CVectorElement > xd4_SSPO;
TElectricGeneratorDesc xd8_SELC;
rstl::single_ptr< CIntElement > xe4_SESD;
rstl::single_ptr< CVectorElement > xe8_SEPO;
rstl::single_ptr< CIntElement > xec_LTYP;
rstl::single_ptr< CColorElement > xf0_LCLR;
rstl::single_ptr< CRealElement > xf4_LINT;
rstl::single_ptr< CVectorElement > xf8_LOFF;
rstl::single_ptr< CVectorElement > xfc_LDIR;
rstl::single_ptr< CIntElement > x100_LFOT;
rstl::single_ptr< CRealElement > x104_LFOR;
rstl::single_ptr< CRealElement > x108_LSLA;
rstl::single_ptr< CRealElement > x10c_ADV1;
rstl::single_ptr< CRealElement > x110_ADV2;
rstl::single_ptr< CRealElement > x114_ADV3;
rstl::single_ptr< CRealElement > x118_ADV4;
rstl::single_ptr< CRealElement > x11c_ADV5;
rstl::single_ptr< CRealElement > x120_ADV6;
rstl::single_ptr< CRealElement > x124_ADV7;
rstl::single_ptr< CRealElement > x128_ADV8;
rstl::optional_object< TCachedToken< CSwooshDescription > > xc0_SSWH;
IElement* xd0_SSSD;
IElement* xd4_SSPO;
rstl::optional_object< CToken > xd8_SELC;
IElement* xe4_SESD;
IElement* xe8_SEPO;
IElement* xec_LTYP;
IElement* xf0_LCLR;
IElement* xf4_LINT;
IElement* xf8_LOFF;
IElement* xfc_LDIR;
IElement* x100_LFOT;
IElement* x104_LFOR;
IElement* x108_LSLA;
IElement* x10c_ADV1;
IElement* x110_ADV2;
IElement* x114_ADV3;
IElement* x118_ADV4;
IElement* x11c_ADV5;
IElement* x120_ADV6;
IElement* x124_ADV7;
IElement* x128_ADV8;
};
CHECK_SIZEOF(CGenDescription, 0x12c)

View File

@ -0,0 +1,11 @@
#ifndef _CSPAWNSYSTEMKEYFRAMEDATA
#define _CSPAWNSYSTEMKEYFRAMEDATA
class CSpawnSystemKeyframeData {
~CSpawnSystemKeyframeData();
private:
char data[0x20];
};
#endif

View File

@ -0,0 +1,110 @@
#include "Kyoto/Particles/CGenDescription.hpp"
static IElement** element_from_desc(CGenDescription* gen, int idx) {
return reinterpret_cast< IElement** >(reinterpret_cast< uchar* >(gen) + idx);
}
static const size_t skGenOffsets[] = {
offsetof(CGenDescription, x0_PSLT), offsetof(CGenDescription, x4_PSWT),
offsetof(CGenDescription, x8_PSTS), offsetof(CGenDescription, xc_POFS),
offsetof(CGenDescription, x10_SEED), offsetof(CGenDescription, x14_LENG),
offsetof(CGenDescription, x18_WIDT), offsetof(CGenDescription, x1c_MAXP),
offsetof(CGenDescription, x20_GRTE), offsetof(CGenDescription, x24_COLR),
offsetof(CGenDescription, x28_LTME), offsetof(CGenDescription, x2c_EMTR),
offsetof(CGenDescription, x34_MBSP), offsetof(CGenDescription, x38_SIZE),
offsetof(CGenDescription, x3c_ROTA), offsetof(CGenDescription, x40_TEXR),
offsetof(CGenDescription, x44_TIND), offsetof(CGenDescription, x58_PMOP),
offsetof(CGenDescription, x5c_PMRT), offsetof(CGenDescription, x60_PMSC),
offsetof(CGenDescription, x64_PMCL), offsetof(CGenDescription, x68_VEL1),
offsetof(CGenDescription, x6c_VEL2), offsetof(CGenDescription, x70_VEL3),
offsetof(CGenDescription, x74_VEL4), offsetof(CGenDescription, x88_NCSY),
offsetof(CGenDescription, x8c_CSSD), offsetof(CGenDescription, xa0_NDSY),
offsetof(CGenDescription, xb4_PISY), offsetof(CGenDescription, xb8_SISY),
offsetof(CGenDescription, xd0_SSSD), offsetof(CGenDescription, xd4_SSPO),
offsetof(CGenDescription, xe4_SESD), offsetof(CGenDescription, xe8_SEPO),
offsetof(CGenDescription, xec_LTYP), offsetof(CGenDescription, xf0_LCLR),
offsetof(CGenDescription, xf4_LINT), offsetof(CGenDescription, xf8_LOFF),
offsetof(CGenDescription, xfc_LDIR), offsetof(CGenDescription, x100_LFOT),
offsetof(CGenDescription, x104_LFOR), offsetof(CGenDescription, x108_LSLA),
offsetof(CGenDescription, x10c_ADV1), offsetof(CGenDescription, x110_ADV2),
offsetof(CGenDescription, x114_ADV3), offsetof(CGenDescription, x118_ADV4),
offsetof(CGenDescription, x11c_ADV5), offsetof(CGenDescription, x120_ADV6),
offsetof(CGenDescription, x124_ADV7), offsetof(CGenDescription, x128_ADV8),
};
CGenDescription::CGenDescription()
: x0_PSLT(nullptr)
, x4_PSWT(nullptr)
, x8_PSTS(nullptr)
, xc_POFS(nullptr)
, x10_SEED(nullptr)
, x14_LENG(nullptr)
, x18_WIDT(nullptr)
, x1c_MAXP(nullptr)
, x20_GRTE(nullptr)
, x24_COLR(nullptr)
, x28_LTME(nullptr)
, x2c_EMTR(nullptr)
, x30_24_LINE(false)
, x30_25_FXLL(false)
, x30_26_AAPH(false)
, x30_27_ZBUF(false)
, x30_28_SORT(false)
, x30_29_LIT_(false)
, x30_30_ORNT(false)
, x30_31_RSOP(false)
, x31_24_MBLR(false)
, x31_25_PMAB(false)
, x31_26_PMUS(false)
, x31_27_PMOO(true)
, x31_28_VMD1(false)
, x31_29_VMD2(false)
, x31_30_VMD3(false)
, x31_31_VMD4(false)
, x32_24_CIND(false)
, x32_25_OPTS(false)
, x34_MBSP(nullptr)
, x38_SIZE(nullptr)
, x3c_ROTA(nullptr)
, x40_TEXR(nullptr)
, x44_TIND(nullptr)
, x58_PMOP(nullptr)
, x5c_PMRT(nullptr)
, x60_PMSC(nullptr)
, x64_PMCL(nullptr)
, x68_VEL1(nullptr)
, x6c_VEL2(nullptr)
, x70_VEL3(nullptr)
, x74_VEL4(nullptr)
, x88_NCSY(nullptr)
, x8c_CSSD(nullptr)
, xa0_NDSY(nullptr)
, xb4_PISY(nullptr)
, xb8_SISY(nullptr)
, xd0_SSSD(nullptr)
, xd4_SSPO(nullptr)
, xe4_SESD(nullptr)
, xe8_SEPO(nullptr)
, xec_LTYP(nullptr)
, xf0_LCLR(nullptr)
, xf4_LINT(nullptr)
, xf8_LOFF(nullptr)
, xfc_LDIR(nullptr)
, x100_LFOT(nullptr)
, x104_LFOR(nullptr)
, x108_LSLA(nullptr)
, x10c_ADV1(nullptr)
, x110_ADV2(nullptr)
, x114_ADV3(nullptr)
, x118_ADV4(nullptr)
, x11c_ADV5(nullptr)
, x120_ADV6(nullptr)
, x124_ADV7(nullptr)
, x128_ADV8(nullptr) {}
CGenDescription::~CGenDescription() {
for (int i = 0; i < (int)(sizeof(skGenOffsets) / sizeof(size_t)); ++i) {
delete *element_from_desc(this, skGenOffsets[i]);
}
}

View File

@ -0,0 +1,73 @@
#include "MetroidPrime/Weapons/CGameProjectile.hpp"
#include "Collision/CMaterialList.hpp"
#include "Kyoto/Math/CAABox.hpp"
#include "MetroidPrime/TCastTo.hpp"
#include "MetroidPrime/TGameTypes.hpp"
#include "MetroidPrime/Weapons/CProjectileWeapon.hpp"
#include "MetroidPrime/Weapons/CWeapon.hpp"
#include "rstl/math.hpp"
#include "rstl/optional_object.hpp"
#include <Collision/CMaterialFilter.hpp>
CTransform4f clear_transform(const CTransform4f& xf);
CGameProjectile::CGameProjectile(
const bool active, const TToken< CWeaponDescription >& wDesc, const rstl::string& name,
const EWeaponType wType, const CTransform4f& xf, const EMaterialTypes excludeMat,
const CDamageInfo& dInfo, const TUniqueId uid, const TAreaId aid, const TUniqueId owner,
const TUniqueId homingTarget, const uint attribs, const bool underwater, const CVector3f& scale,
const rstl::optional_object< TLockedToken< CGenDescription > >& visorParticle,
const ushort visorSfx, const bool sendCollideMsg)
: CWeapon(uid, aid, active, owner, wType, name, xf,
CMaterialFilter::MakeIncludeExclude(
CMaterialList(kMT_Solid, kMT_NonSolidDamageable),
CMaterialList(kMT_Projectile, kMT_ProjectilePassthrough, excludeMat)),
CMaterialList(kMT_Projectile), dInfo, attribs | GetBeamAttribType(wType),
CModelData::CModelDataNull())
, x158_visorParticle(visorParticle)
, x168_visorSfx(visorSfx)
, x170_projectile(wDesc, xf.GetTranslation(), clear_transform(xf), scale, (attribs >> 16) & 1)
, x298_previousPos(xf.GetTranslation())
, x2a4_projExtent((xe8_projectileAttribs & kPA_BigProjectile) == kPA_BigProjectile ? 0.25f : 0.1f)
, x2a8_homingDt(0.3f)
, x2b0_targetHomingTime(0.0)
, x2b8_curHomingTime(x2a8_homingDt)
, x2c0_homingTargetId(homingTarget)
, x2c2_lastResolvedObj(kInvalidUniqueId)
, x2c4_hitProjectileOwner(kInvalidUniqueId)
, x2c6_pendingDamagee(kInvalidUniqueId)
, x2c8_projectileLight(kInvalidUniqueId)
, x2cc_wpscId(wDesc.GetTag().GetId())
, x2e0_minHomingDist(0.f)
, x2e4_24_active(true)
, x2e4_25_startedUnderwater(underwater)
, x2e4_26_waterUpdate(underwater)
, x2e4_27_inWater(underwater)
, x2e4_28_sendProjectileCollideMsg(sendCollideMsg) {}
void CGameProjectile::Render(const CStateManager& mgr) const {
x170_projectile.Render();
CWeapon::Render(mgr);
}
CAABox CGameProjectile::GetProjectileBounds() const {
return CAABox(rstl::min_val(GetTranslation().GetX(), x298_previousPos.GetX()) - x2a4_projExtent,
rstl::min_val(GetTranslation().GetY(), x298_previousPos.GetY()) - x2a4_projExtent,
rstl::min_val(GetTranslation().GetZ(), x298_previousPos.GetZ()) - x2a4_projExtent,
rstl::max_val(GetTranslation().GetX(), x298_previousPos.GetX()) + x2a4_projExtent,
rstl::max_val(GetTranslation().GetY(), x298_previousPos.GetY()) + x2a4_projExtent,
rstl::max_val(GetTranslation().GetZ(), x298_previousPos.GetZ()) + x2a4_projExtent);
}
rstl::optional_object< CAABox > CGameProjectile::GetTouchBounds() const {
if (!x2e4_24_active) {
return rstl::optional_object_null();
}
return GetProjectileBounds();
}
CProjectileTouchResult CGameProjectile::CanCollideWithTrigger(CActor& act, CStateManager& mgr) {
}
void CGameProjectile::Accept(IVisitor& visitor) { visitor.Visit(*this); }