2019-11-19 23:06:25 +00:00
|
|
|
#pragma once
|
|
|
|
|
2019-12-14 23:50:29 +00:00
|
|
|
#include <Collision/CJointCollisionDescription.hpp>
|
2019-11-19 23:06:25 +00:00
|
|
|
#include "Runtime/World/CPatterned.hpp"
|
|
|
|
#include "Runtime/World/CPathFindSearch.hpp"
|
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
namespace metaforce {
|
2019-11-19 23:06:25 +00:00
|
|
|
class CCollisionActorManager;
|
|
|
|
namespace MP1 {
|
|
|
|
class CThardus : public CPatterned {
|
2020-01-06 04:24:54 +00:00
|
|
|
|
|
|
|
enum class EUpdateMaterialMode { Add, Remove };
|
|
|
|
|
2019-11-19 23:06:25 +00:00
|
|
|
class CThardusSomething {
|
|
|
|
TUniqueId x0_ = kInvalidUniqueId;
|
|
|
|
zeus::CVector3f x4_;
|
2020-04-21 07:22:41 +00:00
|
|
|
bool x10_24_ : 1 = false;
|
2019-11-19 23:06:25 +00:00
|
|
|
|
|
|
|
public:
|
2020-04-21 07:22:41 +00:00
|
|
|
CThardusSomething() = default;
|
2019-11-19 23:06:25 +00:00
|
|
|
};
|
|
|
|
u32 x568_;
|
|
|
|
TUniqueId x56c_ = kInvalidUniqueId;
|
2020-03-01 01:11:41 +00:00
|
|
|
u32 x570_ = 0;
|
2020-09-07 00:18:46 +00:00
|
|
|
u32 x574_ = 0;
|
|
|
|
rstl::reserved_vector<rstl::reserved_vector<TUniqueId, 16>, 2> x578_waypoints;
|
2020-07-28 11:07:11 +00:00
|
|
|
s32 x5c4_ = 1;
|
2019-12-14 23:50:29 +00:00
|
|
|
bool x5c8_heardPlayer = false;
|
|
|
|
/* NOTE(phil) These two vectors used to vectors of CModelData, They have been converted to vectors of CStaticRes due
|
|
|
|
* to the use of move semantics to prevent deep copies */
|
2019-11-24 15:01:07 +00:00
|
|
|
std::vector<CStaticRes> x5cc_;
|
|
|
|
std::vector<CStaticRes> x5dc_;
|
2019-11-19 23:06:25 +00:00
|
|
|
s32 x5ec_ = -1;
|
2020-01-06 04:24:54 +00:00
|
|
|
std::unique_ptr<CCollisionActorManager> x5f0_rockColliders;
|
2019-11-19 23:06:25 +00:00
|
|
|
std::unique_ptr<CCollisionActorManager> x5f4_;
|
|
|
|
std::unique_ptr<CCollisionActorManager> x5f8_;
|
2020-01-06 04:24:54 +00:00
|
|
|
TUniqueId x5fc_projectileId = kInvalidUniqueId;
|
2019-11-19 23:06:25 +00:00
|
|
|
CAssetId x600_;
|
|
|
|
CAssetId x604_;
|
|
|
|
CAssetId x608_;
|
2020-01-06 04:24:54 +00:00
|
|
|
TEditorId x60c_projectileEditorId = kInvalidEditorId;
|
2019-12-14 23:50:29 +00:00
|
|
|
std::vector<TUniqueId> x610_destroyableRocks;
|
2019-11-19 23:06:25 +00:00
|
|
|
u32 x624_;
|
|
|
|
u32 x628_;
|
|
|
|
u32 x62c_;
|
|
|
|
CAssetId x630_;
|
2020-01-06 04:24:54 +00:00
|
|
|
std::vector<TUniqueId> x634_nonDestroyableActors;
|
2019-11-19 23:06:25 +00:00
|
|
|
s32 x644_ = -1;
|
2020-01-06 04:24:54 +00:00
|
|
|
u32 x648_currentRock = 0;
|
|
|
|
TUniqueId x64c_fog = kInvalidUniqueId;
|
2019-11-19 23:06:25 +00:00
|
|
|
zeus::CVector2f x650_ = zeus::CVector2f(0.f, 1.f);
|
|
|
|
s32 x658_ = -1;
|
|
|
|
s32 x65c_ = -1;
|
2020-09-07 00:18:46 +00:00
|
|
|
u32 x660_ = 0;
|
|
|
|
rstl::reserved_vector<TUniqueId, 16> x664_repulsors;
|
2019-11-19 23:06:25 +00:00
|
|
|
bool x688_ = false;
|
2019-12-14 23:50:29 +00:00
|
|
|
bool x689_ = false;
|
|
|
|
u32 x68c_ = 0;
|
|
|
|
float x690_ = 0.f;
|
2019-11-19 23:06:25 +00:00
|
|
|
float x694_;
|
|
|
|
float x698_;
|
|
|
|
float x69c_;
|
|
|
|
float x6a0_;
|
|
|
|
float x6a4_;
|
|
|
|
float x6a8_;
|
|
|
|
float x6ac_;
|
2020-09-13 20:24:16 +00:00
|
|
|
std::vector<bool> x6b0_destroyedRocks;
|
2019-12-14 23:50:29 +00:00
|
|
|
std::vector<TUniqueId> x6c0_rockLights;
|
2019-11-19 23:06:25 +00:00
|
|
|
CAssetId x6d0_;
|
|
|
|
CAssetId x6d4_;
|
|
|
|
CAssetId x6d8_;
|
|
|
|
CAssetId x6dc_;
|
|
|
|
CAssetId x6e0_;
|
|
|
|
CAssetId x6e4_;
|
|
|
|
CAssetId x6e8_;
|
|
|
|
s16 x6ec_;
|
|
|
|
CAssetId x6f0_;
|
|
|
|
u32 x6f4_ = 0;
|
|
|
|
float x6f8_ = 0.3f;
|
|
|
|
std::array<CThardusSomething, 4> x6fc_;
|
|
|
|
zeus::CVector3f x74c_ = zeus::skForward;
|
|
|
|
s32 x758_;
|
|
|
|
s32 x75c_;
|
|
|
|
s32 x760_;
|
2020-01-06 04:24:54 +00:00
|
|
|
zeus::CTransform x764_startTransform;
|
2019-11-19 23:06:25 +00:00
|
|
|
u32 x794_ = 0;
|
|
|
|
std::vector<TUniqueId> x798_;
|
2020-01-06 04:24:54 +00:00
|
|
|
std::vector<TUniqueId> x7a8_timers;
|
2019-11-19 23:06:25 +00:00
|
|
|
float x7b8_ = 0.f;
|
|
|
|
float x7bc_ = 10.f;
|
2020-03-01 01:11:41 +00:00
|
|
|
float x7c0_ = 1.0f;
|
2019-11-19 23:06:25 +00:00
|
|
|
u32 x7c4_ = 0;
|
|
|
|
bool x7c8_ = false;
|
|
|
|
zeus::CVector3f x7cc_;
|
|
|
|
zeus::CVector3f x7d8_;
|
|
|
|
zeus::CVector3f x7e4_;
|
2020-01-06 04:24:54 +00:00
|
|
|
CPathFindSearch x7f0_pathFindSearch;
|
2019-11-19 23:06:25 +00:00
|
|
|
bool x8d4_ = false;
|
|
|
|
zeus::CVector3f x8d8_;
|
|
|
|
zeus::CVector3f x8e4_;
|
|
|
|
bool x8f0_ = false;
|
2020-09-07 00:18:46 +00:00
|
|
|
s8 x8f1_curPatrolPath = -1;
|
|
|
|
s8 x8f2_curPatrolPathWaypoint = -1;
|
2020-01-06 04:24:54 +00:00
|
|
|
std::vector<TUniqueId> x8f4_waypoints;
|
2020-03-01 01:11:41 +00:00
|
|
|
CSfxHandle x904_ = 0;
|
2019-11-19 23:06:25 +00:00
|
|
|
bool x908_ = false;
|
2020-01-06 04:24:54 +00:00
|
|
|
bool x909_ = false;
|
2020-09-13 20:24:16 +00:00
|
|
|
std::vector<float> x90c_rockHealths;
|
2020-03-01 01:11:41 +00:00
|
|
|
TLockedToken<CTexture> x91c_flareTexture;
|
2020-01-06 04:24:54 +00:00
|
|
|
TUniqueId x928_currentRockId;
|
|
|
|
zeus::CVector3f x92c_currentRockPos;
|
2019-11-19 23:06:25 +00:00
|
|
|
bool x938_ = false;
|
|
|
|
bool x939_ = false;
|
|
|
|
bool x93a_ = false;
|
|
|
|
bool x93b_ = false;
|
|
|
|
bool x93c_ = false;
|
|
|
|
bool x93d_ = true;
|
|
|
|
u32 x940_ = 0;
|
|
|
|
float x944_ = 0.3f;
|
|
|
|
u32 x948_;
|
2020-01-06 04:24:54 +00:00
|
|
|
bool x94c_initialized = false;
|
2019-11-19 23:06:25 +00:00
|
|
|
bool x94d_ = false;
|
|
|
|
zeus::CVector3f x950_;
|
2019-12-14 23:50:29 +00:00
|
|
|
bool x95c_doCodeTrigger = false;
|
2020-01-06 04:24:54 +00:00
|
|
|
u8 x95d_ = 0;
|
2019-11-19 23:06:25 +00:00
|
|
|
bool x95e_ = false;
|
|
|
|
|
2019-12-14 23:50:29 +00:00
|
|
|
void SetState(s32 state, CStateManager& mgr) {
|
|
|
|
x644_ = state;
|
2020-09-13 19:03:49 +00:00
|
|
|
if (state == 2) {
|
2019-12-14 23:50:29 +00:00
|
|
|
SendScriptMsgs(EScriptObjectState::Patrol, mgr, EScriptObjectMessage::None);
|
2020-09-13 19:03:49 +00:00
|
|
|
} else if (state == 1) {
|
2019-12-14 23:50:29 +00:00
|
|
|
SendScriptMsgs(EScriptObjectState::Retreat, mgr, EScriptObjectMessage::None);
|
2020-09-13 19:03:49 +00:00
|
|
|
}
|
2019-12-14 23:50:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void GatherWaypoints(CScriptWaypoint* wp, CStateManager& mgr, rstl::reserved_vector<TUniqueId, 16>& uids);
|
|
|
|
void sub801dec80() { x68c_ = 20000; }
|
2020-09-12 04:37:45 +00:00
|
|
|
void FindNonDestroyableActors(const std::unique_ptr<CCollisionActorManager>& colMgr);
|
2021-05-06 17:53:19 +00:00
|
|
|
void UpdateRockThermalState(float dt, CStateManager& mgr);
|
2020-01-06 04:24:54 +00:00
|
|
|
bool sub801dc2c8() const { return (x610_destroyableRocks.size() - 1) == x648_currentRock; }
|
2020-09-07 00:18:46 +00:00
|
|
|
void sub801de9f8(CStateManager& mgr);
|
2020-01-06 04:24:54 +00:00
|
|
|
void sub801dd608(CStateManager& mgr);
|
|
|
|
void sub801dcfa4(CStateManager& mgr);
|
|
|
|
void sub80deadc(CStateManager& mgr) {
|
2020-09-07 00:18:46 +00:00
|
|
|
if (x578_waypoints.empty()) {
|
2020-01-06 04:24:54 +00:00
|
|
|
sub801de9f8(mgr);
|
|
|
|
} else {
|
|
|
|
if (sub801dc2c8() || x5c4_ != 0 || x944_ <= 0.f)
|
|
|
|
sub801de9f8(mgr);
|
|
|
|
else
|
|
|
|
x944_ = 0.f;
|
|
|
|
}
|
|
|
|
}
|
2021-05-06 17:53:19 +00:00
|
|
|
void BreakRock(CStateManager& mgr, u32 rockIndex);
|
2020-07-26 04:53:49 +00:00
|
|
|
|
2021-05-06 17:53:19 +00:00
|
|
|
void SetRockParticle(CStateManager& mgr, const zeus::CVector3f& pos, CAssetId particle);
|
2020-01-06 04:24:54 +00:00
|
|
|
void sub801dbc5c(CStateManager& mgr, CDestroyableRock* rock);
|
|
|
|
void sub801dbbdc(CStateManager& mgr, CDestroyableRock* rock);
|
2020-09-13 20:00:13 +00:00
|
|
|
bool sub801dc2c8() { return x648_currentRock == (x610_destroyableRocks.size() - 1); }
|
2020-01-06 04:24:54 +00:00
|
|
|
void UpdateNonDestroyableCollisionActorMaterials(EUpdateMaterialMode mode, EMaterialTypes mat, CStateManager& mgr);
|
|
|
|
void UpdateExcludeList(const std::unique_ptr<CCollisionActorManager>& colMgr, EUpdateMaterialMode mode,
|
|
|
|
EMaterialTypes mat, CStateManager& mgr);
|
2019-12-14 23:50:29 +00:00
|
|
|
void _SetupCollisionActorMaterials(const std::unique_ptr<CCollisionActorManager>& colMgr, CStateManager& mgr);
|
|
|
|
void _SetupCollisionManagers(CStateManager& mgr);
|
2020-03-06 04:18:27 +00:00
|
|
|
void _BuildSphereJointList(const SSphereJointInfo* arr, size_t count, std::vector<CJointCollisionDescription>& list);
|
|
|
|
void _BuildAABoxJointList(const SAABoxJointInfo* arr, size_t count, std::vector<CJointCollisionDescription>& list);
|
2020-04-10 01:19:54 +00:00
|
|
|
void RenderFlare(const CStateManager& mgr, float t);
|
2020-09-07 00:18:46 +00:00
|
|
|
zeus::CVector3f sub801de550(CStateManager& mgr);
|
|
|
|
zeus::CVector3f sub801de434(CStateManager& mgr);
|
2021-05-06 17:53:19 +00:00
|
|
|
zeus::CVector2f GetTargetVector(float arg, CStateManager& mgr);
|
2020-09-07 00:18:46 +00:00
|
|
|
void sub801dbc40();
|
2020-03-01 01:11:41 +00:00
|
|
|
|
2020-04-10 01:19:54 +00:00
|
|
|
std::optional<CTexturedQuadFilter> m_flareFilter;
|
2019-12-14 23:50:29 +00:00
|
|
|
|
2020-07-26 04:53:49 +00:00
|
|
|
void DoDoubleSnap(CStateManager& mgr) {
|
|
|
|
x330_stateMachineState.SetState(mgr, *this, GetStateMachine(), "DoubleSnap"sv);
|
|
|
|
}
|
2020-09-07 00:18:46 +00:00
|
|
|
void DoFaint(CStateManager& mgr) {
|
|
|
|
if (x644_ != 1) {
|
|
|
|
x330_stateMachineState.SetState(mgr, *this, GetStateMachine(), "Faint"sv);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void DoFlinch(CStateManager& mgr) { x330_stateMachineState.SetState(mgr, *this, GetStateMachine(), "Flinch"sv); }
|
|
|
|
void _DoSuckState(CStateManager& mgr) { x330_stateMachineState.SetState(mgr, *this, GetStateMachine(), "Suck"sv); }
|
|
|
|
|
2020-07-26 04:53:49 +00:00
|
|
|
|
2021-05-06 17:53:19 +00:00
|
|
|
zeus::CVector2f GetSteeringVector(CStateManager& mgr) const;
|
2020-09-07 00:18:46 +00:00
|
|
|
void UpdateHealthInfo(CStateManager& mgr);
|
2020-09-05 21:51:21 +00:00
|
|
|
void BouncePlayer(float f1, CStateManager& mgr);
|
2020-09-07 00:18:46 +00:00
|
|
|
|
2019-11-19 23:06:25 +00:00
|
|
|
public:
|
2020-08-23 19:03:33 +00:00
|
|
|
DEFINE_PATTERNED(Thardus);
|
2019-11-19 23:06:25 +00:00
|
|
|
CThardus(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
|
|
|
|
CModelData&& mData, const CActorParameters& actParms, const CPatternedInfo& pInfo,
|
2020-03-06 02:14:08 +00:00
|
|
|
std::vector<CStaticRes> mData1, std::vector<CStaticRes> mData2, CAssetId particle1, CAssetId particle2,
|
|
|
|
CAssetId particle3, float f1, float f2, float f3, float f4, float f5, float f6, CAssetId stateMachine,
|
|
|
|
CAssetId particle4, CAssetId particle5, CAssetId particle6, CAssetId particle7, CAssetId particle8,
|
|
|
|
CAssetId particle9, CAssetId texture, u32 sfxId1, CAssetId particle10, u32 sfxId2, u32 sfxId3, u32 sfxId4);
|
2019-11-19 23:06:25 +00:00
|
|
|
|
2019-12-14 23:50:29 +00:00
|
|
|
void Think(float dt, CStateManager& mgr) override;
|
2019-11-19 23:06:25 +00:00
|
|
|
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) override;
|
2019-12-14 23:50:29 +00:00
|
|
|
void PreRender(CStateManager& mgr, const zeus::CFrustum& frustum) override;
|
2020-04-09 17:28:20 +00:00
|
|
|
void Render(CStateManager& mgr) override;
|
2019-12-14 23:50:29 +00:00
|
|
|
bool CanRenderUnsorted(const CStateManager&) const override { return false; }
|
|
|
|
void Touch(CActor& act, CStateManager& mgr) override;
|
|
|
|
zeus::CVector3f GetOrbitPosition(const CStateManager& mgr) const override;
|
|
|
|
zeus::CVector3f GetAimPosition(const CStateManager& mgr, float) const override;
|
|
|
|
zeus::CAABox GetSortingBounds(const CStateManager& mgr) const override;
|
|
|
|
void DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EUserEventType type, float dt) override;
|
2019-11-19 23:06:25 +00:00
|
|
|
|
2019-12-14 23:50:29 +00:00
|
|
|
void Patrol(CStateManager& mgr, EStateMsg msg, float arg) override;
|
|
|
|
void Dead(CStateManager& mgr, EStateMsg msg, float arg) override;
|
|
|
|
void PathFind(CStateManager& mgr, EStateMsg msg, float arg) override;
|
|
|
|
void TargetPatrol(CStateManager& mgr, EStateMsg msg, float arg) override;
|
2019-11-24 15:01:07 +00:00
|
|
|
void Generate(CStateManager& mgr, EStateMsg msg, float arg) override;
|
2019-12-14 23:50:29 +00:00
|
|
|
void Attack(CStateManager& mgr, EStateMsg msg, float arg) override;
|
|
|
|
void LoopedAttack(CStateManager& mgr, EStateMsg msg, float arg) override;
|
|
|
|
void DoubleSnap(CStateManager& mgr, EStateMsg msg, float arg) override;
|
|
|
|
void Shuffle(CStateManager& mgr, EStateMsg msg, float arg) override;
|
2019-11-24 15:01:07 +00:00
|
|
|
void GetUp(CStateManager& mgr, EStateMsg msg, float arg) override;
|
2019-12-14 23:50:29 +00:00
|
|
|
void Taunt(CStateManager& mgr, EStateMsg msg, float arg) override;
|
|
|
|
void Suck(CStateManager& mgr, EStateMsg msg, float arg) override;
|
|
|
|
void ProjectileAttack(CStateManager& mgr, EStateMsg msg, float arg) override;
|
|
|
|
void Flinch(CStateManager& mgr, EStateMsg msg, float arg) override;
|
|
|
|
void TelegraphAttack(CStateManager& mgr, EStateMsg msg, float arg) override;
|
|
|
|
void Explode(CStateManager& mgr, EStateMsg msg, float arg) override;
|
|
|
|
void Cover(CStateManager& mgr, EStateMsg msg, float arg) override;
|
|
|
|
void Enraged(CStateManager& mgr, EStateMsg msg, float arg) override;
|
|
|
|
void Growth(CStateManager& mgr, EStateMsg msg, float arg) override;
|
|
|
|
void Faint(CStateManager& mgr, EStateMsg msg, float arg) override;
|
|
|
|
bool PathFound(CStateManager& mgr, float arg) override;
|
|
|
|
bool InRange(CStateManager& mgr, float arg) override;
|
|
|
|
bool PatternOver(CStateManager& mgr, float arg) override;
|
2020-01-06 04:24:54 +00:00
|
|
|
bool HasAttackPattern(CStateManager& mgr, float arg) override { return x5c4_ == 1 && !ShouldMove(mgr, 0.f); }
|
2019-12-14 23:50:29 +00:00
|
|
|
bool AnimOver(CStateManager& mgr, float arg) override;
|
|
|
|
bool InPosition(CStateManager& mgr, float arg) override;
|
|
|
|
bool ShouldTurn(CStateManager& mgr, float arg) override;
|
|
|
|
bool HitSomething(CStateManager& mgr, float arg) override;
|
|
|
|
bool HearPlayer(CStateManager& mgr, float arg) override { return x5c8_heardPlayer; }
|
2020-01-06 04:24:54 +00:00
|
|
|
bool CoverBlown(CStateManager& mgr, float arg) override { return x5c4_ == 2 && !ShouldMove(mgr, 0.f); }
|
|
|
|
bool CoveringFire(CStateManager& mgr, float arg) override { return x5c4_ == 0 && !ShouldMove(mgr, 0.f); }
|
2019-12-14 23:50:29 +00:00
|
|
|
bool AggressionCheck(CStateManager& mgr, float arg) override { return x330_stateMachineState.GetTime() > 0.1f; }
|
|
|
|
bool AttackOver(CStateManager& mgr, float arg) override { return true; }
|
2020-01-06 04:24:54 +00:00
|
|
|
bool ShouldTaunt(CStateManager& mgr, float arg) override { return false; }
|
2020-09-13 20:00:13 +00:00
|
|
|
bool ShouldMove(CStateManager& mgr, float arg) override { return x68c_ < x574_ || x93b_; }
|
2020-09-07 00:18:46 +00:00
|
|
|
bool StartAttack(CStateManager& mgr, float arg) override { return true; }
|
2020-01-06 04:24:54 +00:00
|
|
|
bool CodeTrigger(CStateManager& mgr, float arg) override { return x95c_doCodeTrigger; }
|
2019-12-14 23:50:29 +00:00
|
|
|
bool IsDizzy(CStateManager& mgr, float arg) override { return x330_stateMachineState.GetTime() > 4.f; }
|
|
|
|
bool ShouldCallForBackup(CStateManager& mgr, float arg) override { return x330_stateMachineState.GetTime() > .5f; }
|
|
|
|
|
2020-01-06 04:24:54 +00:00
|
|
|
CPathFindSearch* GetSearchPath() override { return &x7f0_pathFindSearch; }
|
2020-09-05 21:51:21 +00:00
|
|
|
|
|
|
|
u32 Get_x7c4() const { return x7c4_; }
|
|
|
|
bool sub801db5b4(CStateManager& mgr) const;
|
2020-09-07 00:18:46 +00:00
|
|
|
void ApplyCameraShake(float magnitude, float sfxDistance, float duration, CStateManager& mgr,
|
|
|
|
const zeus::CVector3f& v1);
|
2019-11-19 23:06:25 +00:00
|
|
|
};
|
|
|
|
} // namespace MP1
|
2021-04-10 08:42:06 +00:00
|
|
|
} // namespace metaforce
|