From c436ea14058781697229445f3df16ad3d2f95635 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Sat, 15 Aug 2020 04:35:17 -0400 Subject: [PATCH] CFlaahgra: UpdateAimPosition fixes --- Runtime/MP1/World/CFlaahgra.cpp | 15 +++++++++++---- Runtime/MP1/World/CFlaahgra.hpp | 1 + 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Runtime/MP1/World/CFlaahgra.cpp b/Runtime/MP1/World/CFlaahgra.cpp index 9c84e07fb..675352754 100644 --- a/Runtime/MP1/World/CFlaahgra.cpp +++ b/Runtime/MP1/World/CFlaahgra.cpp @@ -724,6 +724,7 @@ void CFlaahgra::UpdateHealthInfo(CStateManager& mgr) { } } } + void CFlaahgra::UpdateAimPosition(CStateManager& mgr, float dt) { if (TCastToConstPtr head = mgr.GetObjectById(x80c_headActor)) { pas::EAnimationState animState = x450_bodyController->GetBodyStateInfo().GetCurrentStateId(); @@ -731,21 +732,22 @@ void CFlaahgra::UpdateAimPosition(CStateManager& mgr, float dt) { return; zeus::CVector3f vec; - if (x780_ != 0 && !x8e4_28_ && !sub801e4f8()) + if (x780_ == 0 || x8e4_28_ || sub_801ae638() || sub801e4f8()) vec = head->GetTranslation(); else - vec = GetTranslation() + zeus::CVector3f(0.f, 0.f, 3.7674999f) + - (zeus::CVector3f(0.f, 0.f, 4.1550002f) * GetModelData()->GetScale()); + vec = GetTranslation() + zeus::CVector3f(0.f, 0.f, 3.7675f) + + (zeus::CVector3f(0.f, 0.f, 4.155f) * GetModelData()->GetScale()); zeus::CVector3f diff = vec - x820_; if (diff.canBeNormalized()) { if (diff.magnitude() > (125.f * dt)) - x820_ += ((1.f / diff.magnitude()) * diff) * (125.f * dt); + x820_ += (125.f * dt) * (1.f / diff.magnitude()) * diff; else x820_ = vec; } } } + void CFlaahgra::SetMaterialProperties(const std::unique_ptr& actMgr, CStateManager& mgr) { for (u32 i = 0; i < actMgr->GetNumCollisionActors(); ++i) { TUniqueId uid = actMgr->GetCollisionDescFromIndex(i).GetCollisionActorId(); @@ -758,6 +760,7 @@ void CFlaahgra::SetMaterialProperties(const std::unique_ptrGetBodyStateInfo().GetCurrentStateId() == pas::EAnimationState::ProjectileAttack; +} + CFlaahgraPlants::CFlaahgraPlants(const TToken& genDesc, const CActorParameters& actParms, TUniqueId uid, TAreaId aId, TUniqueId owner, const zeus::CTransform& xf, const CDamageInfo& dInfo, const zeus::CVector3f& extents) diff --git a/Runtime/MP1/World/CFlaahgra.hpp b/Runtime/MP1/World/CFlaahgra.hpp index 65f55a639..ba669b87b 100644 --- a/Runtime/MP1/World/CFlaahgra.hpp +++ b/Runtime/MP1/World/CFlaahgra.hpp @@ -186,6 +186,7 @@ class CFlaahgra : public CPatterned { CFlaahgraProjectile* CreateProjectile(const zeus::CTransform& xf, CStateManager& mgr); TUniqueId GetMirrorNearestPlayer(const CStateManager&) const; + bool sub_801ae638(); public: DEFINE_PATTERNED(Flaahgra);