mirror of https://github.com/AxioDL/metaforce.git
Initial CPatterned classes
This commit is contained in:
parent
b60d55d784
commit
57775d31bf
|
@ -16,4 +16,8 @@ void CSfxManager::UpdateListener(const zeus::CVector3f& pos, const zeus::CVector
|
|||
{
|
||||
}
|
||||
|
||||
u16 CSfxManager::TranslateSFXID(u16)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -137,6 +137,8 @@ public:
|
|||
static void UpdateListener(const zeus::CVector3f& pos, const zeus::CVector3f& dir,
|
||||
const zeus::CVector3f& heading, const zeus::CVector3f& up,
|
||||
u8 vol);
|
||||
|
||||
static u16 TranslateSFXID(u16);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ set(MP1_SOURCES
|
|||
CMFGame.hpp CMFGame.cpp
|
||||
CPlayMovie.hpp CPlayMovie.cpp
|
||||
CFrontEndUI.hpp CFrontEndUI.cpp
|
||||
CNewIntroBoss.hpp CNewIntroBoss.cpp
|
||||
MP1.hpp MP1.cpp)
|
||||
|
||||
runtime_add_list(MP1 MP1_SOURCES)
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
#include "CNewIntroBoss.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
namespace MP1
|
||||
{
|
||||
|
||||
CNewIntroBoss::CNewIntroBoss(TUniqueId uid, const std::string& name, const CEntityInfo& info,
|
||||
const zeus::CTransform& xf, CModelData&& mData, const CPatternedInfo& pInfo,
|
||||
const CActorParameters& actParms, float, u32, const CDamageInfo& dInfo,
|
||||
u32, u32, u32, u32)
|
||||
: CPatterned(EUnknown::TwentyThree, uid, name, EFlavorType::Zero, info, xf, std::move(mData), pInfo,
|
||||
EMovementType::One, EColliderType::Flyer, EBodyType::Two, actParms)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
#ifndef __URDE_MP1_CNEWINTROBOSS_HPP__
|
||||
#define __URDE_MP1_CNEWINTROBOSS_HPP__
|
||||
|
||||
#include "World/CPatterned.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
class CDamageInfo;
|
||||
|
||||
namespace MP1
|
||||
{
|
||||
|
||||
class CNewIntroBoss : public CPatterned
|
||||
{
|
||||
public:
|
||||
CNewIntroBoss(TUniqueId uid, const std::string& name, const CEntityInfo& info,
|
||||
const zeus::CTransform& xf, CModelData&& mData, const CPatternedInfo& pInfo,
|
||||
const CActorParameters& actParms, float, u32, const CDamageInfo& dInfo,
|
||||
u32, u32, u32, u32);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __URDE_MP1_CNEWINTROBOSS_HPP__
|
|
@ -7,6 +7,7 @@
|
|||
#include "CEntity.hpp"
|
||||
#include "CPhysicsActor.hpp"
|
||||
#include "CDamageVulnerability.hpp"
|
||||
#include "CHealthInfo.hpp"
|
||||
|
||||
#include "zeus/zeus.hpp"
|
||||
|
||||
|
@ -38,14 +39,6 @@ public:
|
|||
CAiTriggerFunc GetTriggerFunc(const char*);
|
||||
};
|
||||
|
||||
class CHealthInfo
|
||||
{
|
||||
float x0_;
|
||||
float x4_;
|
||||
public:
|
||||
CHealthInfo(CInputStream& in) : x0_(in.readFloatBig()), x4_(in.readFloatBig()) {}
|
||||
};
|
||||
|
||||
class CStateManager;
|
||||
class CAi : public CPhysicsActor
|
||||
{
|
||||
|
@ -56,8 +49,8 @@ class CAi : public CPhysicsActor
|
|||
public:
|
||||
|
||||
CAi(TUniqueId uid, bool active, const std::string& name, const CEntityInfo& info, const zeus::CTransform& xf,
|
||||
CModelData&& mData, const zeus::CAABox& box, float f1, const CHealthInfo& hInfo, const CDamageVulnerability&,
|
||||
const CMaterialList& list, ResId, const CActorParameters&, float f2, float f3);
|
||||
CModelData&& mData, const zeus::CAABox& box, float f1, const CHealthInfo& hInfo, const CDamageVulnerability&,
|
||||
const CMaterialList& list, ResId, const CActorParameters&, float f2, float f3);
|
||||
|
||||
static void CreateFuncLookup(CAiFuncMap* funcMap);
|
||||
CAiStateFunc GetStateFunc(const char* func);
|
||||
|
|
|
@ -14,6 +14,10 @@ public:
|
|||
u32 x8_defaultAnim;
|
||||
CAnimationParameters(ResId ancs, s32 charIdx, u32 defaultAnim)
|
||||
: x0_ancs(ancs), x4_charIdx(charIdx), x8_defaultAnim(defaultAnim) {}
|
||||
CAnimationParameters(CInputStream& in)
|
||||
: x0_ancs(in.readUint32Big()),
|
||||
x4_charIdx(in.readUint32Big()),
|
||||
x8_defaultAnim(in.readUint32Big()) {}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
#include "CHealthInfo.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
CHealthInfo::CHealthInfo(CInputStream& in)
|
||||
: x0_health(in.readFloatBig()),
|
||||
x4_knockbackResistance(in.readFloatBig()) {}
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
#ifndef __URDE_CHEALTHINFO_HPP__
|
||||
#define __URDE_CHEALTHINFO_HPP__
|
||||
|
||||
#include "RetroTypes.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
class CHealthInfo
|
||||
{
|
||||
float x0_health;
|
||||
float x4_knockbackResistance;
|
||||
public:
|
||||
CHealthInfo(CInputStream& in);
|
||||
float GetHealth() const {return x0_health;}
|
||||
float GetKnockbackResistance() const {return x4_knockbackResistance;}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __URDE_CHEALTHINFO_HPP__
|
|
@ -39,6 +39,9 @@ set(WORLD_SOURCES
|
|||
CDamageInfo.hpp
|
||||
CDamageVulnerability.hpp
|
||||
CFluidUVMotion.hpp CFluidUVMotion.cpp
|
||||
CPatternedInfo.hpp CPatternedInfo.cpp
|
||||
CHealthInfo.hpp CHealthInfo.cpp
|
||||
CPatterned.hpp CPatterned.cpp
|
||||
CFluidPlane.hpp)
|
||||
|
||||
runtime_add_list(World WORLD_SOURCES)
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
#include "CPatterned.hpp"
|
||||
#include "CPatternedInfo.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
CMaterialList gkPatternedGroundMaterialList;
|
||||
CMaterialList gkPatternedFlyerMaterialList;
|
||||
|
||||
CPatterned::CPatterned(EUnknown, TUniqueId uid, const std::string& name, EFlavorType, const CEntityInfo& info,
|
||||
const zeus::CTransform& xf, CModelData&& mData,
|
||||
const CPatternedInfo& pInfo, EMovementType, EColliderType colType,
|
||||
EBodyType, const CActorParameters& actParms)
|
||||
: CAi(uid, pInfo.xf8_active, name, info, xf, std::move(mData),
|
||||
zeus::CAABox(pInfo.xcc_bodyOrigin - zeus::CVector3f{pInfo.xc4_halfExtent, pInfo.xc4_halfExtent, 0.f},
|
||||
pInfo.xcc_bodyOrigin + zeus::CVector3f{pInfo.xc4_halfExtent, pInfo.xc4_halfExtent, pInfo.xc8_height}),
|
||||
pInfo.x0_mass, pInfo.x54_healthInfo, pInfo.x5c_damageVulnerability,
|
||||
colType == EColliderType::Flyer ? gkPatternedFlyerMaterialList : gkPatternedGroundMaterialList,
|
||||
pInfo.xfc_stateMachineId, actParms, pInfo.xd8_, 0.8f)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
#ifndef __URDE_CPATTERNED_HPP__
|
||||
#define __URDE_CPATTERNED_HPP__
|
||||
|
||||
#include "CAi.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
class CPatternedInfo;
|
||||
|
||||
enum class EBodyType
|
||||
{
|
||||
Two = 2
|
||||
};
|
||||
|
||||
class CPatterned : public CAi
|
||||
{
|
||||
public:
|
||||
enum class EUnknown
|
||||
{
|
||||
TwentyThree = 23
|
||||
};
|
||||
enum class EFlavorType
|
||||
{
|
||||
Zero = 0
|
||||
};
|
||||
enum class EMovementType
|
||||
{
|
||||
One = 1
|
||||
};
|
||||
enum class EColliderType
|
||||
{
|
||||
Ground = 0,
|
||||
Flyer = 1
|
||||
};
|
||||
private:
|
||||
public:
|
||||
CPatterned(EUnknown, TUniqueId, const std::string& name, EFlavorType, const CEntityInfo& info,
|
||||
const zeus::CTransform& xf, CModelData&& mData,
|
||||
const CPatternedInfo& pInfo, EMovementType, EColliderType,
|
||||
EBodyType, const CActorParameters& actParms);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __URDE_CPATTERNED_HPP__
|
|
@ -0,0 +1,60 @@
|
|||
#include "CPatternedInfo.hpp"
|
||||
#include "Audio/CSfxManager.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
CPatternedInfo::CPatternedInfo(CInputStream& in, u32 pcount)
|
||||
: x0_mass(in.readFloatBig()),
|
||||
x4_speed(in.readFloatBig()),
|
||||
x8_turnSpeed(in.readFloatBig()),
|
||||
xc_detectionRange(in.readFloatBig()),
|
||||
x10_detectionHeightRange(in.readFloatBig()),
|
||||
x14_dectectionAngle(in.readFloatBig()),
|
||||
x18_minAttackRange(in.readFloatBig()),
|
||||
x1c_maxAttackRange(in.readFloatBig()),
|
||||
x20_averageAttackTime(in.readFloatBig()),
|
||||
x24_attackTimeVariation(in.readFloatBig()),
|
||||
x28_leashRadius(in.readFloatBig()),
|
||||
x2c_playerLeashRadius(in.readFloatBig()),
|
||||
x30_playerLeashTime(in.readFloatBig()),
|
||||
x34_damageInfo(in),
|
||||
x50_damageWaitTime(in.readFloatBig()),
|
||||
x54_healthInfo(in),
|
||||
x5c_damageVulnerability(in),
|
||||
xc4_halfExtent(in.readFloatBig()),
|
||||
xc8_height(in.readFloatBig()),
|
||||
xcc_bodyOrigin(zeus::CVector3f::ReadBig(in)),
|
||||
xd8_(in.readFloatBig()),
|
||||
xdc_(in.readFloatBig()),
|
||||
xe0_(in.readFloatBig()),
|
||||
xe4_(in.readFloatBig()),
|
||||
xe8_sfxId(CSfxManager::TranslateSFXID(in.readUint32Big())),
|
||||
xec_animParams(in),
|
||||
xf8_active(in.readBool()),
|
||||
xfc_stateMachineId(in.readUint32Big()),
|
||||
x100_(in.readFloatBig()),
|
||||
x104_(in.readFloatBig()),
|
||||
x108_(in.readFloatBig()),
|
||||
x10c_particle1Frames(in.readUint32Big()),
|
||||
x110_particle1Scale(zeus::CVector3f::ReadBig(in)),
|
||||
x11c_particle1(in.readUint32Big()),
|
||||
x120_particle2Frames(in.readUint32Big())
|
||||
{
|
||||
if (pcount >= 36)
|
||||
x124_particle2Scale.readBig(in);
|
||||
if (pcount >= 37)
|
||||
x130_particle2 = in.readUint32Big();
|
||||
if (pcount >= 38)
|
||||
x134_sfxId2 = CSfxManager::TranslateSFXID(in.readUint32Big());
|
||||
}
|
||||
|
||||
std::pair<bool, u32> CPatternedInfo::HasCorrectParameterCount(CInputStream& in)
|
||||
{
|
||||
u32 pcount = in.readUint32Big();
|
||||
if (pcount < 35 || pcount > 38)
|
||||
return {false, pcount};
|
||||
return {true, pcount};
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
#ifndef __URDE_CPATTERNEDINFO_HPP__
|
||||
#define __URDE_CPATTERNEDINFO_HPP__
|
||||
|
||||
#include "RetroTypes.hpp"
|
||||
#include "CDamageInfo.hpp"
|
||||
#include "CHealthInfo.hpp"
|
||||
#include "CDamageVulnerability.hpp"
|
||||
#include "CAnimationParameters.hpp"
|
||||
#include "zeus/CVector3f.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
class CPatternedInfo
|
||||
{
|
||||
friend class CPatterned;
|
||||
float x0_mass;
|
||||
float x4_speed;
|
||||
float x8_turnSpeed;
|
||||
float xc_detectionRange;
|
||||
float x10_detectionHeightRange;
|
||||
float x14_dectectionAngle;
|
||||
float x18_minAttackRange;
|
||||
float x1c_maxAttackRange;
|
||||
float x20_averageAttackTime;
|
||||
float x24_attackTimeVariation;
|
||||
float x28_leashRadius;
|
||||
float x2c_playerLeashRadius;
|
||||
float x30_playerLeashTime;
|
||||
CDamageInfo x34_damageInfo;
|
||||
float x50_damageWaitTime;
|
||||
CHealthInfo x54_healthInfo;
|
||||
CDamageVulnerability x5c_damageVulnerability;
|
||||
float xc4_halfExtent;
|
||||
float xc8_height;
|
||||
zeus::CVector3f xcc_bodyOrigin;
|
||||
float xd8_;
|
||||
float xdc_;
|
||||
float xe0_;
|
||||
float xe4_;
|
||||
u16 xe8_sfxId;
|
||||
CAnimationParameters xec_animParams;
|
||||
bool xf8_active;
|
||||
ResId xfc_stateMachineId;
|
||||
float x100_;
|
||||
float x104_;
|
||||
float x108_;
|
||||
|
||||
u32 x10c_particle1Frames;
|
||||
zeus::CVector3f x110_particle1Scale;
|
||||
ResId x11c_particle1;
|
||||
|
||||
u32 x120_particle2Frames;
|
||||
zeus::CVector3f x124_particle2Scale;
|
||||
ResId x130_particle2 = -1;
|
||||
|
||||
u16 x134_sfxId2 = -1;
|
||||
|
||||
public:
|
||||
CPatternedInfo(CInputStream& in, u32 pcount);
|
||||
static std::pair<bool, u32> HasCorrectParameterCount(CInputStream& in);
|
||||
|
||||
const CAnimationParameters& GetAnimationParameters() const {return xec_animParams;}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __URDE_CPATTERNEDINFO_HPP__
|
|
@ -28,6 +28,8 @@
|
|||
#include "CScriptAreaAttributes.hpp"
|
||||
#include "CScriptCameraWaypoint.hpp"
|
||||
#include "Camera/CCinematicCamera.hpp"
|
||||
#include "MP1/CNewIntroBoss.hpp"
|
||||
#include "CPatternedInfo.hpp"
|
||||
#include "CSimplePool.hpp"
|
||||
#include "Collision/CCollidableOBBTreeGroup.hpp"
|
||||
#include "Editor/ProjectResourceFactoryMP1.hpp"
|
||||
|
@ -781,6 +783,43 @@ CEntity* ScriptLoader::LoadCameraWaypoint(CStateManager& mgr, CInputStream& in,
|
|||
CEntity* ScriptLoader::LoadNewIntroBoss(CStateManager& mgr, CInputStream& in,
|
||||
int propCount, const CEntityInfo& info)
|
||||
{
|
||||
if (!EnsurePropertyCount(propCount, 13, "NewIntroBoss"))
|
||||
return nullptr;
|
||||
|
||||
SScaledActorHead head = LoadScaledActorHead(in, mgr);
|
||||
|
||||
std::pair<bool, u32> pcount = CPatternedInfo::HasCorrectParameterCount(in);
|
||||
if (!pcount.first)
|
||||
return nullptr;
|
||||
|
||||
CPatternedInfo pInfo(in, pcount.second);
|
||||
|
||||
CActorParameters actParms = LoadActorParameters(in);
|
||||
|
||||
float f1 = in.readFloatBig();
|
||||
u32 w1 = in.readUint32Big();
|
||||
|
||||
CDamageInfo dInfo(in);
|
||||
|
||||
u32 w2 = in.readUint32Big();
|
||||
u32 w3 = in.readUint32Big();
|
||||
u32 w4 = in.readUint32Big();
|
||||
u32 w5 = in.readUint32Big();
|
||||
|
||||
const CAnimationParameters& animParms = pInfo.GetAnimationParameters();
|
||||
if (animParms.x0_ancs < 0)
|
||||
return nullptr;
|
||||
|
||||
CAnimRes res;
|
||||
res.x0_ancsId = animParms.x0_ancs;
|
||||
res.x4_charIdx = animParms.x4_charIdx;
|
||||
res.x8_scale = head.x40_scale;
|
||||
res.x14_ = true;
|
||||
res.x1c_defaultAnim = animParms.x8_defaultAnim;
|
||||
|
||||
return new MP1::CNewIntroBoss(mgr.AllocateUniqueId(), head.x0_name, info,
|
||||
head.x10_transform, res, pInfo, actParms, f1, w1,
|
||||
dInfo, w2, w3, w4, w5);
|
||||
}
|
||||
|
||||
CEntity* ScriptLoader::LoadSpawnPoint(CStateManager& mgr, CInputStream& in,
|
||||
|
|
2
specter
2
specter
|
@ -1 +1 @@
|
|||
Subproject commit c72304bae2d84106e2474fb08acdd9b127b76d7f
|
||||
Subproject commit 633c50fe33deb153a3e28d0e66ede01832741f62
|
Loading…
Reference in New Issue