mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-08 15:44:56 +00:00
Initial CActorContraption and weapon imps
This commit is contained in:
@@ -10,7 +10,7 @@ public:
|
||||
CBeamProjectile(const TToken<CWeaponDescription>&, const std::string&, EWeaponType, const zeus::CTransform&, int,
|
||||
float, float, EMaterialTypes, const CDamageInfo&, TUniqueId, TAreaId, TUniqueId, u32, bool);
|
||||
|
||||
virtual void Accept(IVisitor &visitor);
|
||||
void Accept(IVisitor &visitor);
|
||||
float GetMaxRadius() const;
|
||||
zeus::CVector3f GetSurfaceNormal() const;
|
||||
void GetDamageType() const;
|
||||
|
||||
@@ -23,4 +23,13 @@ CFlameThrower::CFlameThrower(const TToken<CWeaponDescription>& wDesc, const std:
|
||||
void CFlameThrower::Accept(IVisitor& visitor) { visitor.Visit(this); }
|
||||
|
||||
void CFlameThrower::SetTransform(const zeus::CTransform& xf) { x2e8_ = xf; }
|
||||
|
||||
void CFlameThrower::Reset(CStateManager&, bool)
|
||||
{
|
||||
}
|
||||
|
||||
void CFlameThrower::Fire(const zeus::CTransform&, CStateManager&, bool)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,14 +14,25 @@ class CFlameThrower : public CGameProjectile
|
||||
zeus::CAABox x318_ = zeus::CAABox::skNullBox;
|
||||
TToken<CGenDescription> x33c_flameDesc;
|
||||
std::unique_ptr<CElementGen> x348_flameGen;
|
||||
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
bool x400_25 : 1;
|
||||
};
|
||||
u32 _dummy = 0;
|
||||
};
|
||||
public:
|
||||
CFlameThrower(const TToken<CWeaponDescription>& wDesc, const std::string& name, EWeaponType wType,
|
||||
const CFlameInfo& flameInfo, const zeus::CTransform& xf, EMaterialTypes matType,
|
||||
const CDamageInfo& dInfo, TUniqueId owner, TAreaId aId, TUniqueId uid, u32 w1);
|
||||
|
||||
void Accept(IVisitor &visitor);
|
||||
|
||||
void SetTransform(const zeus::CTransform& xf);
|
||||
void Reset(CStateManager&, bool);
|
||||
void Fire(const zeus::CTransform&, CStateManager&, bool);
|
||||
bool GetX400_25() const { return x400_25; }
|
||||
};
|
||||
}
|
||||
#endif // __URDE_CFLAMETHROWER_HPP__
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
#include "Weapon/CGameProjectile.hpp"
|
||||
#include "Graphics/CLight.hpp"
|
||||
#include "World/CGameLight.hpp"
|
||||
#include "CStateManager.hpp"
|
||||
#include "TCastTo.hpp"
|
||||
|
||||
namespace urde
|
||||
@@ -16,6 +19,35 @@ CGameProjectile::CGameProjectile(bool active, const TToken<CWeaponDescription>&,
|
||||
{
|
||||
}
|
||||
|
||||
void CGameProjectile::Accept(urde::IVisitor& visitor) { visitor.Visit(this); }
|
||||
|
||||
void CGameProjectile::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId /*uid*/, CStateManager& mgr)
|
||||
{
|
||||
if (msg == EScriptObjectMessage::InternalMessage15)
|
||||
{
|
||||
if (!x2e4_27_)
|
||||
{
|
||||
x2e4_27_ = true;
|
||||
x2e4_26_ = true;
|
||||
}
|
||||
}
|
||||
else if (msg == EScriptObjectMessage::InternalMessage16)
|
||||
{
|
||||
if (!x2e4_26_)
|
||||
x2e4_26_ = true;
|
||||
}
|
||||
else if (msg == EScriptObjectMessage::InternalMessage17)
|
||||
{
|
||||
if (x2e4_26_)
|
||||
{
|
||||
x2e4_26_ = false;
|
||||
x2e4_27_ = false;
|
||||
}
|
||||
}
|
||||
else if (msg == EScriptObjectMessage::Deleted)
|
||||
DeleteProjectileLight(mgr);
|
||||
}
|
||||
|
||||
CWeapon::EProjectileAttrib CGameProjectile::GetBeamAttribType(EWeaponType wType)
|
||||
{
|
||||
if (wType == EWeaponType::Ice)
|
||||
@@ -30,9 +62,25 @@ CWeapon::EProjectileAttrib CGameProjectile::GetBeamAttribType(EWeaponType wType)
|
||||
return EProjectileAttrib::None;
|
||||
}
|
||||
|
||||
void CGameProjectile::Accept(urde::IVisitor& visitor)
|
||||
void CGameProjectile::DeleteProjectileLight(CStateManager& mgr)
|
||||
{
|
||||
if (x2c8_projectileLight != kInvalidUniqueId)
|
||||
{
|
||||
mgr.FreeScriptObject(x2c8_projectileLight);
|
||||
x2c8_projectileLight = kInvalidUniqueId;
|
||||
}
|
||||
}
|
||||
|
||||
void CGameProjectile::CreateProjectileLight(const std::string& name, const CLight& light, CStateManager& mgr)
|
||||
{
|
||||
DeleteProjectileLight(mgr);
|
||||
x2c8_projectileLight = mgr.AllocateUniqueId();
|
||||
mgr.AddObject(new CGameLight(x2c8_projectileLight, GetAreaId(), GetActive(), name, GetTransform(), GetUniqueId(),
|
||||
light, x2cc_, 0, 0.f));
|
||||
}
|
||||
|
||||
void CGameProjectile::Chase(float dt, CStateManager& mgr)
|
||||
{
|
||||
visitor.Visit(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "World/CDamageInfo.hpp"
|
||||
#include "RetroTypes.hpp"
|
||||
#include "CToken.hpp"
|
||||
#include "Weapon/CProjectileWeapon.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
@@ -14,13 +15,31 @@ class CGenDescription;
|
||||
class CWeaponDescription;
|
||||
class CGameProjectile : public CWeapon
|
||||
{
|
||||
//CProjectileWeapon x170_;
|
||||
TUniqueId x2c8_projectileLight;
|
||||
u32 x2cc_;
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
bool x2e4_24_ : 1;
|
||||
bool x2e4_25_ : 1;
|
||||
bool x2e4_26_ : 1;
|
||||
bool x2e4_27_ : 1;
|
||||
bool x2e4_28_ : 1;
|
||||
};
|
||||
};
|
||||
public:
|
||||
CGameProjectile(bool, const TToken<CWeaponDescription>&, const std::string&, EWeaponType, const zeus::CTransform&,
|
||||
EMaterialTypes, const CDamageInfo&, TUniqueId, TAreaId, TUniqueId, TUniqueId, u32, bool,
|
||||
const zeus::CVector3f&, const rstl::optional_object<TLockedToken<CGenDescription>>&, s16, bool);
|
||||
|
||||
virtual void Accept(IVisitor &visitor);
|
||||
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager &);
|
||||
static EProjectileAttrib GetBeamAttribType(EWeaponType wType);
|
||||
void DeleteProjectileLight(CStateManager&);
|
||||
void CreateProjectileLight(const std::string&, const CLight&, CStateManager&);
|
||||
void Chase(float, CStateManager&);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
#include "CProjectileWeapon.hpp"
|
||||
#include "Particle/CWeaponDescription.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
CRandom16 CProjectileWeapon::g_GlobalSeed = 99;
|
||||
|
||||
CProjectileWeapon::CProjectileWeapon(const TToken<CWeaponDescription>& wDesc, const zeus::CVector3f&, const zeus::CTransform&,
|
||||
const zeus::CVector3f&, s32)
|
||||
: x4_weaponDesc(wDesc)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,17 +3,71 @@
|
||||
|
||||
#include "RetroTypes.hpp"
|
||||
#include "CRandom16.hpp"
|
||||
#include "CToken.hpp"
|
||||
#include "zeus/CVector3f.hpp"
|
||||
#include "Particle/CParticleSwoosh.hpp"
|
||||
#include "Particle/CElementGen.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
class CModel;
|
||||
class CWeaponDescription;
|
||||
class CProjectileWeapon
|
||||
{
|
||||
static CRandom16 g_GlobalSeed;
|
||||
TLockedToken<CWeaponDescription> x4_weaponDesc;
|
||||
CRandom16 x10_random;
|
||||
zeus::CTransform x14_;
|
||||
zeus::CTransform x44_;
|
||||
zeus::CVector3f x74_ = zeus::CVector3f::skZero;
|
||||
zeus::CVector3f x80_ = zeus::CVector3f::skZero;
|
||||
zeus::CVector3f x8c_ = zeus::CVector3f::skZero;
|
||||
zeus::CVector3f x98_ = zeus::CVector3f::skOne;
|
||||
zeus::CVector3f xa4_ = zeus::CVector3f::skZero;
|
||||
zeus::CVector3f xb0_ = zeus::CVector3f::skZero;
|
||||
zeus::CVector3f xbc_ = zeus::CVector3f::skZero;
|
||||
zeus::CColor xc8_ = zeus::CColor::skWhite;
|
||||
double xd0_ = 0.0;
|
||||
double xd8_ = 0.0;
|
||||
float xe0_;
|
||||
u32 xe4_;
|
||||
u32 xe8_lifetime = 0x7FFFFF;
|
||||
u32 xec_ = 0;
|
||||
u32 xf0_ = 0;
|
||||
u32 xf4_ = 0;
|
||||
u32 xf8_ = 0;
|
||||
u32 xfc_ = 0;
|
||||
std::unique_ptr<CElementGen> x104_particle1;
|
||||
std::unique_ptr<CElementGen> x104_particle2;
|
||||
TToken<CModel> x108_model;
|
||||
bool x114_hasModel = false;
|
||||
std::unique_ptr<CParticleSwoosh> x118_swoosh1;
|
||||
std::unique_ptr<CParticleSwoosh> x11c_swoosh2;
|
||||
std::unique_ptr<CParticleSwoosh> x120_swoosh3;
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
bool x124_24_ : 1;
|
||||
bool x124_25_ : 1;
|
||||
bool x124_26_ap11 : 1;
|
||||
bool x124_27_ap21 : 1;
|
||||
bool x124_28_as11 : 1;
|
||||
bool x124_29_as12 : 1;
|
||||
bool x124_30_as13 : 1;
|
||||
};
|
||||
u32 _dummy = 0;
|
||||
};
|
||||
|
||||
public:
|
||||
CProjectileWeapon(const TToken<CWeaponDescription>& wDesc, const zeus::CVector3f&, const zeus::CTransform&,
|
||||
const zeus::CVector3f&, s32);
|
||||
void GetTransform();
|
||||
void Update(float);
|
||||
void UpdateParticleFx();
|
||||
void UpdateChildParticleSystems(float);
|
||||
static void SetGlobalSeed(u16 seed) { g_GlobalSeed.SetSeed(seed); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __URDE_CPROJECTILEWEAPON_HPP__
|
||||
|
||||
@@ -6,10 +6,11 @@ namespace urde
|
||||
{
|
||||
|
||||
CWeapon::CWeapon(TUniqueId uid, TAreaId aid, bool active, TUniqueId, EWeaponType, const std::string& name,
|
||||
const zeus::CTransform& xf, const CMaterialFilter&, const CMaterialList& mList, const CDamageInfo&,
|
||||
const zeus::CTransform& xf, const CMaterialFilter& filter, const CMaterialList& mList, const CDamageInfo&,
|
||||
EProjectileAttrib, CModelData&& mData)
|
||||
: CActor(uid, active, name, CEntityInfo(aid, CEntity::NullConnectionList), xf, std::move(mData), mList,
|
||||
CActorParameters::None(), kInvalidUniqueId)
|
||||
, xf8_(filter)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "World/CActor.hpp"
|
||||
#include "Weapon/WeaponCommon.hpp"
|
||||
#include "World/CDamageInfo.hpp"
|
||||
#include "Collision/CMaterialFilter.hpp"
|
||||
|
||||
namespace urde
|
||||
@@ -24,6 +25,17 @@ public:
|
||||
|
||||
private:
|
||||
EProjectileAttrib xe8_projectileAttribs;
|
||||
TUniqueId xec_uid;
|
||||
EWeaponType xf0_weaponType;
|
||||
u32 xf4_;
|
||||
CMaterialFilter xf8_;
|
||||
u32 x10c_;
|
||||
CDamageInfo x110_;
|
||||
CDamageInfo x12c_;
|
||||
float x148_;
|
||||
float x14c_;
|
||||
float x150_;
|
||||
float x154_;
|
||||
public:
|
||||
CWeapon(TUniqueId, TAreaId, bool, TUniqueId, EWeaponType, const std::string&, const zeus::CTransform&,
|
||||
const CMaterialFilter&, const CMaterialList&, const CDamageInfo&, EProjectileAttrib, CModelData&&);
|
||||
|
||||
Reference in New Issue
Block a user