From c474b19b9df25b86bc3569a392e1c529cb2c0025 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Fri, 25 Sep 2020 14:14:24 -0400 Subject: [PATCH] CTargetableProjectile: Implement ResolveCollisionWithActor & fixes --- Runtime/Weapon/CTargetableProjectile.cpp | 17 +++++++++++------ Runtime/Weapon/CTargetableProjectile.hpp | 1 + 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Runtime/Weapon/CTargetableProjectile.cpp b/Runtime/Weapon/CTargetableProjectile.cpp index 94f2f7946..5044cd019 100644 --- a/Runtime/Weapon/CTargetableProjectile.cpp +++ b/Runtime/Weapon/CTargetableProjectile.cpp @@ -35,16 +35,16 @@ bool CTargetableProjectile::Explode(const zeus::CVector3f& pos, const zeus::CVec const CDamageVulnerability& dVuln, TUniqueId hitActor) { bool ret = CEnergyProjectile::Explode(pos, normal, type, mgr, dVuln, hitActor); - if (x2e4_24_active || x2c4_ == kInvalidUniqueId || x2c4_ != mgr.GetPlayer().GetUniqueId()) + if (x2e4_24_active || x2c4_ == kInvalidUniqueId || x2c4_ != mgr.GetPlayer().GetUniqueId()) { return ret; + } if (TCastToConstPtr act = mgr.GetObjectById(xec_ownerId)) { TUniqueId uid = mgr.AllocateUniqueId(); - zeus::CTransform xf = - zeus::lookAt(x170_projectile.GetTranslation(), act->GetAimPosition(mgr, 0.f), zeus::skUp); - CEnergyProjectile* projectile = new CEnergyProjectile( - true, x3d8_weaponDesc, xf0_weaponType, xf, EMaterialTypes::Player, x3e0_damage, uid, GetAreaIdAlways(), - kInvalidUniqueId, xec_ownerId, EProjectileAttrib::None, false, zeus::skOne3f, {}, 0xFFFF, false); + zeus::CTransform xf = zeus::lookAt(x170_projectile.GetTranslation(), act->GetAimPosition(mgr, 0.f), zeus::skUp); + auto* projectile = new CEnergyProjectile(true, x3d8_weaponDesc, xf0_weaponType, xf, EMaterialTypes::Player, + x3e0_damage, uid, GetAreaIdAlways(), x2c4_, xec_ownerId, + EProjectileAttrib::None, false, zeus::skOne3f, {}, 0xFFFF, false); mgr.AddObject(projectile); projectile->AddMaterial(EMaterialTypes::Orbit); mgr.GetPlayer().ResetAimTargetPrediction(uid); @@ -55,4 +55,9 @@ bool CTargetableProjectile::Explode(const zeus::CVector3f& pos, const zeus::CVec return ret; } +void CTargetableProjectile::ResolveCollisionWithActor(const CRayCastResult& res, CActor& act, CStateManager& mgr) { + SetTransform(zeus::lookAt(GetTranslation(), GetAimPosition(mgr, 0.1f))); + CEnergyProjectile::ResolveCollisionWithActor(res, act, mgr); +} + } // namespace urde diff --git a/Runtime/Weapon/CTargetableProjectile.hpp b/Runtime/Weapon/CTargetableProjectile.hpp index fd1b140bf..bbe9a862f 100644 --- a/Runtime/Weapon/CTargetableProjectile.hpp +++ b/Runtime/Weapon/CTargetableProjectile.hpp @@ -23,6 +23,7 @@ public: zeus::CVector3f GetAimPosition(const CStateManager&, float) const override; bool Explode(const zeus::CVector3f& pos, const zeus::CVector3f& normal, EWeaponCollisionResponseTypes type, CStateManager& mgr, const CDamageVulnerability& dVuln, TUniqueId hitActor) override; + void ResolveCollisionWithActor(const CRayCastResult& res, CActor& act, CStateManager& mgr) override; }; } // namespace urde