From 4568b2e3f60a2f3c946e16cb43d6e40da9305bfb Mon Sep 17 00:00:00 2001 From: Luke Street Date: Sun, 23 Aug 2020 14:08:25 -0400 Subject: [PATCH] CRipper: AddPlatform & KnockBack fixes --- Runtime/MP1/World/CRipper.cpp | 22 +++++++++++++++------- Runtime/MP1/World/CRipper.hpp | 4 +++- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/Runtime/MP1/World/CRipper.cpp b/Runtime/MP1/World/CRipper.cpp index 9e67b1016..ae525db87 100644 --- a/Runtime/MP1/World/CRipper.cpp +++ b/Runtime/MP1/World/CRipper.cpp @@ -25,14 +25,14 @@ CRipper::CRipper(TUniqueId uid, std::string_view name, EFlavorType type, const C } void CRipper::Think(float dt, CStateManager& mgr) { - if (!GetActive()) return; ProcessGrapplePoint(mgr); const CPlayer& pl = mgr.GetPlayer(); CGrappleArm::EArmState armState = pl.GetPlayerGun()->GetGrappleArm().GetAnimState(); - if (x598_grapplePoint != kInvalidUniqueId && pl.GetOrbitTargetId() == x598_grapplePoint && pl.GetGrappleState() != CPlayer::EGrappleState::None) { + if (x598_grapplePoint != kInvalidUniqueId && pl.GetOrbitTargetId() == x598_grapplePoint && + pl.GetGrappleState() != CPlayer::EGrappleState::None) { if (pl.GetGrappleState() != CPlayer::EGrappleState::Firing && (armState > CGrappleArm::EArmState::Three)) { Stop(); if (!x59c_24_muted) { @@ -82,10 +82,13 @@ void CRipper::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateMan break; } } + void CRipper::KnockBack(const zeus::CVector3f& dir, CStateManager& mgr, const CDamageInfo& dInfo, EKnockBackType kb, bool inDeferred, float mag) { CPatterned::KnockBack(dir, mgr, dInfo, kb, inDeferred, mag); + x450_bodyController->GetCommandMgr().DeliverCmd(CBCKnockBackCmd(-dir, pas::ESeverity::One)); } + void CRipper::Patrol(CStateManager& mgr, EStateMsg msg, float arg) { x450_bodyController->GetCommandMgr().SetSteeringBlendMode(ESteeringBlendMode::FullSpeed); x450_bodyController->GetCommandMgr().SetSteeringSpeedRange(1.f, 1.f); @@ -107,7 +110,8 @@ void CRipper::AddGrapplePoint(CStateManager& mgr) { x598_grapplePoint = mgr.AllocateUniqueId(); mgr.AddObject(new CScriptGrapplePoint(x598_grapplePoint, "RipperGrapplePoint"sv, - CEntityInfo(GetAreaIdAlways(), NullConnectionList), GetTransform(), true, x568_grappleParams)); + CEntityInfo(GetAreaIdAlways(), NullConnectionList), GetTransform(), true, + x568_grappleParams)); } void CRipper::RemoveGrapplePoint(CStateManager& mgr) { @@ -123,8 +127,11 @@ void CRipper::AddPlatform(CStateManager& mgr) { x59a_platformId = mgr.AllocateUniqueId(); const zeus::CAABox bounds = GetModelData()->GetBounds(GetTransform().getRotation()); - mgr.AddObject(new CRipperControlledPlatform(x59a_platformId, GetUniqueId(), "Ripper Controlled Platform"sv, - CEntityInfo(GetAreaIdAlways(), NullConnectionList), GetTransform(), bounds, GetActive(), {})); + const auto& platform = new CRipperControlledPlatform(x59a_platformId, GetUniqueId(), "Ripper Controlled Platform"sv, + CEntityInfo(GetAreaIdAlways(), NullConnectionList), + GetTransform(), bounds, GetActive(), {}); + mgr.AddObject(platform); + platform->AddMaterial(EMaterialTypes::ProjectilePassthrough); } void CRipper::RemovePlatform(CStateManager& mgr) { @@ -133,11 +140,12 @@ void CRipper::RemovePlatform(CStateManager& mgr) { mgr.FreeScriptObject(x59a_platformId); x59a_platformId = kInvalidUniqueId; } + CRipperControlledPlatform::CRipperControlledPlatform( TUniqueId uid, TUniqueId owner, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf, const zeus::CAABox& bounds, bool active, const std::optional>& colTree) : CScriptPlatform(uid, name, info, xf, CModelData::CModelDataNull(), CActorParameters::None(), bounds, 0.f, false, 1.f, - active, CHealthInfo(FLT_MAX, 10.f), CDamageVulnerability::ImmuneVulnerabilty(), colTree, 0, 1, 1) + active, CHealthInfo(FLT_MAX, 10.f), CDamageVulnerability::ImmuneVulnerabilty(), colTree, false, 1, 1) , x358_owner(owner) , x35c_yaw(GetYaw()) {} -} \ No newline at end of file +} // namespace urde::MP1 diff --git a/Runtime/MP1/World/CRipper.hpp b/Runtime/MP1/World/CRipper.hpp index 0c4121584..0177fb314 100644 --- a/Runtime/MP1/World/CRipper.hpp +++ b/Runtime/MP1/World/CRipper.hpp @@ -17,6 +17,7 @@ class CRipper : public CPatterned { void RemoveGrapplePoint(CStateManager&); void AddPlatform(CStateManager&); void RemovePlatform(CStateManager&); + public: DEFINE_PATTERNED(Ripper) CRipper(TUniqueId uid, std::string_view name, EFlavorType type, const CEntityInfo& info, const zeus::CTransform& xf, @@ -41,8 +42,9 @@ public: class CRipperControlledPlatform : public CScriptPlatform { TUniqueId x358_owner; float x35c_yaw; + public: CRipperControlledPlatform(TUniqueId, TUniqueId, std::string_view, const CEntityInfo&, const zeus::CTransform&, const zeus::CAABox&, bool, const std::optional>&); }; -} \ No newline at end of file +} // namespace urde::MP1