mirror of https://github.com/AxioDL/metaforce.git
Merge branch 'master' of https://github.com/AxioDL/urde
This commit is contained in:
commit
c8d09f3de7
|
@ -27,7 +27,7 @@ namespace urde
|
|||
|
||||
void ViewManager::BuildTestPART(urde::IObjectStore& objStore)
|
||||
{
|
||||
m_modelTest = objStore.GetObj("MP1/Shared/CMDL_B2B41738.blend");
|
||||
// m_modelTest = objStore.GetObj("MP1/Shared/CMDL_B2B41738.blend");
|
||||
#if 0
|
||||
SObjectTag samusCharSet = m_projManager.TagFromPath(_S("MP1/Shared/ANCS_77289A4A.*"));
|
||||
SObjectTag platModel = m_projManager.TagFromPath(_S("MP1/Shared/CMDL_6FA561D0.blend"));
|
||||
|
|
|
@ -15,41 +15,41 @@
|
|||
|
||||
enum class EUserEventType
|
||||
{
|
||||
Projectile,
|
||||
EggLay,
|
||||
LoopedSoundStop,
|
||||
AlignTargetPos,
|
||||
AlignTargetRot,
|
||||
ChangeMaterial,
|
||||
Delete,
|
||||
GenerateEnd,
|
||||
DamageOn,
|
||||
DamageOff,
|
||||
AlignTargetPosStart,
|
||||
DeGenerate,
|
||||
Landing,
|
||||
TakeOff,
|
||||
FadeIn,
|
||||
FadeOut,
|
||||
ScreenShake,
|
||||
BeginAction,
|
||||
EndAction,
|
||||
BecomeRagDoll,
|
||||
IkLock,
|
||||
IkRelease,
|
||||
BreakLockOn,
|
||||
BecomeShootThrough,
|
||||
RemoveCollision,
|
||||
ObjectPickUp,
|
||||
ObjectDrop,
|
||||
EventStart,
|
||||
EventStop,
|
||||
Activate,
|
||||
Deactivate,
|
||||
SoundPlay,
|
||||
SoundStop,
|
||||
EffectOn,
|
||||
EffectOff
|
||||
Projectile = 0,
|
||||
EggLay = 1,
|
||||
LoopedSoundStop = 2,
|
||||
AlignTargetPos = 3,
|
||||
AlignTargetRot = 4,
|
||||
ChangeMaterial = 5,
|
||||
Delete = 6,
|
||||
GenerateEnd = 7,
|
||||
DamageOn = 8,
|
||||
DamageOff = 9,
|
||||
AlignTargetPosStart = 10,
|
||||
DeGenerate = 11,
|
||||
Landing = 12,
|
||||
TakeOff = 13,
|
||||
FadeIn = 14,
|
||||
FadeOut = 15,
|
||||
ScreenShake = 16,
|
||||
BeginAction = 17,
|
||||
EndAction = 18,
|
||||
BecomeRagDoll = 19,
|
||||
IkLock = 20,
|
||||
IkRelease = 21,
|
||||
BreakLockOn = 22,
|
||||
BecomeShootThrough = 23,
|
||||
RemoveCollision = 24,
|
||||
ObjectPickUp = 25,
|
||||
ObjectDrop = 26,
|
||||
EventStart = 27,
|
||||
EventStop = 28,
|
||||
Activate = 29,
|
||||
Deactivate = 30,
|
||||
SoundPlay = 31,
|
||||
SoundStop = 32,
|
||||
EffectOn = 33,
|
||||
EffectOff = 34
|
||||
};
|
||||
|
||||
namespace urde
|
||||
|
|
|
@ -41,7 +41,7 @@ class CLight
|
|||
float x30_angleC;
|
||||
float x34_angleL;
|
||||
float x38_angleQ;
|
||||
u32 x3c_ = 0;
|
||||
u32 x3c_priority = 0;
|
||||
u32 x40_loadedIdx = 0;
|
||||
float x44_cachedRadius;
|
||||
float x48_cachedIntensity;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "MP1/World/CActorContraption.hpp"
|
||||
#include "Weapon/CFlameThrower.hpp"
|
||||
#include "Character/CInt32POINode.hpp"
|
||||
#include "GameGlobalObjects.hpp"
|
||||
#include "CSimplePool.hpp"
|
||||
#include "CStateManager.hpp"
|
||||
|
@ -30,14 +31,38 @@ void MP1::CActorContraption::Think(float dt, CStateManager& mgr)
|
|||
{
|
||||
CScriptActor::Think(dt, mgr);
|
||||
|
||||
for (const std::pair<TUniqueId, std::string>& uid : x2ec_children)
|
||||
for (const std::pair<TUniqueId, std::string>& uid : x2e4_children)
|
||||
{
|
||||
CFlameThrower* act = static_cast<CFlameThrower*>(mgr.ObjectById(uid.first));
|
||||
|
||||
if (act && act->GetActive())
|
||||
{
|
||||
act->SetTransform(x34_transform * act->GetScaledLocatorTransform(uid.second));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MP1::CActorContraption::DoUserAnimEvent(CStateManager& mgr, CInt32POINode& node, EUserEventType evType)
|
||||
{
|
||||
if (evType == EUserEventType::DamageOff)
|
||||
{
|
||||
for (const std::pair<TUniqueId, std::string>& uid : x2e4_children)
|
||||
{
|
||||
CFlameThrower* act = static_cast<CFlameThrower*>(mgr.ObjectById(uid.first));
|
||||
if (act && act->GetX400_25())
|
||||
act->Reset(mgr, false);
|
||||
}
|
||||
}
|
||||
else if (evType == EUserEventType::DamageOn)
|
||||
{
|
||||
CFlameThrower* fl = CreateFlameThrower(node.GetLocatorName(), mgr);
|
||||
if (fl && fl->GetX400_25())
|
||||
fl->Fire(GetTransform(), mgr, false);
|
||||
}
|
||||
else
|
||||
CActor::DoUserAnimEvent(mgr, node, evType);
|
||||
}
|
||||
|
||||
CFlameThrower* MP1::CActorContraption::CreateFlameThrower(const std::string&, CStateManager&)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,12 +6,13 @@
|
|||
|
||||
namespace urde
|
||||
{
|
||||
class CFlameThrower;
|
||||
namespace MP1
|
||||
{
|
||||
class CActorContraption : public CScriptActor
|
||||
{
|
||||
/* AKA Why Zoid?!?!?!? */
|
||||
std::vector<std::pair<TUniqueId, std::string>> x2ec_children;
|
||||
std::vector<std::pair<TUniqueId, std::string>> x2e4_children;
|
||||
TToken<CGenDescription> x300_flameThrowerGen;
|
||||
ResId x308_partId;
|
||||
CDamageInfo x30c_dInfo;
|
||||
|
@ -23,6 +24,8 @@ public:
|
|||
void Accept(IVisitor &visitor);
|
||||
|
||||
void Think(float, CStateManager &);
|
||||
void DoUserAnimEvent(CStateManager &, CInt32POINode &, EUserEventType);
|
||||
CFlameThrower* CreateFlameThrower(const std::string&, CStateManager&);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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&&);
|
||||
|
|
|
@ -10,7 +10,7 @@ CGameLight::CGameLight(TUniqueId uid, TAreaId aid, bool active, const std::strin
|
|||
TUniqueId parentId, const CLight& light, u32 w1, u32 w2, float f1)
|
||||
: CActor(uid, active, name, CEntityInfo(aid, CEntity::NullConnectionList), xf,
|
||||
CModelData::CModelDataNull(), CMaterialList(), CActorParameters::None(), kInvalidUniqueId),
|
||||
xe8_parentId(parentId), xec_light(light), x13c_(w1), x140_(w2), x144_lifeTime(f1)
|
||||
xe8_parentId(parentId), xec_light(light), x13c_loadedIdx(w1), x140_priority(w2), x144_lifeTime(f1)
|
||||
{
|
||||
xec_light.GetRadius();
|
||||
xec_light.GetIntensity();
|
||||
|
@ -34,8 +34,8 @@ void CGameLight::Think(float dt, CStateManager& mgr)
|
|||
|
||||
void CGameLight::SetLightPriorityAndId()
|
||||
{
|
||||
xec_light.x3c_ = x140_;
|
||||
xec_light.x40_loadedIdx = x13c_;
|
||||
xec_light.x3c_priority = x140_priority;
|
||||
xec_light.x40_loadedIdx = x13c_loadedIdx;
|
||||
}
|
||||
|
||||
void CGameLight::SetLight(const CLight& light)
|
||||
|
|
|
@ -9,8 +9,8 @@ class CGameLight : public CActor
|
|||
{
|
||||
TUniqueId xe8_parentId;
|
||||
CLight xec_light;
|
||||
u32 x13c_;
|
||||
u32 x140_;
|
||||
u32 x13c_loadedIdx;
|
||||
u32 x140_priority;
|
||||
float x144_lifeTime;
|
||||
|
||||
public:
|
||||
|
|
Loading…
Reference in New Issue