2018-10-07 03:42:33 +00:00
|
|
|
#pragma once
|
2015-08-17 20:33:58 +00:00
|
|
|
|
2019-09-22 21:52:05 +00:00
|
|
|
#include <string_view>
|
|
|
|
|
|
|
|
#include "Runtime/GCNTypes.hpp"
|
|
|
|
#include "Runtime/RetroTypes.hpp"
|
|
|
|
#include "Runtime/World/CDamageVulnerability.hpp"
|
|
|
|
#include "Runtime/World/CEntity.hpp"
|
|
|
|
#include "Runtime/World/CHealthInfo.hpp"
|
|
|
|
#include "Runtime/World/CKnockBackController.hpp"
|
|
|
|
#include "Runtime/World/CPhysicsActor.hpp"
|
|
|
|
#include "Runtime/World/CStateMachine.hpp"
|
|
|
|
#include "Runtime/World/ScriptObjectSupport.hpp"
|
|
|
|
|
|
|
|
#include <zeus/zeus.hpp>
|
2015-10-29 07:52:15 +00:00
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
namespace metaforce {
|
2015-08-17 22:05:00 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
enum class EListenNoiseType { PlayerFire, BombExplode, ProjectileExplode };
|
2015-10-29 07:52:15 +00:00
|
|
|
|
2016-04-25 05:46:28 +00:00
|
|
|
class CAiFuncMap;
|
2015-10-29 07:52:15 +00:00
|
|
|
class CStateManager;
|
2018-09-07 05:24:55 +00:00
|
|
|
class CScriptWater;
|
2018-11-26 02:15:44 +00:00
|
|
|
class CTeamAiRole;
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
class CAi : public CPhysicsActor {
|
|
|
|
static CAiFuncMap* m_FuncMap;
|
2021-06-07 19:29:18 +00:00
|
|
|
|
2018-12-27 06:26:34 +00:00
|
|
|
protected:
|
2018-12-08 05:30:43 +00:00
|
|
|
CHealthInfo x258_healthInfo;
|
|
|
|
CDamageVulnerability x260_damageVulnerability;
|
|
|
|
TLockedToken<CStateMachine> x2c8_stateMachine;
|
2015-08-22 01:58:41 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
public:
|
2021-05-26 14:00:57 +00:00
|
|
|
DEFINE_ENTITY
|
2017-11-13 06:19:18 +00:00
|
|
|
CAi(TUniqueId uid, bool active, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
|
2016-04-25 05:46:28 +00:00
|
|
|
CModelData&& mData, const zeus::CAABox& box, float mass, const CHealthInfo& hInfo, const CDamageVulnerability&,
|
2017-08-13 05:26:14 +00:00
|
|
|
const CMaterialList& list, CAssetId fsm, const CActorParameters&, float f1, float f2);
|
2016-04-24 02:46:13 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
static void CreateFuncLookup(CAiFuncMap* funcMap);
|
2020-05-08 20:33:29 +00:00
|
|
|
static CAiStateFunc GetStateFunc(std::string_view func);
|
|
|
|
static CAiTriggerFunc GetTriggerFunc(std::string_view func);
|
2016-04-24 02:46:13 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
const CStateMachine* GetStateMachine() const;
|
2015-10-29 07:52:15 +00:00
|
|
|
|
2019-08-09 12:45:18 +00:00
|
|
|
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&) override;
|
|
|
|
CHealthInfo* HealthInfo(CStateManager&) override { return &x258_healthInfo; }
|
|
|
|
const CDamageVulnerability* GetDamageVulnerability() const override { return &x260_damageVulnerability; }
|
|
|
|
EWeaponCollisionResponseTypes GetCollisionResponseType(const zeus::CVector3f&, const zeus::CVector3f&,
|
|
|
|
const CWeaponMode&, EProjectileAttrib) const override;
|
|
|
|
void FluidFXThink(EFluidState, CScriptWater&, CStateManager&) override;
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
virtual void Death(CStateManager& mgr, const zeus::CVector3f& direction, EScriptObjectState state) = 0;
|
|
|
|
virtual void KnockBack(const zeus::CVector3f&, CStateManager&, const CDamageInfo& info, EKnockBackType type,
|
|
|
|
bool inDeferred, float magnitude) = 0;
|
2019-08-09 12:45:18 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
virtual void TakeDamage(const zeus::CVector3f& direction, float magnitude) {}
|
|
|
|
virtual bool CanBeShot(const CStateManager&, int) { return true; }
|
|
|
|
virtual bool IsListening() const { return false; }
|
2020-03-12 07:07:41 +00:00
|
|
|
virtual bool Listen(const zeus::CVector3f&, EListenNoiseType) { return false; }
|
2015-10-29 07:52:15 +00:00
|
|
|
|
2018-12-31 05:01:42 +00:00
|
|
|
virtual zeus::CVector3f GetOrigin(const CStateManager& mgr, const CTeamAiRole& role,
|
|
|
|
const zeus::CVector3f& aimPos) const {
|
2018-12-08 05:30:43 +00:00
|
|
|
return x34_transform.origin;
|
|
|
|
}
|
|
|
|
virtual void Patrol(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void FollowPattern(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void Dead(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void PathFind(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void Start(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void SelectTarget(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void TargetPatrol(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void TargetPlayer(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void TargetCover(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void Halt(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void Walk(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void Run(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void Generate(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void Deactivate(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void Attack(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void LoopedAttack(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void JumpBack(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void DoubleSnap(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void Shuffle(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void TurnAround(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void Skid(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void Active(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void InActive(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void CoverAttack(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void Crouch(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void FadeIn(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void FadeOut(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void GetUp(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void Taunt(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void Suck(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void Flee(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void Lurk(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void ProjectileAttack(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void Flinch(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void Hurled(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void TelegraphAttack(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void Jump(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void Explode(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void Dodge(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void Retreat(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void Cover(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void Approach(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void WallHang(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void WallDetach(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void Enraged(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void SpecialAttack(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void Growth(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void Faint(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void Land(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void Bounce(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void PathFindEx(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void Dizzy(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void CallForBackup(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void BulbAttack(CStateManager&, EStateMsg, float) {}
|
|
|
|
virtual void PodAttack(CStateManager&, EStateMsg, float) {}
|
2015-10-29 07:52:15 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
virtual bool InAttackPosition(CStateManager&, float) { return false; }
|
|
|
|
virtual bool Leash(CStateManager&, float) { return false; }
|
|
|
|
virtual bool OffLine(CStateManager&, float) { return false; }
|
|
|
|
virtual bool Attacked(CStateManager&, float) { return false; }
|
|
|
|
virtual bool PathShagged(CStateManager&, float) { return false; }
|
|
|
|
virtual bool PathOver(CStateManager&, float) { return false; }
|
|
|
|
virtual bool PathFound(CStateManager&, float) { return false; }
|
|
|
|
virtual bool TooClose(CStateManager&, float) { return false; }
|
|
|
|
virtual bool InRange(CStateManager&, float) { return false; }
|
|
|
|
virtual bool InMaxRange(CStateManager&, float) { return false; }
|
|
|
|
virtual bool InDetectionRange(CStateManager&, float) { return false; }
|
|
|
|
virtual bool SpotPlayer(CStateManager&, float) { return false; }
|
|
|
|
virtual bool PlayerSpot(CStateManager&, float) { return false; }
|
|
|
|
virtual bool PatternOver(CStateManager&, float) { return false; }
|
|
|
|
virtual bool PatternShagged(CStateManager&, float) { return false; }
|
|
|
|
virtual bool HasAttackPattern(CStateManager&, float) { return false; }
|
|
|
|
virtual bool HasPatrolPath(CStateManager&, float) { return false; }
|
|
|
|
virtual bool HasRetreatPattern(CStateManager&, float) { return false; }
|
|
|
|
virtual bool Delay(CStateManager&, float) { return false; }
|
|
|
|
virtual bool RandomDelay(CStateManager&, float) { return false; }
|
|
|
|
virtual bool FixedDelay(CStateManager&, float) { return false; }
|
|
|
|
virtual bool Default(CStateManager&, float) { return false; }
|
|
|
|
virtual bool AnimOver(CStateManager&, float) { return false; }
|
|
|
|
virtual bool ShouldAttack(CStateManager&, float) { return false; }
|
|
|
|
virtual bool ShouldDoubleSnap(CStateManager&, float) { return false; }
|
|
|
|
virtual bool InPosition(CStateManager&, float) { return false; }
|
|
|
|
virtual bool ShouldTurn(CStateManager&, float) { return false; }
|
|
|
|
virtual bool HitSomething(CStateManager&, float) { return false; }
|
|
|
|
virtual bool ShouldJumpBack(CStateManager&, float) { return false; }
|
|
|
|
virtual bool Stuck(CStateManager&, float) { return false; }
|
|
|
|
virtual bool NoPathNodes(CStateManager&, float) { return false; }
|
|
|
|
virtual bool Landed(CStateManager&, float) { return false; }
|
|
|
|
virtual bool HearShot(CStateManager&, float) { return false; }
|
|
|
|
virtual bool HearPlayer(CStateManager&, float) { return false; }
|
|
|
|
virtual bool CoverCheck(CStateManager&, float) { return false; }
|
|
|
|
virtual bool CoverFind(CStateManager&, float) { return false; }
|
|
|
|
virtual bool CoverBlown(CStateManager&, float) { return false; }
|
|
|
|
virtual bool CoverNearlyBlown(CStateManager&, float) { return false; }
|
|
|
|
virtual bool CoveringFire(CStateManager&, float) { return false; }
|
|
|
|
virtual bool GotUp(CStateManager&, float) { return false; }
|
|
|
|
virtual bool LineOfSight(CStateManager&, float) { return false; }
|
|
|
|
virtual bool AggressionCheck(CStateManager&, float) { return false; }
|
|
|
|
virtual bool AttackOver(CStateManager&, float) { return false; }
|
|
|
|
virtual bool ShouldTaunt(CStateManager&, float) { return false; }
|
|
|
|
virtual bool Inside(CStateManager&, float) { return false; }
|
|
|
|
virtual bool ShouldFire(CStateManager&, float) { return false; }
|
|
|
|
virtual bool ShouldFlinch(CStateManager&, float) { return false; }
|
|
|
|
virtual bool PatrolPathOver(CStateManager&, float) { return false; }
|
|
|
|
virtual bool ShouldDodge(CStateManager&, float) { return false; }
|
|
|
|
virtual bool ShouldRetreat(CStateManager&, float) { return false; }
|
|
|
|
virtual bool ShouldCrouch(CStateManager&, float) { return false; }
|
|
|
|
virtual bool ShouldMove(CStateManager&, float) { return false; }
|
|
|
|
virtual bool ShotAt(CStateManager&, float) { return false; }
|
|
|
|
virtual bool HasTargetingPoint(CStateManager&, float) { return false; }
|
|
|
|
virtual bool ShouldWallHang(CStateManager&, float) { return false; }
|
|
|
|
virtual bool SetAIStage(CStateManager&, float) { return false; }
|
|
|
|
virtual bool AIStage(CStateManager&, float) { return false; }
|
|
|
|
virtual bool StartAttack(CStateManager&, float) { return false; }
|
|
|
|
virtual bool BreakAttack(CStateManager&, float) { return false; }
|
|
|
|
virtual bool ShouldStrafe(CStateManager&, float) { return false; }
|
|
|
|
virtual bool ShouldSpecialAttack(CStateManager&, float) { return false; }
|
|
|
|
virtual bool LostInterest(CStateManager&, float) { return false; }
|
|
|
|
virtual bool CodeTrigger(CStateManager&, float) { return false; }
|
|
|
|
virtual bool BounceFind(CStateManager&, float) { return false; }
|
|
|
|
virtual bool Random(CStateManager&, float) { return false; }
|
|
|
|
virtual bool FixedRandom(CStateManager&, float) { return false; }
|
|
|
|
virtual bool IsDizzy(CStateManager&, float) { return false; }
|
|
|
|
virtual bool ShouldCallForBackup(CStateManager&, float) { return false; }
|
2015-08-22 01:58:41 +00:00
|
|
|
};
|
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
} // namespace metaforce
|