2018-10-28 00:20:30 +00:00
|
|
|
#pragma once
|
|
|
|
|
2019-09-28 02:53:03 +00:00
|
|
|
#include <string_view>
|
|
|
|
|
|
|
|
#include "Runtime/GCNTypes.hpp"
|
|
|
|
#include "Runtime/Character/CBoneTracking.hpp"
|
|
|
|
#include "Runtime/Weapon/CProjectileInfo.hpp"
|
|
|
|
#include "Runtime/World/CPatterned.hpp"
|
|
|
|
|
|
|
|
#include <zeus/CVector3f.hpp>
|
2018-10-28 00:20:30 +00:00
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
namespace metaforce::MP1 {
|
2020-03-11 06:16:55 +00:00
|
|
|
enum class EBehaveType { Lurk, Taunt, Attack, Move, None };
|
2020-01-21 04:00:40 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
class CChozoGhost : public CPatterned {
|
2018-10-28 00:20:30 +00:00
|
|
|
public:
|
2018-12-08 05:30:43 +00:00
|
|
|
class CBehaveChance {
|
|
|
|
u32 x0_propertyCount;
|
2020-03-04 13:32:41 +00:00
|
|
|
float x4_lurk;
|
2020-03-11 04:22:03 +00:00
|
|
|
float x8_taunt;
|
2020-03-04 13:32:41 +00:00
|
|
|
float xc_attack;
|
|
|
|
float x10_move;
|
|
|
|
float x14_lurkTime;
|
|
|
|
float x18_chargeAttack;
|
|
|
|
u32 x1c_numBolts;
|
2018-12-08 05:30:43 +00:00
|
|
|
|
|
|
|
public:
|
2020-03-31 03:52:22 +00:00
|
|
|
explicit CBehaveChance(CInputStream&);
|
2020-01-21 04:00:40 +00:00
|
|
|
|
2020-03-05 02:39:30 +00:00
|
|
|
EBehaveType GetBehave(EBehaveType type, CStateManager& mgr) const;
|
|
|
|
float GetLurk() const { return x4_lurk; }
|
2020-03-11 04:22:03 +00:00
|
|
|
float GetTaunt() const { return x8_taunt; }
|
2020-03-05 02:39:30 +00:00
|
|
|
float GetAttack() const { return xc_attack; }
|
|
|
|
float GetMove() const { return x10_move; }
|
|
|
|
float GetLurkTime() const { return x14_lurkTime; }
|
|
|
|
float GetChargeAttack() const { return x18_chargeAttack; }
|
|
|
|
u32 GetNumBolts() const { return x1c_numBolts; }
|
2018-12-08 05:30:43 +00:00
|
|
|
};
|
2018-10-28 00:20:30 +00:00
|
|
|
|
|
|
|
private:
|
2020-03-04 13:32:41 +00:00
|
|
|
float x568_hearingRadius;
|
|
|
|
float x56c_fadeOutDelay;
|
|
|
|
float x570_attackDelay;
|
|
|
|
float x574_freezeTime;
|
2019-08-04 00:02:53 +00:00
|
|
|
CProjectileInfo x578_;
|
|
|
|
CProjectileInfo x5a0_;
|
|
|
|
CBehaveChance x5c8_;
|
|
|
|
CBehaveChance x5e8_;
|
|
|
|
CBehaveChance x608_;
|
2020-03-04 13:32:41 +00:00
|
|
|
s16 x628_soundImpact;
|
2019-08-04 00:02:53 +00:00
|
|
|
float x62c_;
|
2020-03-11 06:16:55 +00:00
|
|
|
s16 x630_sfxFadeIn;
|
|
|
|
s16 x632_sfxFadeOut;
|
2019-08-04 00:02:53 +00:00
|
|
|
float x634_;
|
2020-03-04 13:32:41 +00:00
|
|
|
float x638_hurlRecoverTime;
|
2019-08-04 00:02:53 +00:00
|
|
|
u32 x63c_;
|
2020-03-07 02:03:13 +00:00
|
|
|
std::optional<TLockedToken<CGenDescription>> x640_projectileVisor;
|
2020-03-04 13:32:41 +00:00
|
|
|
s16 x650_sound_ProjectileVisor;
|
2019-08-04 00:02:53 +00:00
|
|
|
float x654_;
|
|
|
|
float x658_;
|
2020-03-04 13:32:41 +00:00
|
|
|
u32 x65c_nearChance;
|
|
|
|
u32 x660_midChance;
|
2020-03-11 06:16:55 +00:00
|
|
|
bool x664_24_behaviorEnabled : 1;
|
2020-03-05 01:32:49 +00:00
|
|
|
bool x664_25_flinch : 1;
|
2020-04-21 07:22:41 +00:00
|
|
|
bool x664_26_alert : 1 = false;
|
|
|
|
bool x664_27_onGround : 1 = false;
|
|
|
|
bool x664_28_ : 1 = false;
|
|
|
|
bool x664_29_fadedIn : 1 = false;
|
|
|
|
bool x664_30_fadedOut : 1 = false;
|
|
|
|
bool x664_31_ : 1 = false;
|
|
|
|
bool x665_24_ : 1 = true;
|
|
|
|
bool x665_25_ : 1 = false;
|
|
|
|
bool x665_26_shouldSwoosh : 1 = false;
|
|
|
|
bool x665_27_playerInLeashRange : 1 = false;
|
|
|
|
bool x665_28_inRange : 1 = false;
|
|
|
|
bool x665_29_aggressive : 1 = false;
|
2019-08-04 00:02:53 +00:00
|
|
|
float x668_ = 0.f;
|
|
|
|
float x66c_ = 0.f;
|
|
|
|
float x670_ = 0.f;
|
2020-03-05 01:32:49 +00:00
|
|
|
TUniqueId x674_coverPoint = kInvalidUniqueId;
|
2020-03-11 06:16:55 +00:00
|
|
|
float x678_floorLevel = 0.f;
|
|
|
|
u32 x67c_attackType = -1;
|
2020-03-05 02:39:30 +00:00
|
|
|
EBehaveType x680_behaveType = EBehaveType::Lurk;
|
2020-03-05 01:32:49 +00:00
|
|
|
float x684_lurkDelay = 1.f;
|
2019-08-04 00:02:53 +00:00
|
|
|
CSteeringBehaviors x688_;
|
2020-01-21 04:00:40 +00:00
|
|
|
CBoneTracking x68c_boneTracking;
|
2020-03-05 01:32:49 +00:00
|
|
|
TUniqueId x6c4_teamMgr = kInvalidUniqueId;
|
2020-03-11 06:16:55 +00:00
|
|
|
float x6c8_spaceWarpTime = 0.f;
|
|
|
|
zeus::CVector3f x6cc_spaceWarpPosition;
|
2019-08-04 00:02:53 +00:00
|
|
|
u32 x6d8_ = 1;
|
2020-03-05 01:32:49 +00:00
|
|
|
|
|
|
|
void AddToTeam(CStateManager& mgr);
|
|
|
|
void RemoveFromTeam(CStateManager& mgr);
|
2020-03-11 06:16:55 +00:00
|
|
|
void FloatToLevel(float f1, float dt);
|
2020-03-05 01:32:49 +00:00
|
|
|
const CBehaveChance& ChooseBehaveChanceRange(CStateManager& mgr);
|
|
|
|
bool IsVisibleEnough(const CStateManager& mgr) const { return GetModelAlphau8(mgr) > 31; }
|
2020-03-11 06:16:55 +00:00
|
|
|
void FindSpaceWarpPosition(CStateManager& mgr, const zeus::CVector3f& dir);
|
2020-03-05 15:42:12 +00:00
|
|
|
void FindBestAnchor(CStateManager& mgr);
|
2020-03-05 02:39:30 +00:00
|
|
|
|
2018-10-28 00:20:30 +00:00
|
|
|
public:
|
2020-08-23 19:03:33 +00:00
|
|
|
DEFINE_PATTERNED(ChozoGhost);
|
2018-10-28 00:20:30 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
CChozoGhost(TUniqueId, std::string_view, const CEntityInfo&, const zeus::CTransform&, CModelData&&,
|
|
|
|
const CActorParameters&, const CPatternedInfo&, float, float, float, float, CAssetId, const CDamageInfo&,
|
|
|
|
CAssetId, const CDamageInfo&, const CChozoGhost::CBehaveChance&, const CChozoGhost::CBehaveChance&,
|
|
|
|
const CBehaveChance&, u16, float, u16, u16, u32, float, u32, float, CAssetId, s16, float, float, u32,
|
|
|
|
u32);
|
2020-01-21 04:00:40 +00:00
|
|
|
|
2020-03-04 13:32:41 +00:00
|
|
|
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) override;
|
|
|
|
void Think(float dt, CStateManager&) override;
|
|
|
|
void PreRender(CStateManager& mgr, const zeus::CFrustum& frustum) override;
|
2020-04-09 17:28:20 +00:00
|
|
|
void Render(CStateManager& mgr) override;
|
2020-03-04 13:32:41 +00:00
|
|
|
void Touch(CActor& act, CStateManager& mgr) override;
|
|
|
|
EWeaponCollisionResponseTypes GetCollisionResponseType(const zeus::CVector3f& pos, const zeus::CVector3f& dir,
|
2020-03-05 02:39:30 +00:00
|
|
|
const CWeaponMode& mode,
|
|
|
|
EProjectileAttrib attrib) const override;
|
2020-03-04 13:32:41 +00:00
|
|
|
void DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EUserEventType type, float dt) override;
|
|
|
|
void KnockBack(const zeus::CVector3f& dir, CStateManager& mgr, const CDamageInfo& info, EKnockBackType type,
|
|
|
|
bool inDeferred, float magnitude) override;
|
|
|
|
bool CanBeShot(const CStateManager& mgr, int w1) override;
|
|
|
|
zeus::CVector3f GetOrigin(const CStateManager& mgr, const CTeamAiRole& role,
|
|
|
|
const zeus::CVector3f& aimPos) const override {
|
|
|
|
return x34_transform.origin;
|
|
|
|
}
|
|
|
|
void Dead(CStateManager& mgr, EStateMsg msg, float arg) override;
|
|
|
|
void SelectTarget(CStateManager& mgr, EStateMsg msg, float arg) override;
|
2020-03-11 06:16:55 +00:00
|
|
|
void Run(CStateManager& mgr, EStateMsg msg, float dt) override;
|
|
|
|
void Generate(CStateManager& mgr, EStateMsg msg, float dt) override;
|
2020-03-04 13:32:41 +00:00
|
|
|
void Deactivate(CStateManager& mgr, EStateMsg msg, float arg) override;
|
2020-03-11 06:16:55 +00:00
|
|
|
void Attack(CStateManager& mgr, EStateMsg msg, float dt) override;
|
2020-03-04 13:32:41 +00:00
|
|
|
void Shuffle(CStateManager& mgr, EStateMsg msg, float arg) override;
|
|
|
|
void InActive(CStateManager& mgr, EStateMsg msg, float arg) override;
|
2020-03-11 06:16:55 +00:00
|
|
|
void Taunt(CStateManager& mgr, EStateMsg msg, float dt) override;
|
2020-03-04 13:32:41 +00:00
|
|
|
void Hurled(CStateManager& mgr, EStateMsg msg, float arg) override;
|
|
|
|
void WallDetach(CStateManager& mgr, EStateMsg msg, float arg) override;
|
2020-03-11 06:16:55 +00:00
|
|
|
void Growth(CStateManager& mgr, EStateMsg msg, float dt) override;
|
|
|
|
void Land(CStateManager& mgr, EStateMsg msg, float dt) override;
|
|
|
|
void Lurk(CStateManager& mgr, EStateMsg msg, float dt) override;
|
2020-03-04 13:32:41 +00:00
|
|
|
bool Leash(CStateManager& mgr, float arg) override;
|
|
|
|
bool InRange(CStateManager& mgr, float arg) override;
|
2020-03-11 04:22:03 +00:00
|
|
|
bool ShouldAttack(CStateManager& mgr, float arg) override;
|
2020-03-04 13:32:41 +00:00
|
|
|
bool AggressionCheck(CStateManager& mgr, float arg) override;
|
|
|
|
bool ShouldTaunt(CStateManager& mgr, float arg) override;
|
|
|
|
bool ShouldFlinch(CStateManager& mgr, float arg) override;
|
|
|
|
bool ShouldMove(CStateManager& mgr, float arg) override;
|
|
|
|
bool AIStage(CStateManager& mgr, float arg) override;
|
|
|
|
u8 GetModelAlphau8(const CStateManager&) const override;
|
|
|
|
bool IsOnGround() const override;
|
|
|
|
float GetGravityConstant() const override { return 60.f; }
|
|
|
|
CProjectileInfo* GetProjectileInfo() override;
|
2018-10-28 00:20:30 +00:00
|
|
|
};
|
2021-04-10 08:42:06 +00:00
|
|
|
} // namespace metaforce::MP1
|