From c852d63db2ac90f441ab40ed3363bf1fc6a5172b Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Sat, 6 May 2017 23:55:01 -0700 Subject: [PATCH] More collision actor work --- Runtime/Collision/CCollisionActorManager.cpp | 11 ++++++++++- Runtime/Collision/CCollisionActorManager.hpp | 2 +- Runtime/Collision/CJointCollisionDescription.cpp | 8 ++++++++ Runtime/Collision/CJointCollisionDescription.hpp | 2 +- Runtime/MP1/World/CActorContraption.cpp | 6 ++++++ Runtime/MP1/World/CActorContraption.hpp | 2 ++ 6 files changed, 28 insertions(+), 3 deletions(-) diff --git a/Runtime/Collision/CCollisionActorManager.cpp b/Runtime/Collision/CCollisionActorManager.cpp index e31af3e69..021f6b2e0 100644 --- a/Runtime/Collision/CCollisionActorManager.cpp +++ b/Runtime/Collision/CCollisionActorManager.cpp @@ -8,10 +8,19 @@ namespace urde { CCollisionActorManager::CCollisionActorManager(CStateManager&, TUniqueId, TAreaId, - const std::vector&, bool) + const std::vector& descs, bool) + : x0_jointDescriptions(descs) { } +void CCollisionActorManager::Destroy(CStateManager& mgr) const +{ + for (const CJointCollisionDescription& desc : x0_jointDescriptions) + mgr.DeleteObjectRequest(desc.GetCollisionActorId()); + + const_cast(*this).x13_ = true; +} + void CCollisionActorManager::SetActive(CStateManager&, bool) { diff --git a/Runtime/Collision/CCollisionActorManager.hpp b/Runtime/Collision/CCollisionActorManager.hpp index 2e2d34473..317128e6d 100644 --- a/Runtime/Collision/CCollisionActorManager.hpp +++ b/Runtime/Collision/CCollisionActorManager.hpp @@ -21,7 +21,7 @@ public: private: std::vector x0_jointDescriptions; TUniqueId x10_; - + bool x13_ = false; public: CCollisionActorManager(CStateManager&, TUniqueId, TAreaId, const std::vector&, bool); diff --git a/Runtime/Collision/CJointCollisionDescription.cpp b/Runtime/Collision/CJointCollisionDescription.cpp index ed7bda273..16c49b1db 100644 --- a/Runtime/Collision/CJointCollisionDescription.cpp +++ b/Runtime/Collision/CJointCollisionDescription.cpp @@ -48,4 +48,12 @@ CJointCollisionDescription CJointCollisionDescription::OBBCollision(CSegId segId return CJointCollisionDescription(ECollisionType::OBB, segId, -1, v1, v2, 0.f, 0.f, EOrientationType::Zero, name, f1); } + +void CJointCollisionDescription::ScaleAllBounds(const zeus::CVector3f& scale) +{ + xc_ *= scale; + x24_ *= scale.x; + x28_ *= scale.x; + x18_ *= scale; +} } diff --git a/Runtime/Collision/CJointCollisionDescription.hpp b/Runtime/Collision/CJointCollisionDescription.hpp index e1cbce868..837b55bd2 100644 --- a/Runtime/Collision/CJointCollisionDescription.hpp +++ b/Runtime/Collision/CJointCollisionDescription.hpp @@ -52,7 +52,7 @@ public: zeus::CVector3f GetPivotPoint() const; float GetRadius() const; void SetCollisionActorId(TUniqueId); - EOrientationType GetOrientationType() const; + EOrientationType GetOrientationType() const { return x4_orientType; } float GetMass() const; zeus::CAABox GetBounds() const; void GetType() const; diff --git a/Runtime/MP1/World/CActorContraption.cpp b/Runtime/MP1/World/CActorContraption.cpp index 4dfbf0f2c..41ce52a19 100644 --- a/Runtime/MP1/World/CActorContraption.cpp +++ b/Runtime/MP1/World/CActorContraption.cpp @@ -1,4 +1,5 @@ #include "MP1/World/CActorContraption.hpp" +#include "TCastTo.hpp" namespace urde { @@ -12,4 +13,9 @@ MP1::CActorContraption::CActorContraption(TUniqueId uid, const std::string& name 0.f, false, false, false, false) { } + +void MP1::CActorContraption::Accept(IVisitor& visitor) +{ + visitor.Visit(this); +} } diff --git a/Runtime/MP1/World/CActorContraption.hpp b/Runtime/MP1/World/CActorContraption.hpp index 8d53f9b91..b7a76117e 100644 --- a/Runtime/MP1/World/CActorContraption.hpp +++ b/Runtime/MP1/World/CActorContraption.hpp @@ -18,6 +18,8 @@ public: CActorContraption(TUniqueId, const std::string&, const CEntityInfo&, const zeus::CTransform&, CModelData&&, const zeus::CAABox&, const CMaterialList&, float, float, const CHealthInfo&, const CDamageVulnerability&, const CActorParameters&, ResId, const CDamageInfo&, bool); + + void Accept(IVisitor &visitor); }; } }