mirror of https://github.com/AxioDL/metaforce.git
More CFlaahgraImps
This commit is contained in:
parent
6df0fcde50
commit
a67ea52617
|
@ -80,7 +80,7 @@ enum class EStepType { Normal = 0, Dodge = 1, BreakDodge = 2, RollDodge = 3 };
|
||||||
|
|
||||||
enum class ESeverity { Invalid = -1, Zero = 0, One = 1, Two = 2, Eight = 8 };
|
enum class ESeverity { Invalid = -1, Zero = 0, One = 1, Two = 2, Eight = 8 };
|
||||||
|
|
||||||
enum class EGetupType { Invalid = -1, Zero = 0, One = 1 };
|
enum class EGetupType { Invalid = -1, Zero = 0, One = 1, Two = 2 };
|
||||||
|
|
||||||
enum class ELoopState { Invalid = -1, Begin, Loop, End };
|
enum class ELoopState { Invalid = -1, Begin, Loop, End };
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
#include "CFlaahgra.hpp"
|
#include "CFlaahgra.hpp"
|
||||||
|
#include "Camera/CCameraManager.hpp"
|
||||||
|
#include "Camera/CFirstPersonCamera.hpp"
|
||||||
#include "CDependencyGroup.hpp"
|
#include "CDependencyGroup.hpp"
|
||||||
#include "Character/CBoneTracking.hpp"
|
#include "Character/CBoneTracking.hpp"
|
||||||
#include "Collision/CCollisionActor.hpp"
|
#include "Collision/CCollisionActor.hpp"
|
||||||
#include "Collision/CCollisionActorManager.hpp"
|
#include "Collision/CCollisionActorManager.hpp"
|
||||||
|
#include "Graphics/CBooRenderer.hpp"
|
||||||
#include "MP1/World/CFlaahgraProjectile.hpp"
|
#include "MP1/World/CFlaahgraProjectile.hpp"
|
||||||
#include "Particle/CElementGen.hpp"
|
#include "Particle/CElementGen.hpp"
|
||||||
#include "World/CActorParameters.hpp"
|
#include "World/CActorParameters.hpp"
|
||||||
|
@ -156,7 +159,7 @@ void CFlaahgra::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateM
|
||||||
if (HealthInfo(mgr)->GetHP() <= 0.f)
|
if (HealthInfo(mgr)->GetHP() <= 0.f)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (!sub801aebb8(uid))
|
if (!IsSphereCollider(uid))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (TCastToConstPtr<CCollisionActor> colAct = mgr.GetObjectById(uid)) {
|
if (TCastToConstPtr<CCollisionActor> colAct = mgr.GetObjectById(uid)) {
|
||||||
|
@ -228,6 +231,16 @@ void CFlaahgra::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateM
|
||||||
CPatterned::AcceptScriptMsg(msg, uid, mgr);
|
CPatterned::AcceptScriptMsg(msg, uid, mgr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CFlaahgra::AddToRenderer(const zeus::CFrustum& frustum, const urde::CStateManager& mgr) const {
|
||||||
|
if ((!GetModelData()->HasAnimData() && !GetModelData()->HasNormalModel()) || xe4_30_outOfFrustum)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (CanRenderUnsorted(mgr))
|
||||||
|
Render(mgr);
|
||||||
|
else
|
||||||
|
EnsureRendered(mgr);
|
||||||
|
}
|
||||||
|
|
||||||
void CFlaahgra::Death(CStateManager& mgr, const zeus::CVector3f& dir, EScriptObjectState state) {
|
void CFlaahgra::Death(CStateManager& mgr, const zeus::CVector3f& dir, EScriptObjectState state) {
|
||||||
if (!x400_25_alive)
|
if (!x400_25_alive)
|
||||||
return;
|
return;
|
||||||
|
@ -240,10 +253,9 @@ void CFlaahgra::Death(CStateManager& mgr, const zeus::CVector3f& dir, EScriptObj
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFlaahgra::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EUserEventType type, float dt) {
|
void CFlaahgra::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, EUserEventType type, float dt) {
|
||||||
switch(type) {
|
switch (type) {
|
||||||
case EUserEventType::Projectile: {
|
case EUserEventType::Projectile: {
|
||||||
// TODO: Implement
|
return;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case EUserEventType::BeginAction: {
|
case EUserEventType::BeginAction: {
|
||||||
x8e4_26_ = true;
|
x8e4_26_ = true;
|
||||||
|
@ -251,8 +263,8 @@ void CFlaahgra::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, E
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EUserEventType::ScreenShake: {
|
case EUserEventType::ScreenShake: {
|
||||||
// TODO: Implement
|
RattlePlayer(mgr, GetLctrTransform(node.GetLocatorName()).origin);
|
||||||
break;
|
return;
|
||||||
}
|
}
|
||||||
case EUserEventType::AlignTargetRot: {
|
case EUserEventType::AlignTargetRot: {
|
||||||
if (x77c_ == kInvalidUniqueId)
|
if (x77c_ == kInvalidUniqueId)
|
||||||
|
@ -265,14 +277,33 @@ void CFlaahgra::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node, E
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EUserEventType::GenerateEnd: {
|
case EUserEventType::GenerateEnd: {
|
||||||
// TODO: Implement
|
zeus::CVector3f boneOrigin = GetLctrTransform(node.GetLocatorName()).origin;
|
||||||
|
zeus::CVector3f aimPos = mgr.GetPlayer().GetAimPosition(mgr, 0.f);
|
||||||
|
boneOrigin.z() = zeus::max<float>(aimPos.z(), boneOrigin.z());
|
||||||
|
zeus::CTransform xf = GetTransform();
|
||||||
|
xf.origin = boneOrigin;
|
||||||
|
|
||||||
|
CRayCastResult res = mgr.RayStaticIntersection(xf.origin, zeus::skDown, 100.f,
|
||||||
|
CMaterialFilter::MakeInclude({EMaterialTypes::Floor}));
|
||||||
|
|
||||||
|
if (res.IsValid()) {
|
||||||
|
#if 0
|
||||||
|
CFlaahgraPlants* plants = new CFlaahgraPlants(x6d4_, x56c_.xd8_, mgr.AllocateUniqueId(), GetAreaIdAlways(),
|
||||||
|
GetUniqueId(), xf, x56c_.xbc_, {5.f, 10.f, 5.f});
|
||||||
|
mgr.AddObject(plants);
|
||||||
|
mgr.SetActorAreaId(*plants, GetAreaIdAlways());
|
||||||
|
#endif
|
||||||
|
x7cc_ = 8.f;
|
||||||
|
}
|
||||||
|
x8e4_27_ = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EUserEventType::ObjectDrop: {
|
case EUserEventType::ObjectDrop: {
|
||||||
SendScriptMsgs(EScriptObjectState::Modify, mgr, EScriptObjectMessage::None);
|
SendScriptMsgs(EScriptObjectState::Modify, mgr, EScriptObjectMessage::None);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: break;
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
CPatterned::DoUserAnimEvent(mgr, node, type, dt);
|
CPatterned::DoUserAnimEvent(mgr, node, type, dt);
|
||||||
|
@ -429,7 +460,7 @@ void CFlaahgra::SetupHealthInfo(CStateManager& mgr) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
x818_ = HealthInfo(mgr)->GetHP();
|
x818_curHp = HealthInfo(mgr)->GetHP();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFlaahgra::SetupCollisionManagers(CStateManager& mgr) {
|
void CFlaahgra::SetupCollisionManagers(CStateManager& mgr) {
|
||||||
|
@ -506,11 +537,13 @@ void CFlaahgra::FadeOut(CStateManager& mgr, EStateMsg msg, float) {
|
||||||
x450_bodyController->SetLocomotionType(pas::ELocomotionType::Relaxed);
|
x450_bodyController->SetLocomotionType(pas::ELocomotionType::Relaxed);
|
||||||
x8e5_29_ = false;
|
x8e5_29_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFlaahgra::UpdateCollisionManagers(float dt, CStateManager& mgr) {
|
void CFlaahgra::UpdateCollisionManagers(float dt, CStateManager& mgr) {
|
||||||
x7a4_sphereCollision->Update(dt, mgr, CCollisionActorManager::EUpdateOptions::ObjectSpace);
|
x7a4_sphereCollision->Update(dt, mgr, CCollisionActorManager::EUpdateOptions::ObjectSpace);
|
||||||
x79c_leftArmCollision->Update(dt, mgr, CCollisionActorManager::EUpdateOptions::ObjectSpace);
|
x79c_leftArmCollision->Update(dt, mgr, CCollisionActorManager::EUpdateOptions::ObjectSpace);
|
||||||
x7a0_rightArmCollision->Update(dt, mgr, CCollisionActorManager::EUpdateOptions::ObjectSpace);
|
x7a0_rightArmCollision->Update(dt, mgr, CCollisionActorManager::EUpdateOptions::ObjectSpace);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFlaahgra::UpdateSmallScaleReGrowth(float dt) {
|
void CFlaahgra::UpdateSmallScaleReGrowth(float dt) {
|
||||||
if (x7c0_ > 0.f)
|
if (x7c0_ > 0.f)
|
||||||
x7c0_ -= (x788_ < 2 ? dt : 1.25f * dt);
|
x7c0_ -= (x788_ < 2 ? dt : 1.25f * dt);
|
||||||
|
@ -538,15 +571,15 @@ void CFlaahgra::UpdateHealthInfo(CStateManager& mgr) {
|
||||||
if (TCastToPtr<CCollisionActor> colAct = mgr.ObjectById(uid)) {
|
if (TCastToPtr<CCollisionActor> colAct = mgr.ObjectById(uid)) {
|
||||||
CHealthInfo* inf = colAct->HealthInfo(mgr);
|
CHealthInfo* inf = colAct->HealthInfo(mgr);
|
||||||
|
|
||||||
tmp = zeus::max(tmp, x818_ - inf->GetHP());
|
tmp = zeus::max(tmp, x818_curHp - inf->GetHP());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x780_ == 3) {
|
if (x780_ == 3) {
|
||||||
if (!IsDizzy(mgr, 0.f))
|
if (!IsDizzy(mgr, 0.f))
|
||||||
x814_ += tmp;
|
x814_ += tmp;
|
||||||
else
|
else
|
||||||
x810_ += tmp;
|
x810_ += tmp;
|
||||||
} else {
|
} else {
|
||||||
x814_ = 0.f;
|
x814_ = 0.f;
|
||||||
x810_ = 0.f;
|
x810_ = 0.f;
|
||||||
|
@ -560,7 +593,7 @@ void CFlaahgra::UpdateHealthInfo(CStateManager& mgr) {
|
||||||
}
|
}
|
||||||
for (const TUniqueId& uid : x7fc_sphereColliders) {
|
for (const TUniqueId& uid : x7fc_sphereColliders) {
|
||||||
if (TCastToPtr<CCollisionActor> colAct = mgr.ObjectById(uid)) {
|
if (TCastToPtr<CCollisionActor> colAct = mgr.ObjectById(uid)) {
|
||||||
colAct->HealthInfo(mgr)->SetHP(x818_);
|
colAct->HealthInfo(mgr)->SetHP(x818_curHp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -626,7 +659,12 @@ void CFlaahgra::TurnAround(CStateManager& mgr, EStateMsg msg, float) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool CFlaahgra::sub801ae670() { return (x7a8_ == 2 || x7a8_ == 3 || x7a8_ == 4); }
|
bool CFlaahgra::sub801ae670() { return (x7a8_ == 2 || x7a8_ == 3 || x7a8_ == 4); }
|
||||||
bool CFlaahgra::sub801aebb8(TUniqueId) { return false; }
|
bool CFlaahgra::IsSphereCollider(TUniqueId uid) {
|
||||||
|
|
||||||
|
auto it = std::find(x7fc_sphereColliders.begin(), x7fc_sphereColliders.end(), uid);
|
||||||
|
return it != x7fc_sphereColliders.end();
|
||||||
|
}
|
||||||
|
|
||||||
void CFlaahgra::GetUp(CStateManager& mgr, EStateMsg msg, float) {
|
void CFlaahgra::GetUp(CStateManager& mgr, EStateMsg msg, float) {
|
||||||
if (msg == EStateMsg::Activate) {
|
if (msg == EStateMsg::Activate) {
|
||||||
x568_ = 0;
|
x568_ = 0;
|
||||||
|
@ -642,7 +680,8 @@ void CFlaahgra::GetUp(CStateManager& mgr, EStateMsg msg, float) {
|
||||||
} else {
|
} else {
|
||||||
x450_bodyController->GetCommandMgr().DeliverCmd(CBCGetupCmd(pas::EGetupType(x8e4_29_getup)));
|
x450_bodyController->GetCommandMgr().DeliverCmd(CBCGetupCmd(pas::EGetupType(x8e4_29_getup)));
|
||||||
}
|
}
|
||||||
} else if (x568_ == 2 && x450_bodyController->GetBodyStateInfo().GetCurrentStateId() != pas::EAnimationState::Getup) {
|
} else if (x568_ == 2 &&
|
||||||
|
x450_bodyController->GetBodyStateInfo().GetCurrentStateId() != pas::EAnimationState::Getup) {
|
||||||
x568_ = 4;
|
x568_ = 4;
|
||||||
}
|
}
|
||||||
} else if (msg == EStateMsg::Deactivate) {
|
} else if (msg == EStateMsg::Deactivate) {
|
||||||
|
@ -688,7 +727,6 @@ void CFlaahgra::Growth(CStateManager& mgr, EStateMsg msg, float arg) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CFlaahgra::SetCollisionActorBounds(CStateManager& mgr, const std::unique_ptr<CCollisionActorManager>& colMgr,
|
void CFlaahgra::SetCollisionActorBounds(CStateManager& mgr, const std::unique_ptr<CCollisionActorManager>& colMgr,
|
||||||
const zeus::CVector3f& extendedBounds) {
|
const zeus::CVector3f& extendedBounds) {
|
||||||
for (u32 i = 0; i < colMgr->GetNumCollisionActors(); ++i) {
|
for (u32 i = 0; i < colMgr->GetNumCollisionActors(); ++i) {
|
||||||
|
@ -738,21 +776,161 @@ zeus::CVector3f CFlaahgra::GetAttacktargetPos(CStateManager& mgr) const {
|
||||||
return mgr.GetPlayer().GetTranslation() + zeus::CVector3f(0.f, 0.f, -.5f + mgr.GetPlayer().GetEyeHeight());
|
return mgr.GetPlayer().GetTranslation() + zeus::CVector3f(0.f, 0.f, -.5f + mgr.GetPlayer().GetEyeHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CFlaahgra::RattlePlayer(CStateManager& mgr, const zeus::CVector3f& vec) {
|
||||||
|
CPlayer& player = mgr.GetPlayer();
|
||||||
|
/*
|
||||||
|
zeus::CVector3f direction = vec - mgr.GetPlayer().GetTranslation();
|
||||||
|
float dir = direction.magnitude(); Unused
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (player.GetSurfaceRestraint() == CPlayer::ESurfaceRestraints::Air || player.IsInWaterMovement())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (player.GetMorphballTransitionState() != CPlayer::EPlayerMorphBallState::Morphed) {
|
||||||
|
if (mgr.GetCameraManager()->GetFirstPersonCamera()->GetUniqueId() != mgr.GetCameraManager()->GetCurrentCameraId())
|
||||||
|
return;
|
||||||
|
|
||||||
|
mgr.GetCameraManager()->AddCameraShaker(CCameraShakeData(2.f, 0.75f), true);
|
||||||
|
} else {
|
||||||
|
player.ApplyImpulseWR((mgr.GetPlayer().GetMass() * 0.75f) * (25.f * zeus::skUp), {});
|
||||||
|
player.SetMoveState(CPlayer::EPlayerMovementState::ApplyJump, mgr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static const pas::ESeverity kSeverities[2]{pas::ESeverity::Zero, pas::ESeverity::Eight};
|
||||||
|
void CFlaahgra::Faint(CStateManager& mgr, EStateMsg msg, float arg) {
|
||||||
|
if (msg == EStateMsg::Activate) {
|
||||||
|
x568_ = 0;
|
||||||
|
x7d4_ = 0.f;
|
||||||
|
x8e5_24_ = false;
|
||||||
|
x7f8_ = 0;
|
||||||
|
SendScriptMsgs(EScriptObjectState::Entered, mgr, EScriptObjectMessage::None);
|
||||||
|
SendScriptMsgs(EScriptObjectState::Retreat, mgr, EScriptObjectMessage::None);
|
||||||
|
x450_bodyController->GetCommandMgr().DeliverCmd(
|
||||||
|
CBCKnockBackCmd(-GetTransform().frontVector(), kSeverities[u32(x7ac_)]));
|
||||||
|
} else if (msg == EStateMsg::Update) {
|
||||||
|
if (x568_ == 0) {
|
||||||
|
if (x450_bodyController->GetBodyStateInfo().GetCurrentStateId() == pas::EAnimationState::Fall) {
|
||||||
|
x568_ = 2;
|
||||||
|
sub801ade80();
|
||||||
|
UpdateHeadDamageVulnerability(mgr, true);
|
||||||
|
} else {
|
||||||
|
x450_bodyController->GetCommandMgr().DeliverCmd(
|
||||||
|
CBCKnockBackCmd(-GetTransform().frontVector(), kSeverities[u32(x7ac_)]));
|
||||||
|
}
|
||||||
|
} else if (x568_ == 2) {
|
||||||
|
if (x450_bodyController->GetBodyStateInfo().GetCurrentStateId() == pas::EAnimationState::LieOnGround) {
|
||||||
|
x7d4_ += arg;
|
||||||
|
if (x7d4_ >= x56c_.xc_)
|
||||||
|
x568_ = 4;
|
||||||
|
else
|
||||||
|
x450_bodyController->FaceDirection(x894_, arg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (msg == EStateMsg::Deactivate) {
|
||||||
|
x8e4_27_ = false;
|
||||||
|
x7ac_ = !x7ac_;
|
||||||
|
x780_ = 3;
|
||||||
|
UpdateHeadDamageVulnerability(mgr, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CFlaahgra::Dead(CStateManager& mgr, EStateMsg msg, float) {
|
||||||
|
if (msg == EStateMsg::Activate) {
|
||||||
|
bool r29 = true;
|
||||||
|
if (x450_bodyController->GetFallState() == pas::EFallState::Zero &&
|
||||||
|
x450_bodyController->GetBodyStateInfo().GetCurrentStateId() == pas::EAnimationState::Fall)
|
||||||
|
r29 = false;
|
||||||
|
x568_ = r29;
|
||||||
|
SendScriptMsgs(EScriptObjectState::CloseIn, mgr, EScriptObjectMessage::None);
|
||||||
|
} else if (msg == EStateMsg::Update) {
|
||||||
|
if (x568_ == 0) {
|
||||||
|
if (x450_bodyController->GetBodyStateInfo().GetCurrentStateId() == pas::EAnimationState::Getup)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (x450_bodyController->GetBodyStateInfo().GetCurrentStateId() != pas::EAnimationState::Fall) {
|
||||||
|
x450_bodyController->GetCommandMgr().DeliverCmd(
|
||||||
|
CBCKnockDownCmd(-GetTransform().frontVector(), pas::ESeverity::Two));
|
||||||
|
} else {
|
||||||
|
x568_ = 2;
|
||||||
|
zeus::CTransform xf = zeus::lookAt(GetTranslation(), GetTranslation() + x8a0_, zeus::skUp);
|
||||||
|
xf.origin = GetTranslation();
|
||||||
|
SetTransform(xf);
|
||||||
|
SendScriptMsgs(EScriptObjectState::Dead, mgr, EScriptObjectMessage::None);
|
||||||
|
x8e5_26_ = true;
|
||||||
|
}
|
||||||
|
} else if (x568_ == 1) {
|
||||||
|
if (x450_bodyController->GetBodyStateInfo().GetCurrentStateId() == pas::EAnimationState::Getup) {
|
||||||
|
x568_ = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
x450_bodyController->GetCommandMgr().DeliverCmd(CBCGetupCmd(pas::EGetupType::Two));
|
||||||
|
} else if (x568_ == 2 && x450_bodyController->GetBodyStateInfo().GetCurrentStateId() != pas::EAnimationState::Fall)
|
||||||
|
mgr.FreeScriptObject(GetUniqueId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void CFlaahgra::Attack(CStateManager& mgr, EStateMsg msg, float) {
|
||||||
|
if (msg == EStateMsg::Activate) {
|
||||||
|
x568_ = 0;
|
||||||
|
x7a8_ = sub801ae828(mgr);
|
||||||
|
SendScriptMsgs(EScriptObjectState::Attack, mgr, EScriptObjectMessage::None);
|
||||||
|
} else if (msg == EStateMsg::Update) {
|
||||||
|
if (x568_ == 0) {
|
||||||
|
|
||||||
|
} else if (x568_ == 1) {
|
||||||
|
|
||||||
|
} else if (x568_ == 2) {
|
||||||
|
if (x450_bodyController->GetBodyStateInfo().GetCurrentStateId() != pas::EAnimationState::MeleeAttack)
|
||||||
|
x568_ = 4;
|
||||||
|
else
|
||||||
|
x450_bodyController->GetCommandMgr().SetTargetVector(x78c_);
|
||||||
|
}
|
||||||
|
} else if (msg == EStateMsg::Deactivate) {
|
||||||
|
SetCollisionActorBounds(x79c_leftArmCollision, {});
|
||||||
|
SetCollisionActorBounds(x7a0_rightArmCollision, {});
|
||||||
|
|
||||||
|
if (sub801ae670())
|
||||||
|
x7c0_ = (1.f + x788_) / (x308_attackTimeVariation * mgr.GetActiveRandom()->Float() + x304_averageAttackTime);
|
||||||
|
|
||||||
|
x7a8_ = -1;
|
||||||
|
|
||||||
|
if (x450_bodyController->GetBodyStateInfo().GetCurrentStateId() == pas::EAnimationState::MeleeAttack) {
|
||||||
|
x450_bodyController->GetCommandMgr().DeliverCmd(CBodyStateCmd(EBodyStateCmd::NextState));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 CFlaahgra::sub801ae828(CStateManager& mgr) {
|
||||||
|
const CPlayer& player = mgr.GetPlayer();
|
||||||
|
if (player.GetMorphballTransitionState() != CPlayer::EPlayerMorphBallState::Morphed) {
|
||||||
|
if (x7cc_ > 0.f || player.GetVelocity().magSquared() < 25.f)
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GetTransform().basis[0].dot(player.GetVelocity()) > 0.f)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
CFlaahgraPlants::CFlaahgraPlants(const TToken<CGenDescription>& genDesc, const CActorParameters& actParms,
|
CFlaahgraPlants::CFlaahgraPlants(const TToken<CGenDescription>& genDesc, const CActorParameters& actParms,
|
||||||
TUniqueId uid, TAreaId aId, TUniqueId owner, const zeus::CTransform& xf,
|
TUniqueId uid, TAreaId aId, TUniqueId owner, const zeus::CTransform& xf,
|
||||||
const CDamageInfo& dInfo, const zeus::CVector3f& extents)
|
const CDamageInfo& dInfo, const zeus::CVector3f& extents)
|
||||||
: CActor(uid, true, "Flaahgra Plants"sv, CEntityInfo(aId, NullConnectionList), xf, CModelData::CModelDataNull(),
|
: CActor(uid, true, "Flaahgra Plants"sv, CEntityInfo(aId, NullConnectionList), xf, CModelData::CModelDataNull(),
|
||||||
CMaterialList(EMaterialTypes::Projectile), actParms, kInvalidUniqueId)
|
CMaterialList(EMaterialTypes::Projectile), actParms, kInvalidUniqueId)
|
||||||
, xe8_elementGen(new CElementGen(genDesc))
|
, xe8_elementGen(new CElementGen(genDesc))
|
||||||
, xf0_ownerId(owner)
|
, xf0_ownerId(owner)
|
||||||
, x130_obbox(xf, extents) {
|
, x130_obbox(xf, extents) {
|
||||||
xe8_elementGen->SetGlobalOrientation(xf.getRotation());
|
xe8_elementGen->SetGlobalOrientation(xf.getRotation());
|
||||||
xe8_elementGen->SetGlobalTranslation(xf.origin);
|
xe8_elementGen->SetGlobalTranslation(xf.origin);
|
||||||
x110_aabox = {x130_obbox.calculateAABox(xf)};
|
x110_aabox = {x130_obbox.calculateAABox(xf)};
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFlaahgraPlants::Accept(IVisitor& visitor) {
|
void CFlaahgraPlants::Accept(IVisitor& visitor) {
|
||||||
visitor.Visit(this);
|
visitor.Visit(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFlaahgraPlants::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) {
|
void CFlaahgraPlants::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) {
|
||||||
CActor::AcceptScriptMsg(msg, uid, mgr);
|
CActor::AcceptScriptMsg(msg, uid, mgr);
|
||||||
|
|
||||||
|
@ -788,6 +966,7 @@ void CFlaahgraPlants::Think(float dt, CStateManager& mgr) {
|
||||||
if (xe8_elementGen->IsSystemDeletable())
|
if (xe8_elementGen->IsSystemDeletable())
|
||||||
mgr.FreeScriptObject(GetUniqueId());
|
mgr.FreeScriptObject(GetUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CFlaahgraPlants::AddToRenderer(const zeus::CFrustum& frustum, const CStateManager& mgr) const {
|
void CFlaahgraPlants::AddToRenderer(const zeus::CFrustum& frustum, const CStateManager& mgr) const {
|
||||||
g_Renderer->AddParticleGen(*xe8_elementGen.get());
|
g_Renderer->AddParticleGen(*xe8_elementGen.get());
|
||||||
CActor::AddToRenderer(frustum, mgr);
|
CActor::AddToRenderer(frustum, mgr);
|
||||||
|
|
|
@ -98,7 +98,7 @@ class CFlaahgra : public CPatterned {
|
||||||
std::unique_ptr<CCollisionActorManager> x7a0_rightArmCollision;
|
std::unique_ptr<CCollisionActorManager> x7a0_rightArmCollision;
|
||||||
std::unique_ptr<CCollisionActorManager> x7a4_sphereCollision;
|
std::unique_ptr<CCollisionActorManager> x7a4_sphereCollision;
|
||||||
s32 x7a8_ = -1;
|
s32 x7a8_ = -1;
|
||||||
u32 x7ac_ = 1;
|
bool x7ac_ = true;
|
||||||
u32 x7b0_ = 1;
|
u32 x7b0_ = 1;
|
||||||
s32 x7b4_ = -1;
|
s32 x7b4_ = -1;
|
||||||
float x7b8_ = 0.f;
|
float x7b8_ = 0.f;
|
||||||
|
@ -116,7 +116,7 @@ class CFlaahgra : public CPatterned {
|
||||||
TUniqueId x80c_headActor = kInvalidUniqueId;
|
TUniqueId x80c_headActor = kInvalidUniqueId;
|
||||||
float x810_ = 0.f;
|
float x810_ = 0.f;
|
||||||
float x814_ = 0.f;
|
float x814_ = 0.f;
|
||||||
float x818_ = 0.f;
|
float x818_curHp = 0.f;
|
||||||
float x81c_ = 0.f;
|
float x81c_ = 0.f;
|
||||||
zeus::CVector3f x820_;
|
zeus::CVector3f x820_;
|
||||||
u32 x82c_ = 0;
|
u32 x82c_ = 0;
|
||||||
|
@ -164,7 +164,7 @@ class CFlaahgra : public CPatterned {
|
||||||
void UpdateAimPosition(CStateManager&, float);
|
void UpdateAimPosition(CStateManager&, float);
|
||||||
void SetMaterialProperties(const std::unique_ptr<CCollisionActorManager>&, CStateManager&);
|
void SetMaterialProperties(const std::unique_ptr<CCollisionActorManager>&, CStateManager&);
|
||||||
bool sub801ae670();
|
bool sub801ae670();
|
||||||
bool sub801aebb8(TUniqueId);
|
bool IsSphereCollider(TUniqueId);
|
||||||
void SetCollisionActorBounds(CStateManager& mgr, const std::unique_ptr<CCollisionActorManager>& colMgr,
|
void SetCollisionActorBounds(CStateManager& mgr, const std::unique_ptr<CCollisionActorManager>& colMgr,
|
||||||
const zeus::CVector3f& extendedBounds);
|
const zeus::CVector3f& extendedBounds);
|
||||||
|
|
||||||
|
@ -172,8 +172,12 @@ class CFlaahgra : public CPatterned {
|
||||||
float GetEndActionTime();
|
float GetEndActionTime();
|
||||||
void SetupHealthInfo(CStateManager&);
|
void SetupHealthInfo(CStateManager&);
|
||||||
zeus::CVector3f GetAttacktargetPos(CStateManager&) const;
|
zeus::CVector3f GetAttacktargetPos(CStateManager&) const;
|
||||||
|
void RattlePlayer(CStateManager& mgr, const zeus::CVector3f& vec);
|
||||||
bool sub801e4f8() { return x7a8_ == 0 || x7a8_ == 1; }
|
bool sub801e4f8() { return x7a8_ == 0 || x7a8_ == 1; }
|
||||||
|
void sub801ade80() {}
|
||||||
void UpdateHeadDamageVulnerability(CStateManager&, bool);
|
void UpdateHeadDamageVulnerability(CStateManager&, bool);
|
||||||
|
|
||||||
|
u32 sub801ae828(CStateManager&);
|
||||||
public:
|
public:
|
||||||
DEFINE_PATTERNED(Flaahgra);
|
DEFINE_PATTERNED(Flaahgra);
|
||||||
CFlaahgra(TUniqueId, std::string_view, const CEntityInfo&, const zeus::CTransform&, const CAnimRes&,
|
CFlaahgra(TUniqueId, std::string_view, const CEntityInfo&, const zeus::CTransform&, const CAnimRes&,
|
||||||
|
@ -182,6 +186,7 @@ public:
|
||||||
void Think(float, CStateManager&);
|
void Think(float, CStateManager&);
|
||||||
void PreThink(float, CStateManager&);
|
void PreThink(float, CStateManager&);
|
||||||
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&);
|
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&);
|
||||||
|
void AddToRenderer(const zeus::CFrustum&, const CStateManager&) const;
|
||||||
bool CanRenderUnsorted(const CStateManager&) const { return true; }
|
bool CanRenderUnsorted(const CStateManager&) const { return true; }
|
||||||
zeus::CVector3f GetAimPosition(const CStateManager&, float) const { return x820_; }
|
zeus::CVector3f GetAimPosition(const CStateManager&, float) const { return x820_; }
|
||||||
void Death(CStateManager&, const zeus::CVector3f&, EScriptObjectState);
|
void Death(CStateManager&, const zeus::CVector3f&, EScriptObjectState);
|
||||||
|
@ -196,6 +201,9 @@ public:
|
||||||
bool ShouldTurn(CStateManager&, float);
|
bool ShouldTurn(CStateManager&, float);
|
||||||
bool ShouldAttack(CStateManager&, float) { return true; }
|
bool ShouldAttack(CStateManager&, float) { return true; }
|
||||||
bool BreakAttack(CStateManager&, float) { return x7d4_ >= x56c_.xc_ && !x8e4_29_getup; }
|
bool BreakAttack(CStateManager&, float) { return x7d4_ >= x56c_.xc_ && !x8e4_29_getup; }
|
||||||
|
bool IsDizzy(CStateManager&, float) {
|
||||||
|
return x450_bodyController->GetBodyStateInfo().GetCurrentStateId() == pas::EAnimationState::LoopReaction;
|
||||||
|
}
|
||||||
|
|
||||||
void FadeIn(CStateManager&, EStateMsg, float);
|
void FadeIn(CStateManager&, EStateMsg, float);
|
||||||
void FadeOut(CStateManager&, EStateMsg, float);
|
void FadeOut(CStateManager&, EStateMsg, float);
|
||||||
|
@ -203,5 +211,8 @@ public:
|
||||||
void GetUp(CStateManager&, EStateMsg, float);
|
void GetUp(CStateManager&, EStateMsg, float);
|
||||||
void Growth(CStateManager&, EStateMsg, float);
|
void Growth(CStateManager&, EStateMsg, float);
|
||||||
void Generate(CStateManager&, EStateMsg, float);
|
void Generate(CStateManager&, EStateMsg, float);
|
||||||
|
void Faint(CStateManager&, EStateMsg, float);
|
||||||
|
void Dead(CStateManager&, EStateMsg, float);
|
||||||
|
void Attack(CStateManager&, EStateMsg, float);
|
||||||
};
|
};
|
||||||
}
|
}
|
Loading…
Reference in New Issue