metaforce/Runtime/MP1/World/CSpacePirate.hpp

312 lines
11 KiB
C++
Raw Normal View History

2018-10-07 03:42:33 +00:00
#pragma once
2016-06-21 07:11:49 +00:00
#include "World/CPatterned.hpp"
#include "Weapon/CProjectileInfo.hpp"
2018-11-24 08:09:35 +00:00
#include "Character/CBoneTracking.hpp"
#include "Character/CIkChain.hpp"
#include "Character/CRagDoll.hpp"
#include "World/CPathFindSearch.hpp"
#include "Weapon/CBurstFire.hpp"
2016-06-21 07:11:49 +00:00
2017-12-29 08:08:12 +00:00
namespace urde::MP1
2016-06-21 07:11:49 +00:00
{
2018-11-24 08:09:35 +00:00
class CSpacePirate;
class CPirateRagDoll : public CRagDoll
{
CSpacePirate* x6c_spacePirate;
2018-11-26 02:15:44 +00:00
u16 x70_thudSfx;
float x74_sfxTimer = 0.f;
zeus::CVector3f x78_lastSFXPos;
zeus::CVector3f x84_torsoImpulse;
2018-11-24 08:09:35 +00:00
rstl::reserved_vector<TUniqueId, 4> x90_waypoints;
rstl::reserved_vector<u32, 4> x9c_wpParticleIdxs;
2018-11-26 02:15:44 +00:00
bool xb0_24_initSfx : 1;
2018-11-24 08:09:35 +00:00
public:
2018-11-26 02:15:44 +00:00
CPirateRagDoll(CStateManager& mgr, CSpacePirate* sp, u16 thudSfx, u32 flags);
2018-11-24 08:09:35 +00:00
void PreRender(const zeus::CVector3f& v, CModelData& mData);
2018-11-26 02:15:44 +00:00
void Update(CStateManager& mgr, float dt, float waterTop);
2018-11-24 08:09:35 +00:00
void Prime(CStateManager& mgr, const zeus::CTransform& xf, CModelData& mData);
};
2016-06-21 07:11:49 +00:00
class CSpacePirate : public CPatterned
{
2018-11-24 08:09:35 +00:00
friend class CPirateRagDoll;
2018-09-14 00:49:34 +00:00
public:
DEFINE_PATTERNED(SpacePirate)
private:
class CSpacePirateData
{
2018-11-24 08:09:35 +00:00
friend class CSpacePirate;
float x0_;
float x4_;
float x8_;
float xc_;
float x10_;
2018-11-26 02:15:44 +00:00
float x14_hearNoiseRange;
u32 x18_flags;
bool x1c_;
2018-11-26 02:15:44 +00:00
CProjectileInfo x20_mainProjectileInfo;
u16 x48_;
CDamageInfo x4c_;
float x68_;
CProjectileInfo x6c_;
float x94_;
2018-11-26 02:15:44 +00:00
u16 x98_ragdollThudSfx;
float x9c_averageNextShotTime;
float xa0_nextShotTimeVariation;
u16 xa4_;
2018-11-26 02:15:44 +00:00
float xa8_aimDelayTime;
2018-11-24 08:09:35 +00:00
u32 xac_firstBurstCount;
2018-11-26 02:15:44 +00:00
float xb0_minCloakAlpha;
float xb4_maxCloakAlpha;
float xb8_;
float xbc_;
u16 xc0_;
u16 xc2_;
float xc4_;
float xc8_;
public:
CSpacePirateData(CInputStream&, u32);
};
2018-11-24 08:09:35 +00:00
CSpacePirateData x568_pirateData;
union
{
struct
{
2018-11-26 02:15:44 +00:00
bool x634_24_pendingAmbush : 1;
bool x634_25_ceilingAmbush : 1;
bool x634_26_ : 1;
2018-11-26 02:15:44 +00:00
bool x634_27_melee : 1;
bool x634_28_ : 1;
2018-11-26 02:15:44 +00:00
bool x634_29_onlyAttackInRange : 1;
bool x634_30_ : 1;
bool x634_31_ : 1;
bool x635_24_ : 1;
bool x635_25_ : 1;
bool x635_26_ : 1;
2018-11-26 02:15:44 +00:00
bool x635_27_shadowPirate : 1;
bool x635_28_ : 1;
bool x635_29_ : 1;
2018-11-26 02:15:44 +00:00
bool x635_30_ragdollKeepAlive : 1;
bool x635_31_ragdollNoAiCollision : 1;
2018-11-24 08:09:35 +00:00
bool x636_24_trooper : 1;
2018-11-26 02:15:44 +00:00
bool x636_25_hearNoise : 1;
2018-11-24 08:09:35 +00:00
bool x636_26_ : 1;
bool x636_27_ : 1;
bool x636_28_ : 1;
bool x636_29_ : 1;
bool x636_30_ : 1;
bool x636_31_ : 1;
bool x637_24_ : 1;
bool x637_25_ : 1;
2018-11-26 02:15:44 +00:00
bool x637_26_hearPlayerFire : 1;
bool x637_27_inProjectilePath : 1;
2018-11-24 08:09:35 +00:00
bool x637_28_ : 1;
bool x637_29_ : 1;
bool x637_30_ : 1;
bool x637_31_prevInCineCam : 1;
2018-11-26 02:15:44 +00:00
bool x638_24_pendingFrenzyChance : 1;
2018-11-24 08:09:35 +00:00
bool x638_25_ : 1;
bool x638_26_ : 1;
bool x638_27_ : 1;
bool x638_28_ : 1;
bool x638_29_ : 1;
2018-11-26 02:15:44 +00:00
bool x638_30_ragdollOver : 1;
2018-11-24 08:09:35 +00:00
bool x638_31_ : 1;
bool x639_24_ : 1;
bool x639_25_ : 1;
bool x639_26_ : 1;
bool x639_27_ : 1;
bool x639_28_ : 1;
bool x639_29_ : 1;
bool x639_30_ : 1;
bool x639_31_ : 1;
bool x63a_24_ : 1;
};
2018-11-24 08:09:35 +00:00
u64 _dummy = 0;
};
2018-11-26 02:15:44 +00:00
s32 x63c_frenzyFrames = 0;
2018-11-24 08:09:35 +00:00
TUniqueId x640_ = kInvalidUniqueId;
TUniqueId x642_ = kInvalidUniqueId;
float x644_ = 1.f;
zeus::CVector3f x648_ = zeus::CVector3f::skForward;
zeus::CVector3f x654_;
2018-11-26 02:15:44 +00:00
CPathFindSearch x660_pathFindSearch;
2018-11-24 08:09:35 +00:00
float x744_ = 0.f;
float x748_ = 0.f;
u32 x74c_ = 0;
2018-11-26 02:15:44 +00:00
float x750_initialHP;
2018-11-24 08:09:35 +00:00
float x754_ = 0.f;
CSegId x758_headSeg;
u32 x75c_ = 0;
s32 x760_ = -1;
2018-11-26 02:15:44 +00:00
CBoneTracking x764_boneTracking;
2018-11-24 08:09:35 +00:00
s32 x79c_ = -1;
float x7a4_intoJumpDist = 1.f;
float x7a8_ = 2.f;
float x7ac_ = 0.f;
u32 x7b0_ = 0;
TUniqueId x7b4_ = kInvalidUniqueId;
CSegId x7b6_gunSeg;
CSegId x7b7_elbowSeg;
CSegId x7b8_wristSeg;
CSegId x7b9_swooshSeg;
float x7bc_ = 1.f;
2018-11-26 02:15:44 +00:00
TUniqueId x7c0_targetId = kInvalidUniqueId;
CBurstFire x7c4_burstFire;
2018-11-24 08:09:35 +00:00
float x824_ = 3.f;
zeus::CVector3f x828_;
s32 x834_ = -1;
float x838_ = 0.f;
s32 x83c_ = -1;
TUniqueId x840_ = kInvalidUniqueId;
s32 x844_ = -1;
float x848_dodgeDist = 3.f;
float x84c_breakDodgeDist = 3.f;
2018-11-26 02:15:44 +00:00
float x850_timeSinceHitByPlayer = FLT_MAX;
float x854_lowHealthFrenzyTimer = FLT_MAX;
float x858_ragdollDelayTimer = 0.f;
2018-11-24 08:09:35 +00:00
std::unique_ptr<CPirateRagDoll> x85c_ragDoll;
CIkChain x860_ikChain;
2018-11-26 02:15:44 +00:00
float x8a8_cloakDelayTimer = 0.f;
float x8ac_electricParticleTimer = 0.f;
float x8b0_cloakStepTime = 0.f;
float x8b4_shadowPirateAlpha = 0.5f;
float x8b8_minCloakAlpha;
float x8bc_maxCloakAlpha;
2018-11-24 08:09:35 +00:00
float x8c0_;
2018-11-26 02:15:44 +00:00
float x8c4_aimDelayTimer;
TUniqueId x8c8_teamAiMgrId = kInvalidUniqueId;
2018-11-24 08:09:35 +00:00
zeus::CColor x8cc_trooperColor = zeus::CColor::skWhite;
zeus::CVector2f x8d0_;
float x8d8_ = 0.f;
float x8dc_ = 0.f;
static const SBurst skBurstsSeatedOOV[];
static const SBurst skBurstsInjuredOOV[];
static const SBurst skBurstsJumpingOOV[];
static const SBurst skBurstsFrenziedOOV[];
static const SBurst skBurstsStandardOOV[];
static const SBurst skBurstsQuickOOV[];
static const SBurst skBurstsSeated[];
static const SBurst skBurstsInjured[];
static const SBurst skBurstsJumping[];
static const SBurst skBurstsFrenzied[];
static const SBurst skBurstsStandard[];
static const SBurst skBurstsQuick[];
static const SBurst* skBursts[];
2018-11-26 02:15:44 +00:00
static std::list<TUniqueId> mChargePlayerList;
void UpdateCloak(float dt, CStateManager& mgr);
bool ShouldFrenzy(CStateManager& mgr);
void ResetTeamAiRole(CStateManager& mgr);
bool CheckTargetable(CStateManager& mgr);
void FireProjectile(float dt, CStateManager& mgr);
void UpdateAttacks(float dt, CStateManager& mgr);
zeus::CVector3f GetTargetPos(CStateManager& mgr);
void UpdateAimBodyState(float dt, CStateManager& mgr);
void SetCinematicCollision(CStateManager& mgr);
void SetNonCinematicCollision(CStateManager& mgr);
void CheckForProjectiles(CStateManager& mgr);
2016-06-21 07:11:49 +00:00
public:
2017-11-13 06:19:18 +00:00
CSpacePirate(TUniqueId, std::string_view, const CEntityInfo&, const zeus::CTransform&, CModelData&&,
2016-06-21 07:11:49 +00:00
const CActorParameters&, const CPatternedInfo&, CInputStream&, u32);
2017-01-18 22:30:02 +00:00
void Accept(IVisitor &visitor);
2018-11-26 02:15:44 +00:00
void Think(float dt, CStateManager& mgr);
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CStateManager& mgr);
void PreRender(CStateManager& mgr, const zeus::CFrustum& frustum);
void Render(const CStateManager& mgr) const;
void CalculateRenderBounds();
void Touch(CActor& other, CStateManager& mgr);
zeus::CAABox GetSortingBounds(const CStateManager& mgr) const;
void DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EUserEventType type, float dt);
void Death(CStateManager& mgr, const zeus::CVector3f& direction, EScriptObjectState state);
void KnockBack(const zeus::CVector3f&, CStateManager&, const CDamageInfo& info,
EKnockBackType type, bool inDeferred, float magnitude);
bool IsListening() const;
bool Listen(const zeus::CVector3f&, EListenNoiseType);
zeus::CVector3f GetOrigin(const CStateManager& mgr, const CTeamAiRole& role) const;
void Patrol(CStateManager&, EStateMsg, float);
void Dead(CStateManager&, EStateMsg, float);
void PathFind(CStateManager&, EStateMsg, float);
void TargetPatrol(CStateManager&, EStateMsg, float);
void TargetCover(CStateManager&, EStateMsg, float);
void Halt(CStateManager&, EStateMsg, float);
void Run(CStateManager&, EStateMsg, float);
void Generate(CStateManager&, EStateMsg, float);
void Deactivate(CStateManager&, EStateMsg, float);
void Attack(CStateManager&, EStateMsg, float);
void JumpBack(CStateManager&, EStateMsg, float);
void DoubleSnap(CStateManager&, EStateMsg, float);
void Shuffle(CStateManager&, EStateMsg, float);
void TurnAround(CStateManager&, EStateMsg, float);
void Skid(CStateManager&, EStateMsg, float);
void CoverAttack(CStateManager&, EStateMsg, float);
void Crouch(CStateManager&, EStateMsg, float);
void GetUp(CStateManager&, EStateMsg, float);
void Taunt(CStateManager&, EStateMsg, float);
void Flee(CStateManager&, EStateMsg, float);
void Lurk(CStateManager&, EStateMsg, float);
void Jump(CStateManager&, EStateMsg, float);
void Dodge(CStateManager&, EStateMsg, float);
void Cover(CStateManager&, EStateMsg, float);
void Approach(CStateManager&, EStateMsg, float);
void WallHang(CStateManager&, EStateMsg, float);
void WallDetach(CStateManager&, EStateMsg, float);
void Enraged(CStateManager&, EStateMsg, float);
void SpecialAttack(CStateManager&, EStateMsg, float);
void Bounce(CStateManager&, EStateMsg, float);
void PathFindEx(CStateManager&, EStateMsg, float);
bool Leash(CStateManager&, float);
bool OffLine(CStateManager&, float);
bool Attacked(CStateManager&, float);
bool InRange(CStateManager&, float);
bool SpotPlayer(CStateManager&, float);
bool PatternOver(CStateManager&, float);
bool PatternShagged(CStateManager&, float);
bool AnimOver(CStateManager&, float);
bool ShouldAttack(CStateManager&, float);
bool ShouldJumpBack(CStateManager&, float);
bool Stuck(CStateManager&, float);
bool Landed(CStateManager&, float);
bool HearShot(CStateManager&, float);
bool HearPlayer(CStateManager&, float);
bool CoverCheck(CStateManager&, float);
bool CoverFind(CStateManager&, float);
bool CoverBlown(CStateManager&, float);
bool CoverNearlyBlown(CStateManager&, float);
bool CoveringFire(CStateManager&, float);
bool LineOfSight(CStateManager&, float);
bool AggressionCheck(CStateManager&, float);
bool ShouldDodge(CStateManager&, float);
bool ShouldRetreat(CStateManager&, float);
bool ShouldCrouch(CStateManager&, float);
bool ShouldMove(CStateManager&, float);
bool ShotAt(CStateManager&, float);
bool HasTargetingPoint(CStateManager&, float);
bool ShouldWallHang(CStateManager&, float);
bool StartAttack(CStateManager&, float);
bool BreakAttack(CStateManager&, float);
bool ShouldStrafe(CStateManager&, float);
bool ShouldSpecialAttack(CStateManager&, float);
bool LostInterest(CStateManager&, float);
bool BounceFind(CStateManager&, float);
CPathFindSearch* GetSearchPath();
u8 GetModelAlphau8(const CStateManager& mgr) const;
float GetGravityConstant() const;
CProjectileInfo* GetProjectileInfo();
2016-06-21 07:11:49 +00:00
};
}