mirror of https://github.com/AxioDL/metaforce.git
Merge pull request #254 from AxioDL/flyingpirate
CFlyingPirate implementation
This commit is contained in:
commit
7ee2a3b912
|
@ -101,6 +101,7 @@ public:
|
|||
return TObjOwnerDerivedFromIObj<T>::GetNewDerivedObject(std::move(obj));
|
||||
}
|
||||
TToken() = default;
|
||||
virtual ~TToken() = default;
|
||||
TToken(const CToken& other) : CToken(other) {}
|
||||
TToken(CToken&& other) : CToken(std::move(other)) {}
|
||||
TToken(std::unique_ptr<T>&& obj) : CToken(GetIObjObjectFor(std::move(obj))) {}
|
||||
|
@ -108,13 +109,19 @@ public:
|
|||
*this = CToken(GetIObjObjectFor(std::move(obj)));
|
||||
return this;
|
||||
}
|
||||
T* GetObj() {
|
||||
virtual void Unlock() { CToken::Unlock(); }
|
||||
virtual void Lock() { CToken::Lock(); }
|
||||
virtual T* GetObj() {
|
||||
TObjOwnerDerivedFromIObj<T>* owner = static_cast<TObjOwnerDerivedFromIObj<T>*>(CToken::GetObj());
|
||||
if (owner)
|
||||
return owner->GetObj();
|
||||
return nullptr;
|
||||
}
|
||||
const T* GetObj() const { return const_cast<TToken<T>*>(this)->GetObj(); }
|
||||
virtual const T* GetObj() const { return const_cast<TToken<T>*>(this)->GetObj(); }
|
||||
virtual TToken& operator=(const CToken& other) {
|
||||
CToken::operator=(other);
|
||||
return *this;
|
||||
}
|
||||
T* operator->() { return GetObj(); }
|
||||
const T* operator->() const { return GetObj(); }
|
||||
T& operator*() { return *GetObj(); }
|
||||
|
@ -136,20 +143,18 @@ public:
|
|||
return m_obj;
|
||||
}
|
||||
const T* GetObj() const { return const_cast<TCachedToken<T>*>(this)->GetObj(); }
|
||||
T* operator->() { return GetObj(); }
|
||||
const T* operator->() const { return GetObj(); }
|
||||
void Unlock() {
|
||||
TToken<T>::Unlock();
|
||||
m_obj = nullptr;
|
||||
}
|
||||
|
||||
TCachedToken& operator=(const TCachedToken& other) {
|
||||
CToken::operator=(other);
|
||||
TToken<T>::operator=(other);
|
||||
m_obj = nullptr;
|
||||
return *this;
|
||||
}
|
||||
TCachedToken& operator=(const CToken& other) {
|
||||
CToken::operator=(other);
|
||||
TToken<T>::operator=(other);
|
||||
m_obj = nullptr;
|
||||
return *this;
|
||||
}
|
||||
|
|
|
@ -29,9 +29,9 @@ public:
|
|||
CAnimFormatUnion(CInputStream& in, IObjectStore& store);
|
||||
~CAnimFormatUnion();
|
||||
EAnimFormat GetFormat() const { return x0_format; }
|
||||
const CAnimSource& GetAsCAnimSource() const { return *reinterpret_cast<const CAnimSource*>(x4_storage); }
|
||||
const CFBStreamedCompression& GetAsCFBStreamedCompression() const {
|
||||
return *reinterpret_cast<const CFBStreamedCompression*>(x4_storage);
|
||||
CAnimSource& GetAsCAnimSource() { return *reinterpret_cast<CAnimSource*>(x4_storage); }
|
||||
CFBStreamedCompression& GetAsCFBStreamedCompression() {
|
||||
return *reinterpret_cast<CFBStreamedCompression*>(x4_storage);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -459,7 +459,6 @@ public:
|
|||
const zeus::CVector3f& GetMoveVector() const { return x0_move; }
|
||||
const zeus::CVector3f& GetFaceVector() const { return xc_face; }
|
||||
const zeus::CVector3f& GetTargetVector() const { return x18_target; }
|
||||
void SetTargetVector(const zeus::CVector3f& target) { x18_target = target; }
|
||||
const zeus::CVector3f& GetAdditiveTargetVector() const { return x24_additiveTarget; }
|
||||
};
|
||||
|
||||
|
|
|
@ -13,16 +13,18 @@ class CLayoutDescription;
|
|||
class CPoseAsTransforms;
|
||||
|
||||
class CHierarchyPoseBuilder {
|
||||
CLayoutDescription x0_layoutDesc;
|
||||
CSegId x30_rootId;
|
||||
bool x34_hasRoot = false;
|
||||
|
||||
public:
|
||||
struct CTreeNode {
|
||||
CSegId x0_child = 0;
|
||||
CSegId x1_sibling = 0;
|
||||
zeus::CQuaternion x4_rotation;
|
||||
zeus::CVector3f x14_offset;
|
||||
};
|
||||
|
||||
private:
|
||||
CLayoutDescription x0_layoutDesc;
|
||||
CSegId x30_rootId;
|
||||
bool x34_hasRoot = false;
|
||||
TSegIdMap<CTreeNode> x38_treeMap;
|
||||
|
||||
void BuildIntoHierarchy(const CCharLayoutInfo& layout, const CSegId& boneId, const CSegId& nullId);
|
||||
|
|
|
@ -137,6 +137,7 @@ public:
|
|||
bool IsOver() const { return x68_25_over; }
|
||||
void SetNoOverTimer(bool b) { x68_28_noOverTimer = b; }
|
||||
void SetContinueSmallMovements(bool b) { x68_27_continueSmallMovements = b; }
|
||||
u32 GetImpactCount() const { return x4c_impactCount; }
|
||||
};
|
||||
|
||||
} // namespace urde
|
||||
|
|
|
@ -71,31 +71,35 @@ template <class T>
|
|||
class TSubAnimTypeToken : public TLockedToken<CAllFormatsAnimSource> {};
|
||||
|
||||
template <>
|
||||
class TSubAnimTypeToken<CAnimSource> : public TLockedToken<CAllFormatsAnimSource> {
|
||||
class TSubAnimTypeToken<CAnimSource> : public TLockedToken<CAnimSource> {
|
||||
public:
|
||||
TSubAnimTypeToken<CAnimSource>(const TLockedToken<CAllFormatsAnimSource>& token)
|
||||
: TLockedToken<CAllFormatsAnimSource>(token) {}
|
||||
TSubAnimTypeToken<CAnimSource>(const TLockedToken<CAllFormatsAnimSource>& token) : TLockedToken<CAnimSource>(token) {}
|
||||
|
||||
const CAnimSource* GetObj() const {
|
||||
const CAllFormatsAnimSource* source = TLockedToken<CAllFormatsAnimSource>::GetObj();
|
||||
CAnimSource* GetObj() {
|
||||
CAllFormatsAnimSource* source = reinterpret_cast<CAllFormatsAnimSource*>(TLockedToken<CAnimSource>::GetObj());
|
||||
return &source->GetAsCAnimSource();
|
||||
}
|
||||
const CAnimSource* operator->() const { return GetObj(); }
|
||||
const CAnimSource& operator*() const { return *GetObj(); }
|
||||
|
||||
const CAnimSource* GetObj() const {
|
||||
return const_cast<TSubAnimTypeToken<CAnimSource>*>(this)->GetObj();
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
class TSubAnimTypeToken<CFBStreamedCompression> : public TLockedToken<CAllFormatsAnimSource> {
|
||||
class TSubAnimTypeToken<CFBStreamedCompression> : public TLockedToken<CFBStreamedCompression> {
|
||||
public:
|
||||
TSubAnimTypeToken<CFBStreamedCompression>(const TLockedToken<CAllFormatsAnimSource>& token)
|
||||
: TLockedToken<CAllFormatsAnimSource>(token) {}
|
||||
: TLockedToken<CFBStreamedCompression>(token) {}
|
||||
|
||||
const CFBStreamedCompression* GetObj() const {
|
||||
const CAllFormatsAnimSource* source = TLockedToken<CAllFormatsAnimSource>::GetObj();
|
||||
CFBStreamedCompression* GetObj() {
|
||||
CAllFormatsAnimSource* source =
|
||||
reinterpret_cast<CAllFormatsAnimSource*>(TLockedToken<CFBStreamedCompression>::GetObj());
|
||||
return &source->GetAsCFBStreamedCompression();
|
||||
}
|
||||
const CFBStreamedCompression* operator->() const { return GetObj(); }
|
||||
const CFBStreamedCompression& operator*() const { return *GetObj(); }
|
||||
|
||||
const CFBStreamedCompression* GetObj() const {
|
||||
return const_cast<TSubAnimTypeToken<CFBStreamedCompression>*>(this)->GetObj();
|
||||
}
|
||||
};
|
||||
|
||||
class IAnimReader {
|
||||
|
|
|
@ -708,7 +708,7 @@ void CBabygoth::FollowPattern(CStateManager& mgr, EStateMsg msg, float) {
|
|||
CBCStepCmd(pas::EStepDirection::Backward, pas::EStepType::Normal));
|
||||
} else if (x568_stateProg == 3) {
|
||||
if (x450_bodyController->GetBodyStateInfo().GetCurrentStateId() == pas::EAnimationState::Step)
|
||||
x450_bodyController->GetCommandMgr().SetTargetVector(mgr.GetPlayer().GetTranslation() - GetTranslation());
|
||||
x450_bodyController->GetCommandMgr().DeliverTargetVector(mgr.GetPlayer().GetTranslation() - GetTranslation());
|
||||
else
|
||||
x568_stateProg = 4;
|
||||
}
|
||||
|
|
|
@ -446,7 +446,7 @@ void CChozoGhost::Attack(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
xfc_constantForce.zeroOut();
|
||||
} else if (msg == EStateMsg::Update) {
|
||||
TryCommand(mgr, pas::EAnimationState::MeleeAttack, &CPatterned::TryMeleeAttack, x67c_attackType);
|
||||
GetBodyController()->GetCommandMgr().SetTargetVector(mgr.GetPlayer().GetTranslation() - GetTranslation());
|
||||
GetBodyController()->GetCommandMgr().DeliverTargetVector(mgr.GetPlayer().GetTranslation() - GetTranslation());
|
||||
if (x67c_attackType != 2)
|
||||
FloatToLevel(x678_floorLevel, dt);
|
||||
} else if (msg == EStateMsg::Deactivate) {
|
||||
|
|
|
@ -785,7 +785,7 @@ void CFlaahgra::Growth(CStateManager& mgr, EStateMsg msg, float arg) {
|
|||
UpdateScale((x7c4_ > 0.f ? 1.f - (GetEndActionTime() / x7c4_) : 1.f), x81c_, x56c_.x4_);
|
||||
}
|
||||
|
||||
x450_bodyController->GetCommandMgr().SetTargetVector(mgr.GetPlayer().GetTranslation() - GetTranslation());
|
||||
x450_bodyController->GetCommandMgr().DeliverTargetVector(mgr.GetPlayer().GetTranslation() - GetTranslation());
|
||||
}
|
||||
} else if (msg == EStateMsg::Deactivate) {
|
||||
UpdateScale(1.f, x81c_, x56c_.x4_);
|
||||
|
@ -983,7 +983,7 @@ void CFlaahgra::Attack(CStateManager& mgr, EStateMsg msg, float arg) {
|
|||
if (x450_bodyController->GetBodyStateInfo().GetCurrentStateId() != pas::EAnimationState::MeleeAttack)
|
||||
x568_ = 4;
|
||||
else
|
||||
x450_bodyController->GetCommandMgr().SetTargetVector(x78c_);
|
||||
x450_bodyController->GetCommandMgr().DeliverTargetVector(x78c_);
|
||||
}
|
||||
} else if (msg == EStateMsg::Deactivate) {
|
||||
SetCollisionActorBounds(mgr, x79c_leftArmCollision, {});
|
||||
|
@ -1100,7 +1100,7 @@ void CFlaahgra::ProjectileAttack(CStateManager& mgr, EStateMsg msg, float) {
|
|||
if (x450_bodyController->GetBodyStateInfo().GetCurrentStateId() != pas::EAnimationState::ProjectileAttack) {
|
||||
x568_ = 4;
|
||||
} else {
|
||||
x450_bodyController->GetCommandMgr().SetTargetVector(mgr.GetPlayer().GetTranslation() - GetTranslation());
|
||||
x450_bodyController->GetCommandMgr().DeliverTargetVector(mgr.GetPlayer().GetTranslation() - GetTranslation());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1135,7 +1135,7 @@ void CFlaahgra::Cover(CStateManager& mgr, EStateMsg msg, float) {
|
|||
if (x450_bodyController->GetBodyStateInfo().GetCurrentStateId() != pas::EAnimationState::MeleeAttack)
|
||||
x568_ = 4;
|
||||
else if (TCastToConstPtr<CActor> wp = mgr.GetObjectById(x77c_)) {
|
||||
x450_bodyController->GetCommandMgr().SetTargetVector(wp->GetTranslation() - GetTranslation());
|
||||
x450_bodyController->GetCommandMgr().DeliverTargetVector(wp->GetTranslation() - GetTranslation());
|
||||
}
|
||||
}
|
||||
} else if (msg == EStateMsg::Deactivate) {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,12 @@
|
|||
#pragma once
|
||||
|
||||
#include "Runtime/Character/CBoneTracking.hpp"
|
||||
#include "Runtime/Character/CRagDoll.hpp"
|
||||
#include "Runtime/Particle/CElementGen.hpp"
|
||||
#include "Runtime/Weapon/CBurstFire.hpp"
|
||||
#include "Runtime/Weapon/CProjectileInfo.hpp"
|
||||
#include "Runtime/World/CAi.hpp"
|
||||
#include "Runtime/World/CPathFindSearch.hpp"
|
||||
#include "Runtime/World/CPatterned.hpp"
|
||||
|
||||
namespace urde::MP1 {
|
||||
|
@ -7,7 +14,200 @@ class CFlyingPirate : public CPatterned {
|
|||
public:
|
||||
DEFINE_PATTERNED(FlyingPirate)
|
||||
|
||||
private:
|
||||
class CFlyingPirateData {
|
||||
friend class CFlyingPirate;
|
||||
float x0_maxCoverDistance;
|
||||
float x4_hearingDistance;
|
||||
u32 x8_;
|
||||
CProjectileInfo xc_gunProjectileInfo;
|
||||
u16 x34_gunSfx;
|
||||
CProjectileInfo x38_altProjectileInfo1;
|
||||
CProjectileInfo x60_altProjectileInfo2;
|
||||
float x88_knockBackDelay;
|
||||
float x8c_flyingHeight;
|
||||
TCachedToken<CGenDescription> x90_particleGenDesc;
|
||||
CDamageInfo x9c_dInfo;
|
||||
float xb8_;
|
||||
float xbc_;
|
||||
float xc0_;
|
||||
float xc4_;
|
||||
u16 xc8_ragDollSfx1;
|
||||
u16 xca_ragDollSfx2;
|
||||
float xcc_coverCheckChance;
|
||||
float xd0_;
|
||||
float xd4_;
|
||||
CAssetId xd8_particleGen1;
|
||||
CAssetId xdc_particleGen2;
|
||||
CAssetId xe0_particleGen3;
|
||||
u16 xe4_knockBackSfx;
|
||||
u16 xe6_deathSfx;
|
||||
float xe8_aggressionChance;
|
||||
float xec_;
|
||||
float xf0_projectileHomingDistance;
|
||||
|
||||
public:
|
||||
CFlyingPirateData(CInputStream& in, u32 propCount);
|
||||
};
|
||||
|
||||
class CFlyingPirateRagDoll : public CRagDoll {
|
||||
private:
|
||||
CFlyingPirate* x6c_actor;
|
||||
float x70_ = 0.f;
|
||||
zeus::CVector3f x74_ = zeus::skUp;
|
||||
float x80_ = 0.f;
|
||||
float x84_ = 5.f;
|
||||
u16 x88_sfx;
|
||||
float x8c_ = 0.f;
|
||||
zeus::CVector3f x90_ = zeus::skZero3f;
|
||||
u16 x9c_;
|
||||
CSfxHandle xa0_;
|
||||
zeus::CVector3f xa4_;
|
||||
bool xb0_24_ : 1;
|
||||
|
||||
public:
|
||||
CFlyingPirateRagDoll(CStateManager& mgr, CFlyingPirate* actor, u16 w1, u16 w2);
|
||||
|
||||
void PreRender(const zeus::CVector3f& v, CModelData& mData) override;
|
||||
void Prime(CStateManager& mgr, const zeus::CTransform& xf, CModelData& mData) override;
|
||||
void Update(CStateManager& mgr, float dt, float waterTop) override;
|
||||
};
|
||||
|
||||
public:
|
||||
CFlyingPirate(TUniqueId, std::string_view, const CEntityInfo&, const zeus::CTransform&, CModelData&&,
|
||||
const CActorParameters&, const CPatternedInfo&, CInputStream&, u32);
|
||||
|
||||
void Accept(IVisitor& visitor) override { visitor.Visit(this); }
|
||||
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) override;
|
||||
void AddToRenderer(const zeus::CFrustum& frustum, const CStateManager& mgr) const override;
|
||||
bool AnimOver(CStateManager& mgr, float arg) override;
|
||||
void CalculateRenderBounds() override;
|
||||
void DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EUserEventType type, float dt) override;
|
||||
void MassiveDeath(CStateManager& mgr) override;
|
||||
float GetGravityConstant() const override { return x6a0_25_isUnderwater ? 5.f : 50.f; }
|
||||
CPathFindSearch* GetSearchPath() override { return &x6a8_pathFindSearch; }
|
||||
bool IsListening() const override { return true; }
|
||||
bool KnockbackWhenFrozen() const override { return false; }
|
||||
bool Listen(const zeus::CVector3f& pos, EListenNoiseType type) override;
|
||||
void PreRender(CStateManager& mgr, const zeus::CFrustum& frustum) override;
|
||||
CProjectileInfo* GetProjectileInfo() override { return &x568_data.xc_gunProjectileInfo; }
|
||||
void Think(float dt, CStateManager& mgr) override;
|
||||
|
||||
void Attack(CStateManager& mgr, EStateMsg msg, float arg) override;
|
||||
void Bounce(CStateManager& mgr, EStateMsg msg, float arg) override;
|
||||
void Deactivate(CStateManager& mgr, EStateMsg msg, float arg) override;
|
||||
void Dead(CStateManager& mgr, EStateMsg msg, float arg) override;
|
||||
void Dodge(CStateManager& mgr, EStateMsg msg, float arg) override;
|
||||
void Enraged(CStateManager& mgr, EStateMsg msg, float arg) override;
|
||||
void Explode(CStateManager& mgr, EStateMsg msg, float arg) override;
|
||||
void GetUp(CStateManager& mgr, EStateMsg msg, float arg) override;
|
||||
void Jump(CStateManager& mgr, EStateMsg msg, float arg) override;
|
||||
void KnockBack(const zeus::CVector3f& pos, CStateManager& mgr, const CDamageInfo& info, EKnockBackType type,
|
||||
bool inDeferred, float magnitude) override;
|
||||
void Land(CStateManager& mgr, EStateMsg msg, float arg) override;
|
||||
void Lurk(CStateManager& mgr, EStateMsg msg, float arg) override;
|
||||
void PathFind(CStateManager& mgr, EStateMsg msg, float arg) override;
|
||||
void Patrol(CStateManager& mgr, EStateMsg msg, float arg) override;
|
||||
void ProjectileAttack(CStateManager& mgr, EStateMsg msg, float arg) override;
|
||||
void Retreat(CStateManager& mgr, EStateMsg msg, float arg) override;
|
||||
void TargetPatrol(CStateManager& mgr, EStateMsg msg, float arg) override;
|
||||
void Taunt(CStateManager& mgr, EStateMsg msg, float arg) override;
|
||||
void TurnAround(CStateManager& mgr, EStateMsg msg, float arg) override;
|
||||
void Walk(CStateManager& mgr, EStateMsg msg, float arg) override;
|
||||
|
||||
bool AggressionCheck(CStateManager& mgr, float arg) override;
|
||||
bool Attacked(CStateManager& mgr, float arg) override;
|
||||
bool CoverCheck(CStateManager& mgr, float arg) override;
|
||||
bool CoverFind(CStateManager& mgr, float arg) override;
|
||||
bool HearPlayer(CStateManager& mgr, float arg) override;
|
||||
bool HearShot(CStateManager& mgr, float arg) override;
|
||||
bool InPosition(CStateManager& mgr, float arg) override;
|
||||
bool InRange(CStateManager& mgr, float arg) override;
|
||||
bool Landed(CStateManager& mgr, float arg) override;
|
||||
bool LineOfSight(CStateManager& mgr, float arg) override;
|
||||
bool PatternOver(CStateManager& mgr, float arg) override;
|
||||
bool ShotAt(CStateManager& mgr, float arg) override;
|
||||
bool ShouldAttack(CStateManager& mgr, float arg) override;
|
||||
bool ShouldDodge(CStateManager& mgr, float arg) override;
|
||||
bool ShouldMove(CStateManager& mgr, float arg) override;
|
||||
bool ShouldRetreat(CStateManager& mgr, float arg) override;
|
||||
bool ShouldSpecialAttack(CStateManager& mgr, float arg) override;
|
||||
bool SpotPlayer(CStateManager& mgr, float arg) override;
|
||||
bool Stuck(CStateManager& mgr, float arg) override;
|
||||
|
||||
private:
|
||||
CFlyingPirateData x568_data;
|
||||
rstl::reserved_vector<TCachedToken<CGenDescription>, 3> x65c_particleGenDescs;
|
||||
// was rstl::reserved_vector<rstl::optional_object<CElementGen *>, 3>
|
||||
rstl::reserved_vector<std::unique_ptr<CElementGen>, 3> x684_particleGens;
|
||||
bool x6a0_24_ : 1;
|
||||
bool x6a0_25_isUnderwater : 1;
|
||||
bool x6a0_26_hearShot : 1;
|
||||
bool x6a0_27_canPatrol : 1;
|
||||
bool x6a0_28_ : 1;
|
||||
bool x6a0_29_checkForProjectiles : 1;
|
||||
bool x6a0_30_ : 1;
|
||||
bool x6a0_31_canSeePlayer : 1;
|
||||
bool x6a1_24_prevInCineCam : 1;
|
||||
bool x6a1_25_ : 1;
|
||||
bool x6a1_26_isAttackingObject : 1;
|
||||
bool x6a1_27_ : 1;
|
||||
bool x6a1_28_ : 1;
|
||||
bool x6a1_29_isMoving : 1;
|
||||
bool x6a1_30_spinToDeath : 1;
|
||||
bool x6a1_31_stopped : 1;
|
||||
bool x6a2_24_aggressive : 1;
|
||||
bool x6a2_25_aggressionChecked : 1;
|
||||
bool x6a2_26_jetpackActive : 1;
|
||||
bool x6a2_27_sparksActive : 1;
|
||||
bool x6a2_28_ : 1;
|
||||
TUniqueId x6a4_currentCoverPoint = kInvalidUniqueId;
|
||||
TUniqueId x6a6_id2 = kInvalidUniqueId;
|
||||
CPathFindSearch x6a8_pathFindSearch;
|
||||
float x78c_ = 0.f; // not initialized in constructor?
|
||||
int x790_ = 0;
|
||||
int x794_health;
|
||||
CSegId x798_headSegId;
|
||||
int x79c_ = -1;
|
||||
CBoneTracking x7a0_boneTracking;
|
||||
float x7d8_ = 0.f;
|
||||
int x7dc_ = 0;
|
||||
CSegId x7e0_gunSegId;
|
||||
float x7e4_ = 1.f;
|
||||
TUniqueId x7e8_targetId = kInvalidUniqueId;
|
||||
CBurstFire x7ec_burstFire;
|
||||
pas::EStepDirection x84c_dodgeDirection = pas::EStepDirection::Invalid;
|
||||
float x850_height = 3.f;
|
||||
float x854_ = FLT_MAX;
|
||||
float x858_ = FLT_MAX;
|
||||
TUniqueId x85c_attackObjectId = kInvalidUniqueId;
|
||||
float x860_ = 15.f;
|
||||
rstl::reserved_vector<CSegId, 4> x864_missileSegments;
|
||||
float x86c_ = 0.f;
|
||||
zeus::CVector3f x870_ = zeus::skZero3f;
|
||||
zeus::CVector3f x87c_ = zeus::skZero3f;
|
||||
float x888_ = 10.f;
|
||||
float x88c_ragDollTimer = 3.f;
|
||||
TUniqueId x890_teamAiMgr = kInvalidUniqueId;
|
||||
float x894_pitchBend = 1.f;
|
||||
float x898_ = 1.f;
|
||||
std::unique_ptr<CFlyingPirateRagDoll> x89c_ragDoll;
|
||||
TUniqueId x8a0_patrolTarget = kInvalidUniqueId;
|
||||
float x8a4_ = 0.f;
|
||||
|
||||
zeus::CVector3f AvoidActors(CStateManager& mgr);
|
||||
bool CanFireMissiles(CStateManager& mgr);
|
||||
void CheckForProjectiles(CStateManager& mgr);
|
||||
void FireProjectile(CStateManager& mgr, float dt);
|
||||
pas::EStepDirection GetDodgeDirection(CStateManager& mgr, float arg);
|
||||
zeus::CVector3f GetTargetPos(CStateManager& mgr);
|
||||
bool LineOfSightTest(CStateManager& mgr, const zeus::CVector3f& start, const zeus::CVector3f& end,
|
||||
CMaterialList exclude);
|
||||
void UpdateLandingSmoke(CStateManager& mgr, bool active);
|
||||
void UpdateParticleEffects(CStateManager& mgr, float intensity, bool active);
|
||||
void DeliverGetUp();
|
||||
void UpdateCanSeePlayer(CStateManager& mgr);
|
||||
void AddToTeam(CStateManager& mgr);
|
||||
void RemoveFromTeam(CStateManager& mgr);
|
||||
};
|
||||
} // namespace urde::MP1
|
|
@ -107,7 +107,7 @@ void CJellyZap::Suck(CStateManager& mgr, EStateMsg msg, float arg) {
|
|||
RemoveAllAttractors(mgr);
|
||||
} else if (msg == EStateMsg::Update) {
|
||||
TryCommand(mgr, pas::EAnimationState::LoopReaction, &CPatterned::TryLoopReaction, 0);
|
||||
x450_bodyController->GetCommandMgr().SetTargetVector(
|
||||
x450_bodyController->GetCommandMgr().DeliverTargetVector(
|
||||
(mgr.GetPlayer().GetTranslation() + zeus::CVector3f(0.f, 0.f, 1.f)) - GetTranslation());
|
||||
|
||||
float intensity = mgr.GetPlayerState()->HasPowerUp(CPlayerState::EItemType::GravitySuit) ? 0.1f : 1.f;
|
||||
|
@ -133,7 +133,7 @@ void CJellyZap::Active(CStateManager& mgr, EStateMsg msg, float arg) {
|
|||
} else if (msg == EStateMsg::Update) {
|
||||
zeus::CVector3f targetVector =
|
||||
GetTranslation() - (zeus::CVector3f(0.f, 0.f, 1.f) + mgr.GetPlayer().GetTranslation());
|
||||
x450_bodyController->GetCommandMgr().SetTargetVector(targetVector);
|
||||
x450_bodyController->GetCommandMgr().DeliverTargetVector(targetVector);
|
||||
if (x5b8_26_) {
|
||||
zeus::CVector3f moveToImpulse =
|
||||
GetMoveToORImpulseWR(GetTransform().transposeRotate(arg * (zeus::CVector3f(0.f, 1.f, 0.f) * x598_)), arg);
|
||||
|
|
|
@ -144,7 +144,7 @@ void CMetaree::Active(CStateManager& mgr, EStateMsg msg, float) {
|
|||
x450_bodyController->GetCommandMgr().DeliverCmd(CBCGenerateCmd(pas::EGenerateType::Zero, x584_lookPos));
|
||||
SetMomentumWR({0.f, 0.f, -GetGravityConstant() * GetMass()});
|
||||
} else if (msg == EStateMsg::Update) {
|
||||
x450_bodyController->GetCommandMgr().SetTargetVector(
|
||||
x450_bodyController->GetCommandMgr().DeliverTargetVector(
|
||||
(mgr.GetPlayer().GetTranslation() - GetTranslation()).normalized());
|
||||
} else if (msg == EStateMsg::Deactivate) {
|
||||
SetMomentumWR({});
|
||||
|
|
|
@ -466,20 +466,20 @@ CSpacePirate::CSpacePirate(TUniqueId uid, std::string_view name, const CEntityIn
|
|||
|
||||
if (x634_29_onlyAttackInRange)
|
||||
x460_knockBackController.SetKnockBackVariant(EKnockBackVariant::Small);
|
||||
else if (x636_24_trooper && GetDamageVulnerability()->WeaponHurts(CWeaponMode(EWeaponType::Plasma), false))
|
||||
else if (x636_24_trooper && x260_damageVulnerability.WeaponHurts(CWeaponMode(EWeaponType::Plasma), false))
|
||||
x460_knockBackController.SetKnockBackVariant(EKnockBackVariant::Large);
|
||||
|
||||
if (!x450_bodyController->HasBodyState(pas::EAnimationState::AdditiveAim))
|
||||
x634_27_melee = true;
|
||||
|
||||
if (x636_24_trooper) {
|
||||
if (GetDamageVulnerability()->WeaponHurts(CWeaponMode(EWeaponType::Plasma), false))
|
||||
if (x260_damageVulnerability.WeaponHurts(CWeaponMode(EWeaponType::Plasma), false))
|
||||
x8cc_trooperColor = zeus::CColor(0.996f, 0.f, 0.157f, 1.f);
|
||||
else if (GetDamageVulnerability()->WeaponHurts(CWeaponMode(EWeaponType::Ice), false))
|
||||
else if (x260_damageVulnerability.WeaponHurts(CWeaponMode(EWeaponType::Ice), false))
|
||||
x8cc_trooperColor = zeus::skWhite;
|
||||
else if (GetDamageVulnerability()->WeaponHurts(CWeaponMode(EWeaponType::Power), false))
|
||||
else if (x260_damageVulnerability.WeaponHurts(CWeaponMode(EWeaponType::Power), false))
|
||||
x8cc_trooperColor = zeus::CColor(0.992f, 0.937f, 0.337f, 1.f);
|
||||
else if (GetDamageVulnerability()->WeaponHurts(CWeaponMode(EWeaponType::Wave), false))
|
||||
else if (x260_damageVulnerability.WeaponHurts(CWeaponMode(EWeaponType::Wave), false))
|
||||
x8cc_trooperColor = zeus::CColor(0.776f, 0.054f, 1.f, 1.f);
|
||||
}
|
||||
|
||||
|
@ -1497,7 +1497,7 @@ void CSpacePirate::TargetPatrol(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
}
|
||||
}
|
||||
if (r28)
|
||||
x450_bodyController->GetCommandMgr().SetTargetVector(mgr.GetPlayer().GetTranslation() - GetTranslation());
|
||||
x450_bodyController->GetCommandMgr().DeliverTargetVector(mgr.GetPlayer().GetTranslation() - GetTranslation());
|
||||
}
|
||||
x828_patrolDestPos = x2e0_destPos;
|
||||
break;
|
||||
|
@ -1553,7 +1553,7 @@ void CSpacePirate::Generate(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
TryCommand(mgr, pas::EAnimationState::Jump, &CPatterned::TryJump, x634_25_ceilingAmbush ? 2 : 0);
|
||||
if (x32c_animState == EAnimState::Repeat)
|
||||
x450_bodyController->SetLocomotionType(pas::ELocomotionType::Combat);
|
||||
x450_bodyController->GetCommandMgr().SetTargetVector(mgr.GetPlayer().GetTranslation() - GetTranslation());
|
||||
x450_bodyController->GetCommandMgr().DeliverTargetVector(mgr.GetPlayer().GetTranslation() - GetTranslation());
|
||||
break;
|
||||
case EStateMsg::Deactivate:
|
||||
x32c_animState = EAnimState::NotReady;
|
||||
|
@ -1609,7 +1609,7 @@ void CSpacePirate::Attack(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
case EStateMsg::Update:
|
||||
if (x636_26_enableMeleeAttack) {
|
||||
TryCommand(mgr, pas::EAnimationState::MeleeAttack, &CPatterned::TryMeleeAttack, 1);
|
||||
x450_bodyController->GetCommandMgr().SetTargetVector(x648_targetDelta);
|
||||
x450_bodyController->GetCommandMgr().DeliverTargetVector(x648_targetDelta);
|
||||
CheckBlade(mgr);
|
||||
if (x635_27_shadowPirate) {
|
||||
if (x32c_animState == EAnimState::Over) {
|
||||
|
@ -1668,7 +1668,7 @@ void CSpacePirate::JumpBack(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
if (!x639_25_useJumpBackJump) {
|
||||
x450_bodyController->GetCommandMgr().DeliverCmd(
|
||||
CBCStepCmd(pas::EStepDirection::Backward, pas::EStepType::Normal));
|
||||
x450_bodyController->GetCommandMgr().SetTargetVector(GetTargetPos(mgr) - GetTranslation());
|
||||
x450_bodyController->GetCommandMgr().DeliverTargetVector(GetTargetPos(mgr) - GetTranslation());
|
||||
} else {
|
||||
TryCommand(mgr, pas::EAnimationState::Jump, &CPatterned::TryJump, 0);
|
||||
}
|
||||
|
@ -1713,7 +1713,7 @@ void CSpacePirate::DoubleSnap(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
}
|
||||
if (x639_30_closeMelee)
|
||||
x648_targetDelta = GetTargetPos(mgr) - GetTranslation();
|
||||
x450_bodyController->GetCommandMgr().SetTargetVector(x648_targetDelta);
|
||||
x450_bodyController->GetCommandMgr().DeliverTargetVector(x648_targetDelta);
|
||||
if (x635_27_shadowPirate) {
|
||||
if (x32c_animState == EAnimState::Over) {
|
||||
x3e8_alphaDelta = -0.4f;
|
||||
|
@ -1829,7 +1829,7 @@ void CSpacePirate::Crouch(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
x79c_coverDir = pas::ECoverDirection::Invalid;
|
||||
break;
|
||||
case EStateMsg::Update:
|
||||
x450_bodyController->GetCommandMgr().SetTargetVector(x648_targetDelta);
|
||||
x450_bodyController->GetCommandMgr().DeliverTargetVector(x648_targetDelta);
|
||||
UpdateCantSeePlayer(mgr);
|
||||
break;
|
||||
default:
|
||||
|
@ -2089,7 +2089,7 @@ void CSpacePirate::Cover(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
case EStateMsg::Update:
|
||||
TryCommand(mgr, pas::EAnimationState::Cover, &CPatterned::TryCover, int(x79c_coverDir));
|
||||
if (CScriptCoverPoint* cp = GetCoverPoint(mgr, x640_coverPoint))
|
||||
x450_bodyController->GetCommandMgr().SetTargetVector(-cp->GetTransform().basis[1]);
|
||||
x450_bodyController->GetCommandMgr().DeliverTargetVector(-cp->GetTransform().basis[1]);
|
||||
UpdateCantSeePlayer(mgr);
|
||||
break;
|
||||
case EStateMsg::Deactivate:
|
||||
|
@ -2134,7 +2134,7 @@ void CSpacePirate::WallHang(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
break;
|
||||
case EStateMsg::Update:
|
||||
TryCommand(mgr, pas::EAnimationState::WallHang, &CSpacePirate::TryWallHang, 0);
|
||||
x450_bodyController->GetCommandMgr().SetTargetVector(mgr.GetPlayer().GetTranslation() - GetTranslation());
|
||||
x450_bodyController->GetCommandMgr().DeliverTargetVector(mgr.GetPlayer().GetTranslation() - GetTranslation());
|
||||
x7c4_burstFire.SetBurstType(1);
|
||||
break;
|
||||
case EStateMsg::Deactivate:
|
||||
|
@ -2173,7 +2173,7 @@ void CSpacePirate::SpecialAttack(CStateManager& mgr, EStateMsg msg, float dt) {
|
|||
case EStateMsg::Update:
|
||||
TryCommand(mgr, pas::EAnimationState::ProjectileAttack, &CPatterned::TryProjectileAttack, int(pas::ESeverity::One));
|
||||
if (x32c_animState == EAnimState::Ready)
|
||||
x450_bodyController->GetCommandMgr().SetTargetVector(x648_targetDelta);
|
||||
x450_bodyController->GetCommandMgr().DeliverTargetVector(x648_targetDelta);
|
||||
break;
|
||||
case EStateMsg::Deactivate:
|
||||
x32c_animState = EAnimState::NotReady;
|
||||
|
|
|
@ -333,5 +333,6 @@ public:
|
|||
u8 GetModelAlphau8(const CStateManager& mgr) const override;
|
||||
float GetGravityConstant() const override;
|
||||
CProjectileInfo* GetProjectileInfo() override;
|
||||
bool GetEnableAim() const { return x637_25_enableAim; }
|
||||
};
|
||||
} // namespace urde::MP1
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
namespace urde {
|
||||
class CPlayer;
|
||||
class CProjectileInfo {
|
||||
TToken<CWeaponDescription> x0_weaponDescription;
|
||||
TCachedToken<CWeaponDescription> x0_weaponDescription;
|
||||
CDamageInfo xc_damageInfo;
|
||||
|
||||
public:
|
||||
|
@ -24,6 +24,6 @@ public:
|
|||
|
||||
const CDamageInfo& GetDamage() const { return xc_damageInfo; }
|
||||
void SetDamage(const CDamageInfo& damageInfo) { xc_damageInfo = damageInfo; }
|
||||
TToken<CWeaponDescription>& Token() { return x0_weaponDescription; }
|
||||
TCachedToken<CWeaponDescription>& Token() { return x0_weaponDescription; }
|
||||
};
|
||||
} // namespace urde
|
||||
|
|
|
@ -55,7 +55,7 @@ public:
|
|||
virtual void TakeDamage(const zeus::CVector3f& direction, float magnitude) {}
|
||||
virtual bool CanBeShot(const CStateManager&, int) { return true; }
|
||||
virtual bool IsListening() const { return false; }
|
||||
virtual bool Listen(const zeus::CVector3f&, EListenNoiseType) { return 0; }
|
||||
virtual bool Listen(const zeus::CVector3f&, EListenNoiseType) { return false; }
|
||||
|
||||
virtual zeus::CVector3f GetOrigin(const CStateManager& mgr, const CTeamAiRole& role,
|
||||
const zeus::CVector3f& aimPos) const {
|
||||
|
|
|
@ -130,6 +130,7 @@ public:
|
|||
void Update(float dt, CStateManager& mgr, CPatterned& parent);
|
||||
void KnockBack(const zeus::CVector3f& backVec, CStateManager& mgr, CPatterned& parent, const CDamageInfo& info,
|
||||
EKnockBackType type, float magnitude);
|
||||
void SetSeverity(pas::ESeverity v) { x7c_severity = v; }
|
||||
void SetEnableFreeze(bool b) { x81_25_enableFreeze = b; }
|
||||
void SetEnableShock(bool b) { x81_26_enableShock = b; }
|
||||
void SetEnableBurn(bool b) { x81_27_enableBurn = b; }
|
||||
|
|
|
@ -379,6 +379,7 @@ public:
|
|||
bool sendCollideMsg, const zeus::CVector3f& scale);
|
||||
void DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EUserEventType type, float dt) override;
|
||||
|
||||
const zeus::CVector3f& GetDestPos() const { return x2e0_destPos; }
|
||||
void SetDestPos(const zeus::CVector3f& pos) { x2e0_destPos = pos; }
|
||||
void UpdateAlphaDelta(float dt, CStateManager& mgr);
|
||||
void SetModelAlpha(float a) { x42c_color.a() = a; }
|
||||
|
|
|
@ -1365,7 +1365,7 @@ CEntity* ScriptLoader::LoadFlyingPirate(CStateManager& mgr, CInputStream& in, in
|
|||
|
||||
SScaledActorHead actHead = LoadScaledActorHead(in, mgr);
|
||||
auto pair = CPatternedInfo::HasCorrectParameterCount(in);
|
||||
if (pair.first)
|
||||
if (!pair.first)
|
||||
return nullptr;
|
||||
|
||||
CPatternedInfo pInfo(in, pair.second);
|
||||
|
|
Loading…
Reference in New Issue